Skip to content

Commit 4a9f446

Browse files
authored
Docs/clarify samples (#9960)
* add information to the samples root about using the samples * Implement review feedback
1 parent d83f046 commit 4a9f446

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
['redirect', {
2727
redirectors: [
2828
// Default sample page when accessing /samples.
29-
{base: '/samples', alternative: ['bar/vertical']},
29+
{base: '/samples', alternative: ['information']},
3030
],
3131
}],
3232
['vuepress-plugin-code-copy', true],
@@ -130,6 +130,7 @@ module.exports = {
130130
title: 'API'
131131
},
132132
'/samples/': [
133+
'information',
133134
{
134135
title: 'Bar Charts',
135136
children: [

docs/.vuepress/redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/charts/ /charts/line.html
22
/general/ /general/data-structures.html
3-
/samples/ /samples/bar/vertical.html
3+
/samples/ /samples/information.html

docs/samples/information.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Information
2+
3+
## Out of the box working samples
4+
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.
5+
For a sample that can be copyed and pasted and used directly you can check the [usage page](../getting-started/usage.md).
6+
7+
## Autogenerated data
8+
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).
9+
10+
## Actions block
11+
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.

0 commit comments

Comments
 (0)