chartjs-plugin-datalabels icon indicating copy to clipboard operation
chartjs-plugin-datalabels copied to clipboard

Samples are hard to use

Open jaysridhar opened this issue 4 years ago • 2 comments
trafficstars

The samples are hard to use and hard to understand because of complexity.

  • First off, I could not find what "Utils" is and where it is defined.
  • You should absolutely provide a jsfiddle or codepen for each sample.
  • For instance, I tried to get round labels as demonstrated in the samples, but could not find how to do it. I was only able to get elliptical labels which is not what I want.

jaysridhar avatar Dec 31 '20 04:12 jaysridhar

Here's a good jsfiddle to use: https://jsfiddle.net/simonbrunel/nqkzo4cp/

benwinding avatar Jan 07 '21 05:01 benwinding

@jaysridhar Thank you for your feedback.

The samples are hard to use and hard to understand because of complexity.

Only the chart generation logic is a bit complex but the docs are about using the plugin, not Chart.js. And there is samples for different use cases and some can be a bit complex.

First off, I could not find what "Utils" is and where it is defined.

Utils are internal helpers shared between samples to setup the chart. They are not part of the plugin, neither the core library and you should probably not try to understand how these helpers work. If I'm not wrong, these methods are only used for the chart data and other core options, thus it should not complexify the understanding of the plugin options. Maybe I should find a better name.

Anyway, these methods are in /docs/samples/utils.js

You should absolutely provide a jsfiddle or codepen for each sample.

The plugin options used for each sample are available in the editor under the chart. You can edit these values to see how they impact the rendering. I will look how to generate a codepen from the sample snippets but I don't want to maintain them in 2 locations.

... I tried to get round labels as demonstrated in the samples ...

Unfortunately, this is not possible yet (see #166). In the samples, I used a good padding and font size to have nice looking labels.

simonbrunel avatar Mar 09 '21 22:03 simonbrunel