Sencha Premium Member
chart auto scaling?
If I have a line chart that I am using as a sparkline in a table, and I have a lot of data in that line chart, does the scaling change depending on the width of the chart? Does it auto scale in order to show the data more clearly?
What I am seeing is when i have many data points on my line chart (two line series on the same chart, actually) -- like 200 points per line series, the data seems to shrink to show on only the lower 50% of the chart horizontally. If I resize the browser to enlarge it horizontally, the chart resizes (I call the resize method on the chart when the window resize event occurs), and at a certain point they start to take up the full height of the chart correctly. When i then shrink the browser horizontally they once again change to take up only half of the chart height.
I'm using GXT 3.0.1, and the charts size is originally 200px wide x 20px high before resizing.
I'm trying to figure out if there is some auto scaling occurring because of the number of data points on the chart -- and how can i control or block it. When these same charts have a small number of data points, this doesn't happen.
Sencha Premium Member
Can I get more information on what the properties in the snapEnds method do? Maybe I can use those to override this "auto-scale" thing.
What are these for in the NumericAxis snapends method? "power", "step", "steps"
The purpose of snapEnds is to take the bounds of the data and adjust them (and the steps) to provide 'good looking' numbers. If the actual values for a given axis range from 3 to 91, and the NumericAxis sticks with the default of 10 steps, then 3 should be at the very bottom, and 91 at the very top, with markers then at 3, 11.8, 20.6, 29.4, ... 73.4, 82.2, and 91. This example actually works out well - often data is in the form of floating point numbers, so those intermediate markers would be much longer decimal values.
Instead, snapEnds tries to move the endpoints of the axis to a slightly wider range of values so that the steps are closer to a shorter decimal value (in base 10). Based on the range of data, it also tries to select a number of steps that will make sense.
So yes, the idea is to autoscale, not just for the data, but for the axes - squiggled lines with no context doesn't mean a lot, so the purpose is to give context that is easily readable in base 10.
The problem that we're having is that sometimes developers can know better than this range-guessing, and know things about their data that the axis can't guess. This is the nature of the bug in NumericAxis - deciding how to tell the axis to stop guessing.