我有一个我想使用共享十字准线的相对简单的Highcharts图表,但是由于某种原因,我无法使我的工具提示正常工作。这是我的JavaScript代码:
var myChart = new Highcharts.Chart({
chart: {
renderTo: 'container',
width: '675',
height: '400',
},
toolTip: {
crosshairs: {
width: 2,
color: 'gray',
dashStyle: 'shortdot'
},
shared: true,
enabled: true
},
xAxis: {
title: {
text: 'Date',
align: 'middle',
margin: 15,
},
reverse: false,
type: 'datetime',
opposite: false,
},
yAxis: [{
title: {
text: '% Change',
align: 'middle',
margin: 15,
},
reverse: false,
opposite: false,
},
{
title: {
text: 'actual amount',
align: 'middle',
margin: 15,
},
reverse: false,
opposite: true,
}, ],
title: {
text: 'Comparison Chart',
align: 'center',
margin: 15,
},
series: [{
pointInterval: 86400000,
name: 'Your actual amount',
type: 'spline',
yAxis: '1',
color: '#4572A7',
data: [[1291248000000, 4140],
[1291334400000, 342],
[1291420800000, 56],
[1291507200000, 58],
[1291593600000, 712],
]},
{
pointInterval: 86400000,
dashStyle: 'ShortDashDot',
name: 'Other\'s %',
type: 'spline',
yAxis: '0',
color: '#89A54E',
data: [[1291248000000, 47.02],
[1291334400000, -28.68],
[1291420800000, -59.98],
[1291507200000, 182.14],
[1291593600000, -12.81],
]},
{
pointInterval: 86400000,
dashStyle: 'ShortDash',
name: 'Your %',
type: 'spline',
yAxis: '0',
color: '#AA4643',
data: [[1291248000000, 246.73],
[1291334400000, -91.74],
[1291420800000, -83.63],
[1291507200000, 3.57],
[1291593600000, 1127.59],
]},
],
});
最佳答案
我发现的唯一一件事是,在上面的JSON中放置了toolTip,而在highchart示例中,它是工具提示(全部为小写)。