-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Documentation Is:
- [x ] Missing or needed
- [x ] Confusing
- [x ] Not Sure?
Please Explain in Detail...
Let's say you are completely new to ChartJS and want to build a line chart. After reading the installation and getting started pages, you might sensibly visit the Charts > Line page:
https://www.chartjs.org/docs/latest/charts/line.html
The example chart on the page looks great. How would you implement that in your own html page? Well look there is example code right underneath it.
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: options
});
Right... ok that's fine but what am I supposed to put in the data or options fields? The next section is labeled "Dataset Properties". This seems relevant but I'm not really sure how it relates to the data field above. Right at the bottom of the page there is a heading called "Data Structure" which starts:
The data property of a dataset for a line chart can be passed in two formats
Ok so you might think this is referring to the missing data field above and then you might try to do this:
var myLineChart = new Chart(ctx, {
type: 'line',
data: [20, 10],
options: options
});
But of course, even if you were to give a valid options value this would not work...
Your Proposal for Changes
Please define the data types for the data and options fields. What properties do they accept? Where can I find this information? Please reference these datatypes in all the locations where they are needed such as the first example code of the Line documentation. Don't assume a newcomer has any knowledge besides what has been explained in the Getting Started pages.
If this is not possible to do then please supply more full examples. Why not give the full source for the line chart that is shown at the beginning of the line chart documentation?
This is just one example of a page that could be improved, however I find myself constantly lost while looking at the chartjs documentation. For example, looking at the "Performance" page I noticed a property called ticks.sampleSize. So thinking lowering this value might improve performance on my chart but I simply have no idea on which object this property exists. It seems likely to be on the ticks object of the common configuration of some axes object - however this is not explicitly stated neither is it stated how to specify the common axes properties.