reactjs / react-chartjs

common react charting components using chart.js
MIT License
2.93k stars 301 forks source link

Incorrect documentation #148

Closed silverlight513 closed 6 years ago

silverlight513 commented 7 years ago

In the readme it says the following:

data represents the chart data (see chart.js for details)

I've been trying to build a doughnut chart with the data item given by the chart.js examples like so:

var data = {
    labels: [
        "Red",
        "Blue",
        "Yellow"
    ],
    datasets: [
        {
            data: [300, 50, 100],
            backgroundColor: [
                "#FF6384",
                "#36A2EB",
                "#FFCE56"
            ],
            hoverBackgroundColor: [
                "#FF6384",
                "#36A2EB",
                "#FFCE56"
            ]
        }]
};

This wasn't working and took a look at the examples and the data structure is completely different. The data in the example is similar to:

data: [{
  color: '#000',
  label: 'black',
  value: 200
},{
  color: '#FFF',
  label: 'white',
  value: 211
}]
itayariel commented 7 years ago

👍 thanks that helped me

octalmage commented 7 years ago

This library is using an older version of Chart.js, 1.1.1. The documentation has been updated on chartjs.org for the new 2.0 version of the library.

octalmage commented 7 years ago

You can find the old docs here:

https://github.com/chartjs/Chart.js/tree/v1.1.1/docs

Jareechang commented 6 years ago

Thank you @octalmage for the link here. I've added a link to the documentation in README.

Closing issue.