From: Tanner Linsley Date: Mon, 15 Jun 2015 01:30:02 +0000 (-0600) Subject: Charts become config blocks (themes, if you will :) X-Git-Tag: 2.0.0-alpha3~10^2~16^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43f2c015f3e2a5b61263e8ab07ff921c5a8541c0;p=thirdparty%2FChart.js.git Charts become config blocks (themes, if you will :) --- diff --git a/src/_charts/chart.bar.js b/src/_charts/chart.bar.js index 9154fb544..24d2abb2b 100644 --- a/src/_charts/chart.bar.js +++ b/src/_charts/chart.bar.js @@ -5,7 +5,8 @@ Chart = root.Chart, helpers = Chart.helpers; - var defaultConfig = { + + Chart.defaults.bar = { hover: { mode: "label" }, @@ -27,49 +28,48 @@ }, }; - - 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);