Dojo + Highcharts. The X Axis is not alligned when

2019-09-05 07:47发布

问题:

I am using Dojo and Highcharts, the X axis is not alligned when I use:

....xAxis[0].setCategories(...)

http://jsfiddle.net/xKfU2/6/

In the fiddle, if you comment the first setCategories and you discomment the second one, the X axis is allign, but the chart no. And if you discomment the both of them, you have the both problems.

How can I solve this problem? Thanks in advance.

回答1:

I'm not sure why the problem is occurring, but you can fix it by forcing the x-axis offset like this:

xAxis : {
     offset:0
},

http://jsfiddle.net/SSmtN/

I don't think that you should have to do this. Maybe it's a problem related to using dojo ?



回答2:

I found this solution too (replace the dojo adapter). I replaced this:

<script type="text/javascript" src="http://www.dojotoolkit-fr.org/wp-content/uploads/dojo-adapter.js"></script>

for this:

<script src="http://code.highcharts.com/adapters/standalone-framework.js"></script>

and now goes correctly without doing this:

xAxis : {
 offset:0},

See --> http://www.highcharts.com/component/content/article/2-news/58-highcharts-standalone-framework