From b8691c9581bff0eeecb34f98e678dc045a18f33e Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Mon, 11 May 2015 18:57:14 -0600 Subject: [PATCH] Revert "Merge pull request #856 from tannerlinsley/editable-chart-config" This reverts commit a8063de6b8a744b0ad117d20ef7c9138147212f3, reversing changes made to 7f513b87eefc7319f31a4e5590bdd916398ca44d. --- samples/bar.html | 14 +------------- samples/doughnut.html | 23 +++++------------------ samples/line.html | 14 -------------- samples/pie.html | 24 ++++++------------------ samples/polar-area.html | 23 +++++------------------ samples/radar.html | 25 +++++++------------------ src/Chart.Bar.js | 26 -------------------------- src/Chart.Doughnut.js | 22 ---------------------- src/Chart.Line.js | 28 ---------------------------- src/Chart.PolarArea.js | 19 ------------------- src/Chart.Radar.js | 28 ---------------------------- 11 files changed, 24 insertions(+), 222 deletions(-) diff --git a/samples/bar.html b/samples/bar.html index c386c50fa..5bf4b5bae 100644 --- a/samples/bar.html +++ b/samples/bar.html @@ -3,17 +3,15 @@ Bar Chart -
- + diff --git a/samples/doughnut.html b/samples/doughnut.html index 879f72f68..fdf7539a8 100644 --- a/samples/doughnut.html +++ b/samples/doughnut.html @@ -3,7 +3,6 @@ Doughnut Chart -
- diff --git a/src/Chart.Bar.js b/src/Chart.Bar.js index 8127d520a..a3496841f 100644 --- a/src/Chart.Bar.js +++ b/src/Chart.Bar.js @@ -48,9 +48,6 @@ defaults : defaultConfig, initialize: function(data){ - // Save data as a source for updating of values & methods - this.data = data; - //Expose options as a scope variable here so we can access it in the ScaleClass var options = this.options; @@ -143,29 +140,6 @@ this.render(); }, update : function(){ - //Iterate through each of the datasets, and build this into a property of the chart - helpers.each(this.data.datasets,function(dataset,datasetIndex){ - - helpers.extend(this.datasets[datasetIndex], { - label : dataset.label || null, - fillColor : dataset.fillColor, - strokeColor : dataset.strokeColor, - }); - - helpers.each(dataset.data,function(dataPoint,index){ - helpers.extend(this.datasets[datasetIndex].bars[index], { - value : dataPoint, - label : this.data.labels[index], - datasetLabel: dataset.label, - strokeColor : dataset.strokeColor, - fillColor : dataset.fillColor, - highlightFill : dataset.highlightFill || dataset.fillColor, - highlightStroke : dataset.highlightStroke || dataset.strokeColor - }); - },this); - - },this); - this.scale.update(); // Reset any highlight colours before updating. helpers.each(this.activeElements, function(activeElement){ diff --git a/src/Chart.Doughnut.js b/src/Chart.Doughnut.js index 90f3d0265..364b5e51d 100644 --- a/src/Chart.Doughnut.js +++ b/src/Chart.Doughnut.js @@ -45,9 +45,6 @@ //Config is automatically merged by the core of Chart.js, and is available at this.options initialize: function(data){ - // Save data as a source for updating of values & methods - this.data = data; - //Declare segments as a static property to prevent inheriting across the Chart type prototype this.segments = []; this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2; @@ -127,25 +124,6 @@ },this); }, update : function(){ - - // Map new data to data points - if(this.data.length == this.segments.length){ - helpers.each(this.data, function(segment, i){ - helpers.extend(this.segments[i], { - value : segment.value, - fillColor : segment.color, - highlightColor : segment.highlight || segment.color, - showStroke : this.options.segmentShowStroke, - strokeWidth : this.options.segmentStrokeWidth, - strokeColor : this.options.segmentStrokeColor, - label : segment.label - }); - }, this); - } else{ - // Data size changed without properly inserting, just redraw the chart - this.initialize(this.data); - } - this.calculateTotal(this.segments); // Reset any highlight colours before updating. diff --git a/src/Chart.Line.js b/src/Chart.Line.js index bc88488a9..dbc974cbb 100644 --- a/src/Chart.Line.js +++ b/src/Chart.Line.js @@ -62,9 +62,6 @@ name: "Line", defaults : defaultConfig, initialize: function(data){ - // Save data as a source for updating of values & methods - this.data = data; - //Declare the extension of the default point, to cater for the options passed in to the constructor this.PointClass = Chart.Point.extend({ offsetGridLines : this.options.offsetGridLines, @@ -140,31 +137,6 @@ this.render(); }, update : function(){ - //Iterate through each of the datasets, and build this into a property of the chart - helpers.each(this.data.datasets,function(dataset,datasetIndex){ - - helpers.extend(this.datasets[datasetIndex], { - label : dataset.label || null, - fillColor : dataset.fillColor, - strokeColor : dataset.strokeColor, - pointColor : dataset.pointColor, - pointStrokeColor : dataset.pointStrokeColor, - }); - - helpers.each(dataset.data,function(dataPoint,index){ - helpers.extend(this.datasets[datasetIndex].points[index], { - value : dataPoint, - label : this.data.labels[index], - datasetLabel: dataset.label, - strokeColor : dataset.pointStrokeColor, - fillColor : dataset.pointColor, - highlightFill : dataset.pointHighlightFill || dataset.pointColor, - highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor - }); - },this); - - },this); - this.scale.update(); // Reset any highlight colours before updating. helpers.each(this.activeElements, function(activeElement){ diff --git a/src/Chart.PolarArea.js b/src/Chart.PolarArea.js index c220a6f4b..63b7a1a95 100644 --- a/src/Chart.PolarArea.js +++ b/src/Chart.PolarArea.js @@ -59,9 +59,6 @@ //Initialize is fired when the chart is initialized - Data is passed in as a parameter //Config is automatically merged by the core of Chart.js, and is available at this.options initialize: function(data){ - // Save data as a source for updating of values & methods - this.data = data; - this.segments = []; //Declare segment class as a chart instance specific class, so it can share props for this instance this.SegmentArc = Chart.Arc.extend({ @@ -193,22 +190,6 @@ }, update : function(){ - - // Map new data to data points - if(this.data.length == this.segments.length){ - helpers.each(this.data, function(segment, i){ - helpers.extend(this.segments[i], { - fillColor: segment.color, - highlightColor: segment.highlight || segment.color, - label: segment.label, - value: segment.value, - }); - },this); - } else{ - // Data size changed without properly inserting, just redraw the chart - this.initialize(this.data); - } - this.calculateTotal(this.segments); helpers.each(this.segments,function(segment){ diff --git a/src/Chart.Radar.js b/src/Chart.Radar.js index b033c8bb2..0c63761ab 100644 --- a/src/Chart.Radar.js +++ b/src/Chart.Radar.js @@ -67,9 +67,6 @@ }, initialize: function(data){ - // Save data as a source for updating of values & methods - this.data = data; - this.PointClass = Chart.Point.extend({ strokeWidth : this.options.pointDotStrokeWidth, radius : this.options.pointDotRadius, @@ -272,31 +269,6 @@ this.update(); }, update : function(){ - //Iterate through each of the datasets, and build this into a property of the chart - helpers.each(this.data.datasets,function(dataset,datasetIndex){ - - helpers.extend(this.datasets[datasetIndex], { - label : dataset.label || null, - fillColor : dataset.fillColor, - strokeColor : dataset.strokeColor, - pointColor : dataset.pointColor, - pointStrokeColor : dataset.pointStrokeColor, - }); - - helpers.each(dataset.data,function(dataPoint,index){ - helpers.extend(this.datasets[datasetIndex].points[index], { - value : dataPoint, - label : this.data.labels[index], - datasetLabel: dataset.label, - strokeColor : dataset.pointStrokeColor, - fillColor : dataset.pointColor, - highlightFill : dataset.pointHighlightFill || dataset.pointColor, - highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor - }); - },this); - - },this); - this.eachPoints(function(point){ point.save(); }); -- 2.47.3