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

Docs/clarify samples #9960

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/.vuepress/config.js
Expand Up @@ -26,7 +26,7 @@ module.exports = {
['redirect', {
redirectors: [
// Default sample page when accessing /samples.
{base: '/samples', alternative: ['bar/vertical']},
{base: '/samples', alternative: ['information']},
],
}],
['vuepress-plugin-code-copy', true],
Expand Down Expand Up @@ -130,6 +130,7 @@ module.exports = {
title: 'API'
},
'/samples/': [
'information',
kurkle marked this conversation as resolved.
Show resolved Hide resolved
{
title: 'Bar Charts',
children: [
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/redirects
@@ -1,3 +1,3 @@
/charts/ /charts/line.html
/general/ /general/data-structures.html
/samples/ /samples/bar/vertical.html
/samples/ /samples/information.html
11 changes: 11 additions & 0 deletions docs/samples/information.md
@@ -0,0 +1,11 @@
# Information

## Out of the box working samples
These samples are made for demonstration purposes only. They won't work out of the box if you copy paste them into your own website. This is because of how the docs are getting built. Some boilerplate code gets hidden.
For a sample that can be copyed and pasted and used directly you can check the [usage page](../getting-started/usage.md).

## Autogenerated data
The data used in the samples is autogenerated using custom functions. These functions do not ship with the library, for more information about this you can check the [utils page](./utils.md).

## Actions block
The samples have an `actions` code block. These actions are not part of chart.js. They are internally transformed to seperate buttons together with onClick listeners by a plugin we use in the documentation. To implement such actions yourself you can make some buttons and add onClick event listeners to them. Then in these event listeners you can call your variable in which you made the chart and do the logic that the button is supposed to do.