Using arearange series in highchart on inverted graphs

大兔子大兔子 提交于 2019-12-12 04:38:13

问题


my question is quite simple : have you already experienced some trouble using the arearange series on inverted chart with Hightchart ?

As you can see in this JSFiddle example ( its the arearange example where I've added the inverted settings.)

        chart: {
            type: 'arearange',
            zoomType: 'x',
            inverted:true //toggle this setting true/ false to see the differences
        },

The displayed data seems totally broken. We can zoom in to compare, the displayed data is totally different when inverted :/

Anybody aware of this ?
do you know a workaround so we can use both inverted and arearange in the same chart ? Or simply I'm using this the wrong way ?


回答1:


This issue is fixed now, see https://github.com/highslide-software/highcharts.com/issues/1930. It was a regression, worked in 3.0.1.




回答2:


I found a little workaround, since the corrupted values seemed flipped, I've played with my computed values for the second data series of the arearange.

I was applying a linear transformation to map the values of the second series on the first series's axis. The result is good on normal chart but seemed flipped on inverted charts

What I'm doing to fix the result on the inverted version is changing the linear tranformation from this :

var value2 = a*data2[index] + b;

to this :

var value2 = max1-(a*data2[index]); 

where max1 if the max value for the first series axis. So I guess the inverted chart apply a wrong transformation on the second series of the arearange such as :

 val = axisMax - val;

or something similar.

I'm still looking for a complete fix.



来源:https://stackoverflow.com/questions/16988670/using-arearange-series-in-highchart-on-inverted-graphs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!