diff --git a/samples/line.html b/samples/line.html index 45cd9229c..0647173b4 100644 --- a/samples/line.html +++ b/samples/line.html @@ -19,6 +19,7 @@

+ @@ -147,6 +148,32 @@ updateLegend(); }); + $('#changeDataObject').click(function() { + config.data = { + labels: ["July", "August", "September", "October", "November", "December"], + datasets: [{ + label: "My First dataset", + data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()], + fill: false, + }, { + label: "My Second dataset", + fill: false, + data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()], + }] + }; + + $.each(config.data.datasets, function(i, dataset) { + dataset.borderColor = randomColor(0.4); + dataset.backgroundColor = randomColor(0.5); + dataset.pointBorderColor = randomColor(0.7); + dataset.pointBackgroundColor = randomColor(0.5); + dataset.pointBorderWidth = 1; + }); + + // Update the chart + window.myLine.update(); + }); + $('#addDataset').click(function() { var newDataset = { label: 'Dataset ' + config.data.datasets.length,