This script creates a highchart that includes 2 Y axes and 1 X axis:
$('#main_chart').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: 'Overview'
},
xAxis: [{
type: 'datetime'
}],
yAxis: [{ // Primary yAxis
labels: {
format: '${value}',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: 'Y1',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: 'Y2',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: true
}],
tooltip: {
shared: true
},
legend: {
layout: 'vertical',
align: 'left',
x: 120,
verticalAlign: 'top',
y: 100,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
scrollbar: {
enabled: true
},
series: [{
name: 'Y1',
data: y1Data
}
,{
name: 'Y2',
data: y2Data
}
]
});
y1Data and y2Data refer to arrays containing nested arrays like
[[1426525200, 2], [1426611600, 0], [1426698000, 0]...]
where the first element represents a date. The dates are consecutive with a daily increment:
1 Mar 2015, 2 Mar 2015, 3 Mar 2015....
However, only the time from 12:00 to 12:55 is shown on the X-axis and nothing else:
I expect to see the dates from
1 Mar 2015, 2 Mar 2015, 3 Mar 2015.... EndDate
. Additionally, why is there a negative value of $20 displayed? There should not be any negative values in the dataset.