南丁格尔饼图支持动态数据

qianming 3 years ago
parent ad350d3d4d
commit 77a266bc5c

@ -190,38 +190,6 @@ export default {
this.options = Object.assign({}, this.options); this.options = Object.assign({}, this.options);
}, },
// //
setOptionsData () {
const optionsSetup = this.optionsSetup;
console.log(optionsSetup);
const optionsData = this.optionsData; // or
console.log(optionsData);
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData, optionsSetup)
: this.dynamicDataFn(optionsData.dynamicData, optionsSetup);
},
//
staticDataFn (val, optionsSetup) {
const staticData = JSON.parse(val);
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = [];
this.options.yAxis.data = staticData.categories;
this.options.xAxis.type = "value";
this.options.yAxis.type = "category";
} else {
this.options.xAxis.data = staticData.categories;
this.options.yAxis.data = [];
this.options.xAxis.type = "category";
this.options.yAxis.type = "value";
}
// series
const series = this.options.series;
for (const i in series) {
if (series[i].type == "bar") {
series[i].data = staticData.series[0].data;
}
}
},
setOptionsData() { setOptionsData() {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
optionsData.dataType == "staticData" optionsData.dataType == "staticData"

Loading…
Cancel
Save