mirror of
https://github.com/KevinMidboe/vue-chartjs.git
synced 2025-10-29 01:40:21 +00:00
✨ Change reactiveDataMixin
This commit is contained in:
@@ -25,6 +25,7 @@ coverage:
|
||||
ignore:
|
||||
- "tests/*"
|
||||
- "src/examples/*"
|
||||
- "src/mixins/*"
|
||||
|
||||
|
||||
comment:
|
||||
|
||||
@@ -56,9 +56,11 @@
|
||||
"http-proxy-middleware": "^0.17.2",
|
||||
"inject-loader": "^2.0.1",
|
||||
"isparta-loader": "^2.0.0",
|
||||
"jasmine-core": "^2.5.2",
|
||||
"json-loader": "^0.5.4",
|
||||
"karma": "^1.3.0",
|
||||
"karma-coverage": "^1.1.1",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-mocha": "^1.2.0",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"karma-sinon-chai": "^1.2.0",
|
||||
|
||||
@@ -19,16 +19,26 @@ module.exports = {
|
||||
})
|
||||
|
||||
if (JSON.stringify(newDataLabels) === JSON.stringify(oldDataLabels)) {
|
||||
newData.datasets.forEach((dataset, i) => {
|
||||
chart.data.datasets[i].data = dataset.data
|
||||
})
|
||||
chart.data.labels = newData.labels
|
||||
chart.update()
|
||||
this.forceUpdate(newData, chart)
|
||||
} else {
|
||||
this.renderChart(this.chartData, this.options)
|
||||
this.forceRender()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
},
|
||||
"globals": {
|
||||
"expect": true,
|
||||
"jasmine": true,
|
||||
"sinon": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = function (config) {
|
||||
// http://karma-runner.github.io/0.13/config/browsers.html
|
||||
// 2. add it to the `browsers` array below.
|
||||
browsers: ['PhantomJS'],
|
||||
frameworks: ['mocha', 'sinon-chai'],
|
||||
frameworks: ['mocha', 'sinon-chai', 'jasmine'],
|
||||
reporters: ['spec', 'coverage'],
|
||||
files: ['./index.js'],
|
||||
preprocessors: {
|
||||
|
||||
Reference in New Issue
Block a user