]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
improve polar-area sample
authorVille Hämäläinen <hamalainen.ville.p@gmail.com>
Sun, 28 Feb 2016 08:03:43 +0000 (10:03 +0200)
committerVille Hämäläinen <hamalainen.ville.p@gmail.com>
Sun, 28 Feb 2016 08:03:43 +0000 (10:03 +0200)
- set title
- set same size canvas as other samples
- remove user select from canvas

samples/polar-area.html

index ee0dad3777773dcffeaa425454896fc69fb82aab..8a69f5a858a97ac24a524f2cfd590744328378b5 100644 (file)
@@ -5,21 +5,22 @@
     <title>Polar Area Chart</title>
     <script src="../dist/Chart.bundle.js"></script>
     <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+    <style>
+    canvas {
+        -moz-user-select: none;
+        -webkit-user-select: none;
+        -ms-user-select: none;
+    }
+    </style>
 </head>
 
 <body>
-    <div id="canvas-holder" style="width:100%">
+    <div id="canvas-holder" style="width:75%">
         <canvas id="chart-area"></canvas>
     </div>
     <button id="randomizeData">Randomize Data</button>
     <button id="addData">Add Data</button>
     <button id="removeData">Remove Data</button>
-    <div>
-        <h3>Legend</h3>
-        <div id="legendContainer">
-
-        </div>
-    </div>
     <script>
     var randomScalingFactor = function() {
         return Math.round(Math.random() * 100);
@@ -65,7 +66,7 @@
             },
             title: {
                 display: true,
-                text: 'Our Favorite Dataset'
+                text: 'Chart.js Polar Area Chart'
             },
             scale: {
               ticks: {
     window.onload = function() {
         var ctx = document.getElementById("chart-area");
         window.myPolarArea = Chart.PolarArea(ctx, config);
-        updateLegend();
     };
 
-    function updateLegend() {
-        $legendContainer = $('#legendContainer');
-        $legendContainer.empty();
-        $legendContainer.append(window.myPolarArea.generateLegend());
-    }
-
     $('#randomizeData').click(function() {
         $.each(config.data.datasets, function(i, piece) {
             $.each(piece.data, function(j, value) {
@@ -97,7 +91,6 @@
             });
         });
         window.myPolarArea.update();
-        updateLegend();
     });
 
     $('#addData').click(function() {
             });
 
             window.myPolarArea.update();
-            updateLegend();
         }
     });
 
         });
 
         window.myPolarArea.update();
-        updateLegend();
     });
     </script>
 </body>