-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Conversation
@janelledement could you add a fiddle that demonstrates your change? Example template: https://codepen.io/pen?template=JXVYzq |
There was a problem hiding this 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)?
@janelledement you also need to add this new example in samples/sample.js, else it will not show up on the home page. |
@simonbrunel Working on adding line and polarArea examples. |
datasets: [{ | ||
data: generateData(), | ||
backgroundColor: '#4dc9f6', | ||
borderColor: '#4dc9f6', |
There was a problem hiding this comment.
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);
}
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
8853809
to
a0bdfbd
Compare
* 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
* 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
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:
I center the buttons underneath the chart.
I add a scriptable hoverBackgroundColor as well as scriptable backgroundColor.
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.