feat--多柱线图柱体增加堆叠样式

qianming 1 year ago
parent 6fb5643910
commit a0be7dee44

@ -51,6 +51,18 @@ export const widgetMoreBarLine = {
placeholder: '', placeholder: '',
value: 5, value: 5,
}, },
{
type: 'el-select',
label: '堆叠样式',
name: 'stackStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'leftRight', name: '左右堆叠' },
{ code: 'upDown', name: '上下堆叠' },
],
value: 'leftRight'
},
], ],
}, },
{ {

@ -424,6 +424,15 @@ export default {
this.options.legend["data"] = arr; this.options.legend["data"] = arr;
} }
}, },
//
getStackStyle() {
const optionsSetup = this.optionsSetup;
let style = "";
if (optionsSetup.stackStyle == "upDown") {
style = "total";
}
return style;
},
// //
setOptionsData(e, paramsConfig) { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
@ -478,6 +487,7 @@ export default {
if (series[i].type == "bar") { if (series[i].type == "bar") {
series[i].name = legendName[i]; series[i].name = legendName[i];
series[i].type = "bar"; series[i].type = "bar";
series[i].stack = this.getStackStyle();
series[i].label = { series[i].label = {
show: optionsSetup.isShowBar, show: optionsSetup.isShowBar,
position: "top", position: "top",
@ -565,6 +575,7 @@ export default {
if (val.series[i].type == "bar") { if (val.series[i].type == "bar") {
obj.name = val.series[i].name; obj.name = val.series[i].name;
obj.type = val.series[i].type; obj.type = val.series[i].type;
obj.stack = this.getStackStyle();
obj.label = { obj.label = {
show: optionsSetup.isShowBar, show: optionsSetup.isShowBar,
position: "top", position: "top",

Loading…
Cancel
Save