qianming 3 years ago
parent 508e3c86b5
commit f3d2ea765f

@ -1,6 +1,6 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart :options="options" autoresize/>
</div> </div>
</template> </template>
@ -103,86 +103,86 @@ export default {
}, },
// //
setOptionsTitle() { setOptionsTitle() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const title = {}; const title = {};
title.show = optionsCollapse.isNoTitle; title.show = optionsSetup.isNoTitle;
title.text = optionsCollapse.titleText; title.text = optionsSetup.titleText;
title.left = optionsCollapse.textAlign; title.left = optionsSetup.textAlign;
title.textStyle = { title.textStyle = {
color: optionsCollapse.textColor, color: optionsSetup.textColor,
fontSize: optionsCollapse.textFontSize, fontSize: optionsSetup.textFontSize,
fontWeight: optionsCollapse.textFontWeight fontWeight: optionsSetup.textFontWeight
}; };
title.subtext = optionsCollapse.subText; title.subtext = optionsSetup.subText;
title.subtextStyle = { title.subtextStyle = {
color: optionsCollapse.subTextColor, color: optionsSetup.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight, fontWeight: optionsSetup.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize fontSize: optionsSetup.subTextFontSize
}; };
this.options.title = title; this.options.title = title;
}, },
// //
setOptionsValue() { setOptionsValue() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
const numberValue = optionsCollapse.numberValue ? "{c}" : ""; const numberValue = optionsSetup.numberValue ? "{c}" : "";
const percentage = optionsCollapse.percentage ? "({d})%" : ""; const percentage = optionsSetup.percentage ? "({d})%" : "";
const label = { const label = {
show: optionsCollapse.isShow, show: optionsSetup.isShow,
formatter: `{a|{b}${numberValue} ${percentage}}`, formatter: `{a|{b}${numberValue} ${percentage}}`,
rich: { rich: {
a: { a: {
padding: [-30, 15, -20, 15], padding: [-30, 15, -20, 15],
color: optionsCollapse.subTextColor, color: optionsSetup.subTextColor,
fontSize: optionsCollapse.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsCollapse.fontWeight fontWeight: optionsSetup.fontWeight
} }
}, },
fontSize: optionsCollapse.fontSize, fontSize: optionsSetup.fontSize,
fontWeight: optionsCollapse.optionsCollapse fontWeight: optionsSetup.optionsSetup
}; };
for (const key in series) { for (const key in series) {
if (series[key].type == "pie") { if (series[key].type == "pie") {
series[key].label = label; series[key].label = label;
series[key].labelLine = { show: optionsCollapse.isShow }; series[key].labelLine = {show: optionsSetup.isShow};
} }
} }
}, },
// tooltip // tooltip
setOptionsTooltip() { setOptionsTooltip() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const tooltip = { const tooltip = {
trigger: "item", trigger: "item",
show: true, show: true,
textStyle: { textStyle: {
color: optionsCollapse.lineColor, color: optionsSetup.lineColor,
fontSize: optionsCollapse.fontSize fontSize: optionsSetup.fontSize
} }
}; };
this.options.tooltip = tooltip; this.options.tooltip = tooltip;
}, },
// legend // legend
setOptionsLegend() { setOptionsLegend() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const legend = this.options.legend; const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend; legend.show = optionsSetup.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto"; legend.left = optionsSetup.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto"; legend.right = optionsSetup.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto"; legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom = legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto"; optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront; legend.orient = optionsSetup.layoutFront;
legend.textStyle = { legend.textStyle = {
color: optionsCollapse.lengedColor, color: optionsSetup.lengedColor,
fontSize: optionsCollapse.fontSize fontSize: optionsSetup.fontSize
}; };
legend.itemWidth = optionsCollapse.lengedWidth; legend.itemWidth = optionsSetup.lengedWidth;
}, },
// //
setOptionsColor() { setOptionsColor() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const customColor = optionsCollapse.customColor; const customColor = optionsSetup.customColor;
if (!customColor) return; if (!customColor) return;
const arrColor = []; const arrColor = [];
for (let i = 0; i < customColor.length; i++) { for (let i = 0; i < customColor.length; i++) {

@ -23,7 +23,7 @@ import widgetBarchart from "./bar/widgetBarchart.vue";
import widgetLinechart from "./line/widgetLinechart.vue"; import widgetLinechart from "./line/widgetLinechart.vue";
import widgetBarlinechart from "./bar/widgetBarlinechart"; import widgetBarlinechart from "./bar/widgetBarlinechart";
import widgetGradientColorBarchart from "./bar/widgetGradientColorBarchart.vue"; import widgetGradientColorBarchart from "./bar/widgetGradientColorBarchart.vue";
import WidgetPiechart from "./widgetPiechart.vue"; import WidgetPiechart from "./pie/widgetPiechart.vue";
import WidgetFunnel from "./widgetFunnel.vue"; import WidgetFunnel from "./widgetFunnel.vue";
import WidgetGauge from "./widgetGauge.vue"; import WidgetGauge from "./widgetGauge.vue";
import WidgetPieNightingaleRoseArea from "./pie/widgetPieNightingaleRose"; import WidgetPieNightingaleRoseArea from "./pie/widgetPieNightingaleRose";

@ -34,7 +34,7 @@ import widgetBarchart from "./bar/widgetBarchart.vue";
import widgetGradientColorBarchart from "./bar/widgetGradientColorBarchart.vue"; import widgetGradientColorBarchart from "./bar/widgetGradientColorBarchart.vue";
import widgetLinechart from "./line/widgetLinechart.vue"; import widgetLinechart from "./line/widgetLinechart.vue";
import widgetBarlinechart from "./bar/widgetBarlinechart"; import widgetBarlinechart from "./bar/widgetBarlinechart";
import WidgetPiechart from "./widgetPiechart.vue"; import WidgetPiechart from "./pie/widgetPiechart.vue";
import WidgetFunnel from "./widgetFunnel.vue"; import WidgetFunnel from "./widgetFunnel.vue";
import WidgetGauge from "./widgetGauge.vue"; import WidgetGauge from "./widgetGauge.vue";
import WidgetPieNightingaleRoseArea from "./pie/widgetPieNightingaleRose"; import WidgetPieNightingaleRoseArea from "./pie/widgetPieNightingaleRose";

Loading…
Cancel
Save