]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Charts become config blocks (themes, if you will :)
authorTanner Linsley <tannerlinsley@gmail.com>
Mon, 15 Jun 2015 01:30:02 +0000 (19:30 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Mon, 15 Jun 2015 01:30:02 +0000 (19:30 -0600)
src/_charts/chart.bar.js

index 9154fb5445cb2ea51eb32a5fa14b502262f1d949..24d2abb2bfbdebd30d1892a3650532bbb5d7425c 100644 (file)
@@ -5,7 +5,8 @@
                Chart = root.Chart,
                helpers = Chart.helpers;
 
-       var defaultConfig = {
+
+       Chart.defaults.bar = {
                hover: {
                        mode: "label"
                },
                },
        };
 
-
-       Chart.Type.extend({
-               name: "Bar",
-               defaults: defaultConfig,
-               initialize: function() {
-                       this.elementController = new Chart.RectangularElementController(this);
-                       this.canvasController = new Chart.RectangularCanvasController(this, this.elementController);
-
-                       //Create a new bar for each piece of data
-                       helpers.each(this.data.datasets, function(dataset, datasetIndex) {
-                               helpers.each(dataset.data, function(dataPoint, index) {
-                                       this.elementController.addRectangle(dataset, datasetIndex, index);
-                               }, this);
-
-                               // The bar chart only supports a single x axis because the x axis is always a category axis
-                               dataset.xAxisID = this.options.scales.xAxes[0].id;
-
-                               if (!dataset.yAxisID) {
-                                       dataset.yAxisID = this.options.scales.yAxes[0].id;
-                               }
-                       }, this);
-
-                       this.canvasController.initialize();
-               },
-               draw: function(ease) {
-
-                       var easingDecimal = ease || 1;
-                       this.clear();
-
-                       // Draw all the scales
-                       helpers.each(this.scales, function(scale) {
-                               scale.draw(this.chartArea);
-                       }, this);
-
-                       //Draw all the bars for each dataset
-                       this.eachElement(function(bar, index, datasetIndex) {
-                               bar.transition(easingDecimal).draw();
-                       }, this);
-
-                       // Finally draw the tooltip
-                       this.tooltip.transition(easingDecimal).draw();
-               },
-       });
+       // Chart.Type.extend({
+       //      name: "Bar",
+       //      defaults: defaultConfig,
+       //      initialize: function() {
+       //              this.elementController = new Chart.RectangularElementController(this);
+       //              this.canvasController = new Chart.RectangularCanvasController(this, this.elementController);
+
+       //              //Create a new bar for each piece of data
+       //              helpers.each(this.data.datasets, function(dataset, datasetIndex) {
+       //                      helpers.each(dataset.data, function(dataPoint, index) {
+       //                              this.elementController.addRectangle(dataset, datasetIndex, index);
+       //                      }, this);
+
+       //                      // The bar chart only supports a single x axis because the x axis is always a category axis
+       //                      dataset.xAxisID = this.options.scales.xAxes[0].id;
+
+       //                      if (!dataset.yAxisID) {
+       //                              dataset.yAxisID = this.options.scales.yAxes[0].id;
+       //                      }
+       //              }, this);
+
+       //              this.canvasController.initialize();
+       //      },
+       //      draw: function(ease) {
+
+       //              var easingDecimal = ease || 1;
+       //              this.clear();
+
+       //              // Draw all the scales
+       //              helpers.each(this.scales, function(scale) {
+       //                      scale.draw(this.chartArea);
+       //              }, this);
+
+       //              //Draw all the bars for each dataset
+       //              this.eachElement(function(bar, index, datasetIndex) {
+       //                      bar.transition(easingDecimal).draw();
+       //              }, this);
+
+       //              // Finally draw the tooltip
+       //              this.tooltip.transition(easingDecimal).draw();
+       //      },
+       // });
 
 
 }).call(this);