@huyuchen/visual
Version:
## 组件环境
125 lines (124 loc) • 2.46 kB
JavaScript
import c from "../BaseChart/index.vue.js";
import a from "../BaseChart/config.js";
import { computed as p, resolveComponent as l, openBlock as f, createBlock as u } from "vue";
import d from "lodash.merge";
import m from "../_virtual/_plugin-vue_export-helper.js";
const y = {
name: "HuShapeChart",
components: {
BaseChart: c
},
props: {
data: {
type: [Object, Array],
default: () => ({})
},
tooltip: {
type: Object,
default: () => ({ formatter: "{b}: {c}" })
},
/**
* [{name:'', data: [], ...}]
*/
series: {
type: Array,
default: () => []
},
/**
* 图例配置
*/
legendOption: {
type: Object,
default: () => ({
right: "auto",
top: "auto",
orient: "horizontal"
})
},
/**
* 横坐标
*/
xAxis: {
type: Array,
default: () => a.xAxisTime
},
xAxisOther: {
// x轴的其它配置
type: Object,
default: () => ({})
},
/**
* colors 自定义颜色
*/
colors: {
type: Array,
default: () => []
}
},
setup(t) {
const s = p(() => {
const o = t.series.map((n, h) => ({ ...i(), ...n }));
return {
xAxis: d(
{
type: "category",
data: t.xAxis
},
t.xAxisOther
),
color: r(t.colors.concat(a.colors)),
legend: a.legend(t.legendOption),
grid: {
left: "3%",
right: "4%",
bottom: "4%",
top: "12%",
containLabel: !0
},
tooltip: t.tooltip,
yAxis: {
type: "value",
splitLine: {
show: !1
}
},
series: o
};
}), i = () => ({
type: "bar"
}), r = (o) => o.map((e) => ({
type: "linear",
x: 1,
x2: 0,
y: 0,
y2: 0,
colorStops: [
{
offset: 0,
color: e + "80"
},
{
offset: 0.5,
color: e + "80"
},
{
offset: 0.5,
color: e
},
{
offset: 1,
color: e
}
]
}));
return { option: s };
}
};
function x(t, s, i, r, o, e) {
const n = l("base-chart");
return f(), u(n, { option: r.option }, null, 8, ["option"]);
}
const j = /* @__PURE__ */ m(y, [["render", x]]);
export {
j as default
};