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

Add examples of scriptable charts #6042

Merged
merged 6 commits into from Feb 14, 2019

Conversation

janelledement
Copy link
Contributor

This PR adds a pie/doughnut example doc demonstrating scriptable options to augment the previously merged #5966. (I spoke to @simonbrunel about this over slack).

I keep to the same format in the document as the other examples found in the scriptable folder with a few changes:

  1. I center the buttons underneath the chart.

  2. I add a scriptable hoverBackgroundColor as well as scriptable backgroundColor.

  3. I add a button that will toggle the view to a Doughnut Chart by changing the cutoutPercentage property.

Let me know if there's anything I can improve on.

@benmccann
Copy link
Contributor

@janelledement could you add a fiddle that demonstrates your change? Example template: https://codepen.io/pen?template=JXVYzq

kurkle
kurkle previously approved these changes Feb 4, 2019
@simonbrunel simonbrunel added this to the Version 2.8 milestone Feb 4, 2019
etimberg
etimberg previously approved these changes Feb 5, 2019
Copy link
Member

@simonbrunel simonbrunel left a comment

Choose a reason for hiding this comment

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

Looks good, just a few minor changes. In your Slack message, I understood that you would like to add more scriptable samples. If so, do you want to update that PR with a line and polarArea examples (and maybe a radar one if not part of #6041 and after it's merged)?

samples/scriptable/pie.html Outdated Show resolved Hide resolved
samples/scriptable/pie.html Outdated Show resolved Hide resolved
samples/scriptable/pie.html Outdated Show resolved Hide resolved
@janelledement janelledement dismissed stale reviews from etimberg and kurkle via b862d7b February 5, 2019 11:55
etimberg
etimberg previously approved these changes Feb 5, 2019
@simonbrunel
Copy link
Member

@janelledement you also need to add this new example in samples/sample.js, else it will not show up on the home page.

@janelledement
Copy link
Contributor Author

@simonbrunel Working on adding line and polarArea examples.

@janelledement janelledement changed the title Add example of scriptable pie chart Add examples of scriptable charts Feb 8, 2019
etimberg
etimberg previously approved these changes Feb 9, 2019
datasets: [{
data: generateData(),
backgroundColor: '#4dc9f6',
borderColor: '#4dc9f6',
Copy link
Member

Choose a reason for hiding this comment

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

I was about to ask to make these two options scriptable but realized it's not yet scriptable for the line element. Once implemented, we should be able to do something like (as part of a different PR):

borderColor: function(context) {
    // make the line and point border color the 
    // same while different for each dataset.
    return utils.color(context.datasetIndex);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simonbrunel Maybe this is a consideration for radar chart as well? Adding scriptable line backgroundColor and borderColor?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you right, line and radar controllers are very similar (currently trying to refactor them).

@etimberg etimberg merged commit 58d7891 into chartjs:master Feb 14, 2019
jonrimmer pushed a commit to jonrimmer/Chart.js that referenced this pull request Feb 14, 2019
* Add example of scriptable pie chart
* Add example of scriptable line chart
* Add example of scriptable polar area chart
* Add example of  scriptable radar chart
@janelledement janelledement deleted the addScriptablePieChart branch February 14, 2019 15:01
exwm pushed a commit to exwm/Chart.js that referenced this pull request Apr 30, 2021
* Add example of scriptable pie chart
* Add example of scriptable line chart
* Add example of scriptable polar area chart
* Add example of  scriptable radar chart
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

6 participants