Skip to content

Implement per-dataset type (default and per-chart) options - #5999

Merged
simonbrunel merged 11 commits into
chartjs:masterfrom
benmccann:controller-default-opts
May 6, 2019
Merged

Implement per-dataset type (default and per-chart) options#5999
simonbrunel merged 11 commits into
chartjs:masterfrom
benmccann:controller-default-opts

Conversation

@benmccann

Copy link
Copy Markdown
Contributor

This fixes mixed line and scatter charts. Issue described in #4587

Closes #5997 & #5151

@kurkle kurkle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After the discussion in Slack, this seems like a good start!

Comment thread karma.conf.js Outdated
Comment thread src/controllers/controller.line.js Outdated
Comment thread src/controllers/controller.line.js Outdated
Comment thread src/core/core.datasetController.js Outdated
Comment thread src/controllers/controller.line.js Outdated
@benmccann
benmccann force-pushed the controller-default-opts branch 5 times, most recently from 15dd6bf to 0b86cf9 Compare January 21, 2019 18:46
Comment thread src/controllers/controller.line.js Outdated
Comment thread src/controllers/controller.scatter.js
Comment thread src/core/core.datasetController.js Outdated
Comment thread src/core/core.datasetController.js
kurkle
kurkle previously approved these changes Jan 22, 2019

@kurkle kurkle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me

Comment thread src/core/core.defaults.js

@simonbrunel simonbrunel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A minor update in _defaults.

We also need unit tests per controller (line + scatter) to make sure that dataset defaults are correctly handled for every options. And I guess we also need to update the docs about configuring dataset defaults.

Comment thread src/core/core.datasetController.js Outdated
@benmccann

Copy link
Copy Markdown
Contributor Author

We also need unit tests per controller (line + scatter) to make sure that dataset defaults are correctly handled for every options.

The line chart showLine option was already well tested. I added additional tests for spanGaps and for scatter's showLine.

And I guess we also need to update the docs about configuring dataset defaults.

We don't allow users to configure default options. defaults._set is private

@benmccann
benmccann force-pushed the controller-default-opts branch 4 times, most recently from 3c0bad6 to 1be7103 Compare January 29, 2019 17:25

@kurkle kurkle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One line to remove and a question to consider.

Comment thread src/core/core.datasetController.js
Comment thread src/controllers/controller.line.js Outdated
@simonbrunel

Copy link
Copy Markdown
Member

We don't allow users to configure default options. defaults._set is private

_set is indeed an internal helper but users are allowed to modify Chart.defaults.datasets.*. So since we are introducing a new public API that allows users to configure defaults for all dataset options, we should also add unit tests for it.

@benmccann

Copy link
Copy Markdown
Contributor Author

Ok, I went ahead and added documentation. I had already added unit tests

Comment thread docs/configuration/README.md Outdated
@benmccann
benmccann force-pushed the controller-default-opts branch 5 times, most recently from b0bd6f4 to 5c3f88f Compare February 12, 2019 04:20
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
@MatsNissen-Lie

Copy link
Copy Markdown

I want to combined the candlestick chart with a line chart. Is that possible, and if so, how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment