问题
For some reason, the scrollbar option for Highcharts is not working on my Rails 3.2.1 application. What is odd is that everything looks exactly the same as this: http://jsfiddle.net/highcharts/fj6d2/
... except that the scrollbar is missing. I have the exact same code as that shown in the jsfiddle above, the graph appears on my local application, but the scrollbar is missing.
This is the code in my local app, the same as in the jsfiddle:
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
min: 6
},
legend: {
verticalAlign: 'top',
y: 100,
align: 'right'
},
scrollbar: {
enabled: true
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
Again, the graph shows, but only the scrollbar doesn't. Why isn't the scrollbar showing? Has anybody had success using a scrollbar in their highcharts graphs? I would love to get a fix for this, I really am stumped as to why its not working.
回答1:
I figured out what was wrong. In my local app, I was loading the highcharts.js file, whereas in the jsfiddle it was loading highstock.js. Adding this:
<script type="text/javascript" src="http://www.highcharts.com/js/highstock.js"></script>
fixed the problem.
来源:https://stackoverflow.com/questions/11406458/highcharts-scrollbar-not-appearing