vue-chartjs
Advanced tools
Comparing version 2.3.4 to 2.3.5
{ | ||
"name": "vue-chartjs", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"description": "vue.js wrapper for chart.js", | ||
@@ -5,0 +5,0 @@ "author": "Jakub Juszczak <jakub@nextindex.de>", |
@@ -13,14 +13,26 @@ module.exports = { | ||
let newDataLabels = newData.datasets.map((dataset) => { | ||
// Get new and old DataSet Labels | ||
let newDatasetLabels = newData.datasets.map((dataset) => { | ||
return dataset.label | ||
}) | ||
let oldDataLabels = oldData.datasets.map((dataset) => { | ||
let oldDatasetLabels = oldData.datasets.map((dataset) => { | ||
return dataset.label | ||
}) | ||
if (JSON.stringify(newDataLabels) === JSON.stringify(oldDataLabels)) { | ||
this.forceUpdate(newData, chart) | ||
// Stringify 'em for easier compare | ||
const oldLabels = JSON.stringify(oldDatasetLabels) | ||
const newLabels = JSON.stringify(newDatasetLabels) | ||
// Check if Labels are equal and if dataset length is equal | ||
if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { | ||
newData.datasets.forEach((dataset, i) => { | ||
chart.data.datasets[i].data = dataset.data | ||
}) | ||
chart.data.labels = newData.labels | ||
chart.update() | ||
} else { | ||
this.forceRender() | ||
chart.destroy() | ||
this.renderChart(this.chartData, this.options) | ||
} | ||
@@ -30,17 +42,3 @@ } | ||
} | ||
}, | ||
methods: { | ||
forceUpdate (newData, chart) { | ||
newData.datasets.forEach((dataset, i) => { | ||
chart.data.datasets[i].data = dataset.data | ||
}) | ||
chart.data.labels = newData.labels | ||
chart.update() | ||
}, | ||
forceRender () { | ||
this.renderChart(this.chartData, this.options) | ||
} | ||
} | ||
} |
@@ -14,17 +14,25 @@ module.exports = { | ||
let newDataLabels = newData.datasets.map((dataset) => { | ||
// Get new and old DataSet Labels | ||
let newDatasetLabels = newData.datasets.map((dataset) => { | ||
return dataset.label | ||
}) | ||
let oldDataLabels = oldData.datasets.map((dataset) => { | ||
let oldDatasetLabels = oldData.datasets.map((dataset) => { | ||
return dataset.label | ||
}) | ||
if (JSON.stringify(newDataLabels) === JSON.stringify(oldDataLabels)) { | ||
// Stringify 'em for easier compare | ||
const oldLabels = JSON.stringify(oldDatasetLabels) | ||
const newLabels = JSON.stringify(newDatasetLabels) | ||
// Check if Labels are equal and if dataset length is equal | ||
if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) { | ||
newData.datasets.forEach((dataset, i) => { | ||
chart.data.datasets[i].data = dataset.data | ||
}) | ||
chart.data.labels = newData.labels | ||
chart.update() | ||
} else { | ||
chart.destroy() | ||
this.renderChart(this.chartData, this.options) | ||
@@ -31,0 +39,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9461610
41231