highstock, how to prevent chart rescaling

2019-05-30 14:47发布

I am experimenting with highcharts and there is one thing that many charts have as a functionality and that is to rescale the current view to show only the datapoints that currently are in view to fit the chart.

For instance, given these datapoints on a large time period, :

[1, 50, 100, 1, 50, 100, 200 ] 

The chart will show up initially with a scale of say 1 - 200.

When you then move the chart left to view older data, 200 gets out of the view, and the graph gets rescaled into 1 - 100, then 1 - 50, then 1 - 1, then it grows again to 1 - 100.

The problem with this should be obvious. If you are trying to get any sense of the data by scrolling back in history, you can't really.

Although I do agree that sometimes it is desirable to rescale, it isn't always the case.

Sometimes you just want to view the graph as is, using a large range around large discrepancies in the data, without rescaling to try to fit all datapoints.

I have tried to set reflow: false but this did not work.

Any ideas on wether this is possible or not?

Edit:

Here is a fiddle that attemps to show some of these problems in example:

https://jsfiddle.net/3Ld2zmum/1/

If you just scroll on the default zoom, then you will suddenly see there is a datapoint that in my case should be ignored. I would like to see the data around it. I do not want it to affect the zoom level.

Right now, I am prevented from effeciently analyzing data around this point because the graph keeps scaling up and down.

The problem with rescaling is that a high/low datapoint will automatically zoom all other data out so it becomes really small when there are hugh sudden variances in the dataset.

I can choose a small timeperiod, but then it becomes really difficult to analyze huge amounts of data with such a small range.

After having thought about this, i understand that the only way to solve this issue would be to introduce some kind of scroll on the y axis, so that when you move left, you will actually see only white space.

You would have to manually scroll down to see the data. That way, the scaling won't interfer with the actual direction of the data and you won't get confused by data that can change the flow of the data.

In such circumstances again, it would sometimes be preferable to just allow scroll left, without rescaling, allowing the data to get out of view on the y-axis, and allowing you to study data around the big discreprancy without adjusting the rangeSelector to a really small one to avoid such datapoints on short intervals.

Does this make any sense?

1条回答
走好不送
2楼-- · 2019-05-30 15:30

To stop the auto-scaling of the yAxis you can set the yAxis.min and yAxis.max values like so:

    yAxis: {
        min: 0,
        max: 13000,
        title: {
            text: 'AAA'
        }
    },

Yes, you will need to set some sort of max value either by knowing ahead of time what the max should be or by calculating the data's max value and adding some kind of padding.

查看更多
登录 后发表回答