]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fixed wrong structure of example data 1704/head
authorMarius Meißner <marius.meissner@googlemail.com>
Fri, 27 Nov 2015 07:34:32 +0000 (08:34 +0100)
committerMarius Meißner <marius.meissner@googlemail.com>
Fri, 27 Nov 2015 07:34:32 +0000 (08:34 +0100)
docs/06-Pie-Doughnut-Chart.md

index 51aaaff2253b057e18bc04750b5296d82f6d69df..9511112e2f67fcb308d13a85c80cc98883ac63f4 100644 (file)
@@ -42,27 +42,26 @@ var myDoughnutChart = new Chart(ctx[1], {
 
 ```javascript
 var data = {
-       datasets: [
-               {
-                       data: [300, 50, 100],
-                       backgroundColors: [
-                               "#F7464A",
-                               "#46BFBD",
-                               "#FDB45C"
-                       ],
-                       hoverBackgroundColor:[
-                                "#FF5A5E",
-                                 "#5AD3D1",
-                                       "#FFC870"
-                       ]
-               },
-               labels: [
-                       "Red",
-                       "Green",
-                       "Yellow"
-               ]
-       ]
-}
+    labels: [
+        "Red",
+        "Green",
+        "Yellow"
+    ],
+    datasets: [
+        {
+            data: [300, 50, 100],
+            backgroundColor: [
+                "#F7464A",
+                "#46BFBD",
+                "#FDB45C"
+            ],
+            hoverBackgroundColor: [
+                "#FF5A5E",
+                "#5AD3D1",
+                "#FFC870"
+            ]
+        }]
+};
 ```
 
 For a pie chart, you must pass in an array of objects with a value and an optional color property. The value attribute should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each. The color attribute should be a string. Similar to CSS, for this string you can use HEX notation, RGB, RGBA or HSL.