chartjs / chartjs/Chart.js

HTML template for using config / setup / actions from Samples section

Open
#10,778 2 comments 0 reactions 0 assignees View on GitHub
type: documentation
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Documentation Is:

- [X] Missing or needed?
- [ ] Confusing
- [ ] Not sure?

### Please Explain in Detail...

Hi all,

maybe I just overlooked that part in you documentation.

But it took me some time to figure out, how to use the code displayed in Samples section from tabs config / setup / actions - e.g. from here https://www.chartjs.org/docs/latest/samples/bar/border-radius.html - in some working HTML example.

I simply missed some HTML template, where I would replace 3 sections with the code from the Sample to see the outcome.

Regards,
Lukas

### Your Proposal for Changes

I would add somewhere in this [page](
https://www.chartjs.org/docs/latest/samples/information.html) a sample HTML template (e.g. using CDN for including the js library) and the instruction that it is enough to replace 3 sections based on the Sample for config / setup / actions tabs.

To be honest I did not investigate where to copy the code from actions tab. I did not need that in my HTML example.

Important are these two lines, but some complete example is needed:
```
...

const ctx = document.getElementById('myChart');

// definitions for config / setup / actions

const myChart = new Chart(ctx, config);

...
```

### Example

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.