Skip to content

Conversation

@etimberg
Copy link
Member

Replaces #1581 which was opened to the wrong branch.

@stephanarts What would your ideal behaviour be when all values are 0?

@stephanarts
Copy link

To explain what my ideal behaviour would be I need to explain two configuration parameters that I would like to see.

With lack of a better word for it, call them a 'minimum end value' and a 'minimum start value'. If the data is outside those boundaries, the current behaviour of scaling would occor normally. But if you've specified a minimum end-value of 1.0 and the data would jump between 0.09 and 0.11, you would still see it at ~ 10% of the scale.

If a value changes very little, the chart is now 'zooming in' to show those small variations in great detail. This limits the information you can get out of it.

With minimum ''start' and 'end'-values you can set, people can specify that the graph should show at least a scale of X to Y even if the variation is very limited.

For the case with all values of '0', I would like them drawn at the (top) or bottom of the graph, depending on wether the minimum start or end value is > or < then 0.

I hope I am making a little sense here.

(edited for clarity)

@stephanarts
Copy link

For a use-case where these parameters would make sense, consider a graph showing the traffic on an ethernet interface. If the interface is mostly idle, this would mean the chart would 'zoom in' and show very heavy variations of what would be just a few kilobytes worth of pings and arp requests.

With a minimum end value, a user can force the scale to go at least to 10.000.000, (10Mbit) forcing all of those values at the bottom of the graph, where you would expect them. (Or in the middle if you want to represent incoming traffic and outgoing traffic as positive and negative values) With whitespace around the graph to give some context.

@etimberg
Copy link
Member Author

@stephanarts I think I understand what you're looking for. You'd like options such as the following for each linear axis.

ticks: {
    // Number [optional] - suggested minimum for scale. scale.min = Math.min(data.min, options.ticks.min);
    suggestedMin: 0, 

    // Number [optional] - forced maximum for scale. scale.max = Math.max(data.max, options.ticks.max)
    suggestedMax: 1,
}

@stephanarts
Copy link

Indeed :)

@tannerlinsley
Copy link
Contributor

Interesting. So instead of showing up as -1 and 1, it would use the suggestedMin and Max?

@etimberg
Copy link
Member Author

Yup, suggested min/max could be used at any time. I propose suggestedMin and suggestedMax because I envision using min and max for better zoom/pan support

@etimberg
Copy link
Member Author

@stephanarts I prototyped out a first version of suggestedMin and suggestedMax. I have a question about the behaviour of these options.

Is it alright if the scale max ends up higher than suggestedMax due to rounding for tick size? For instance, if suggestedMax = 950 and max(data) == 50, is it alright if the scale maximum becomes 1000?

@stephanarts
Copy link

I think that's not a problem. It is to help get a good first impression of what kind of value you are looking at.

@etimberg
Copy link
Member Author

ok, great. I'll get my changes pushed up and included in this PR

etimberg added a commit that referenced this pull request Nov 1, 2015
…stant-data

Scale expansion if min === max will only occur after ticks.beginAtZero is handled
@etimberg etimberg merged commit cf58712 into v2.0-dev Nov 1, 2015
@etimberg etimberg deleted the fix/begin-at-zero-issue-with-constant-data branch November 12, 2015 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants