Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ticks.mode to scale.distribution #4582

Merged
merged 1 commit into from Jul 30, 2017

Conversation

simonbrunel
Copy link
Member

@simonbrunel simonbrunel commented Jul 29, 2017

Fix ticks.mode behavior when ticks.source is auto: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to distribution (more explicit than mode) and since this option applies from now on the data, it seems better to have it under scale instead scale.ticks.

Related to #4507

@benmccann

@simonbrunel simonbrunel added this to the Version 2.7 milestone Jul 29, 2017
return [
{time: min, pos: 0},
{time: max, pos: 1}
];
}

var table = [];
var items = timestamps.slice(0);
var items = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should you just make this var items = [min]; and avoid the need for items.push(min) below?

me._horizontal = me.isHorizontal();
me._labels = labels.sort(sorter); // Sort labels **after** data have been converted
me._timestamps = timestamps;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might call this _dataTimestamps to distinguish from ticks and labels

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_data then to be consistent with _labels and _datasets

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not all the data though (just the timestamps), so I think that might make it harder to read. Maybe _dataMillis, _labelMillis, and _datasetMillis ?

@benmccann
Copy link
Contributor

lgtm

@benmccann
Copy link
Contributor

thank you for this!!

Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this option applies from now on the data, it seems better to have it under `scale` instead `scale.ticks`.
@simonbrunel simonbrunel merged commit 97e2373 into chartjs:master Jul 30, 2017
@simonbrunel simonbrunel deleted the scale-distribution branch July 30, 2017 19:24
yofreke pushed a commit to yofreke/Chart.js that referenced this pull request Dec 30, 2017
Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this option applies from now on the data, it seems better to have it under `scale` instead `scale.ticks`.
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this option applies from now on the data, it seems better to have it under `scale` instead `scale.ticks`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants