UNPKG

@huyuchen/visual

Version:

## 组件环境

147 lines (146 loc) 2.69 kB
const t = { colors: [ "#34EAEC", "#ffe922", "#3daeff", "#FF8200", "#f9314e", "#D032FF", "#6325DF", "#5752FA", "#1ECC9B", "#3DAEFF", "#7CFFFA", "#00F5A3" ], deviceColors: ["#34EAEC", "#ffe922", "#f9314e"], colors2: [ // '#62f0fc', // '#3191e3', // '#ffe922', // '#F0314E', "#13C565", "#1ECC9B", "#A2E430", "#D7ED52", "#FFE922", "#FFC600", "#FF8200", "#FF603F", "#FC3452", "#EB0087", "#FD1AD4", "#D032FF", "#7E15D1", "#6325DF", "#5752FA", "#1776FF", "#3DAEFF", "#53C2E6", "#7CFFFA", "#00F5A3" ], roads: ["黄河一号", "太行一号", "晋中环城"], xAxisTime: [ "00:00", "02:00", "04:00", "06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00", "22:00", "24:00" ], xAxisHour: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24"], /** * 图例 默认竖向 右侧居中 * @param {Object} opt * @returns */ legend(e = {}) { return { ...{ show: !0, type: "plain", right: "3%", top: "center", orient: "vertical", textStyle: { color: "#fff", fontSize: "12px" }, itemHeight: 10, icon: "circle" // formatter: '{name}:{value}', }, ...e }; }, /** * 环形图中间展示数据 * @param {String} value * @param {*参数} opt * @returns */ normal(e, o = {}) { return { ...{ // normal 是图形在默认状态下的样式 show: !0, position: "center", fontSize: 14, formatter: e, // ['{value|{d}}{unit|%}', '{name|{b}率}'].join('\n'), //' {d}% {b}率', // {b}:数据名; {c}:数据值; {d}:百分比,可以自定义显示内容, rich: { value: { color: "#6AFDFF", fontSize: 24, fontWeight: "bold", lineHeight: 24 }, unit: { color: "#6AFDFF", fontSize: 12, lineHeight: 12 }, name: { color: "#fff", fontSize: 14, lineHeight: 14 } } }, ...o }; }, // 柱状图的渐变色 colorsStep(e) { return { type: "linear", x: 0, x2: 0, y: 0, y2: 1, colorStops: [ { offset: 0, color: e }, { offset: 0.5, color: e }, { offset: 0.5, color: e + "80" }, { offset: 1, color: e + "80" } ] }; } }, f = t; export { f as default };