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