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

Use parser options in getPixelForValue for time scale #3131

Merged
merged 1 commit into from Aug 22, 2016
Merged

Use parser options in getPixelForValue for time scale #3131

merged 1 commit into from Aug 22, 2016

Conversation

Lighnat0r
Copy link
Contributor

This ensures that data points can be correctly located even if the time scale uses a custom parser.

@etimberg
Copy link
Member

+1 to merge

@etimberg etimberg merged commit b33aff2 into chartjs:master Aug 22, 2016
@@ -338,7 +338,7 @@ module.exports = function(Chart) {
var me = this;
if (!value || !value.isValid) {
// not already a moment object
value = moment(me.getRightValue(value));
value = me.parseTime(me.getRightValue(value));

Choose a reason for hiding this comment

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

...ya know, you could have just used this here... ;)

Copy link
Member

Choose a reason for hiding this comment

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

this would work, but this cannot be minified. Since this would be used in a bunch of places, we do var me = this so that me can be minified in the function. In a single function this doesn't save much, but over the entire lib it saves a few kB.

Copy link
Member

Choose a reason for hiding this comment

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

If I did my maths correctly, it currently saves 4KB (~3%) on the minified version.

Choose a reason for hiding this comment

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

...learn something new... ;)

exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
Use parser options in getPixelForValue for time scale
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.

None yet

4 participants