我有一个相对简单的 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],
]},
],
});