@dfsj/echarts
Version:
专业的水文曲线组件或构造函数以及通用的echart二次封装图表
182 lines (178 loc) • 7.94 kB
JavaScript
/**
*
* @dfsj/echarts: 专业的水文曲线组件或构造函数以及通用的echart二次封装图表
* 版本: v3.7.0-alpha.5
* 作者:yangbo <1747837358@qq.com>
* 日期:2025-11-21 13:30:34
*
*
*/
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import assign from './utils/assign.js';
var config = {
color: ['#2fc25b', '#3aa1ff', '#13c2c2', '#d64700', '#8543e0', '#ff5879', '#047878', "#570026", '#8db500', '#00293e', '#f1baf3', '#ff006d'],
areaColor: {
history: "rgba(222,222,222,0.35)",
"short": "rgba(031,138,112,0.35)",
"long": "rgba(255,225,026,0.35)",
trend: "rgba(240,150,020,0.35)",
forecast: "rgba(240,150,020,0.35)"
},
indexColor: {
1: "#dc2828",
2: "#f09614",
3: "#fae600",
4: "#3764ff"
},
markColor: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
safe: "#4cc053"
}, -2, "#111"), -1, "#666"), 0, "#14af06"), 1, "#0984ff"), 2, "#fae600"), 3, "#f09614"), 4, "#dc2828"), 5, "#8d04d7"),
rainfallColor: ["#0984ff", "#37c9ff", "#7bcbff", "#54b2ff"],
icon: {
stage: "M9,18.12.26,1.42A1,1,0,0,1,1.15,0H18.64a1,1,0,0,1,.89,1.42l-8.75,16.7A1,1,0,0,1,9,18.12Zm187,.82a.49.49,0,0,0-.5-.49H.5a.49.49,0,1,0,0,1h195A.49.49,0,0,0,196,18.94ZM17.31,22.46a.49.49,0,0,0-.5-.49H3a.49.49,0,1,0,0,1H16.81A.49.49,0,0,0,17.31,22.46ZM14.78,26a.49.49,0,0,0-.5-.49H5.51a.49.49,0,1,0,0,1h8.77A.49.49,0,0,0,14.78,26Zm-2.19,3.52a.5.5,0,0,0-.5-.49H7.7a.49.49,0,1,0,0,1h4.39A.5.5,0,0,0,12.59,29.51Z",
stageMirror: "M185.22,18.12l-8.75-16.7A1,1,0,0,1,177.36,0h17.49a1,1,0,0,1,.89,1.42L187,18.12A1,1,0,0,1,185.22,18.12ZM.5,19.43h195a.49.49,0,1,0,0-1H.5a.49.49,0,1,0,0,1ZM179.19,23H193a.49.49,0,0,0,0-1H179.19a.49.49,0,1,0,0,1Zm2.53,3.53h8.77a.49.49,0,1,0,0-1h-8.77a.49.49,0,1,0,0,1ZM183.91,30h4.39a.49.49,0,1,0,0-1h-4.39a.49.49,0,1,0,0,1Z",
altitude: "M195.5,18H10.85l8.5-16.55A1,1,0,0,0,18.46,0H1A1,1,0,0,0,.11,1.45l8.73,17a1,1,0,0,0,1,.53H195.5a.5.5,0,0,0,.5-.5A.5.5,0,0,0,195.5,18Z",
altitudeMirror: "M.5,18H185.15l-8.5-16.55A1,1,0,0,1,177.54,0H195a1,1,0,0,1,.89,1.45l-8.73,17a1,1,0,0,1-1,.53H.5a.5.5,0,0,1-.5-.5A.5.5,0,0,1,.5,18Z",
zoom: "M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",
save: "M968.96 268.373333a42.666667 42.666667 0 0 0-60.586667 0L853.333333 323.84V85.333333a42.666667 42.666667 0 0 0-85.333333 0v238.506667l-55.04-55.466667a42.666667 42.666667 0 0 0-60.586667 60.586667l128 128a42.666667 42.666667 0 0 0 14.08 8.96 40.106667 40.106667 0 0 0 32.426667 0 42.666667 42.666667 0 0 0 14.08-8.96l128-128a42.666667 42.666667 0 0 0 0-60.586667zM810.666667 554.666667a42.666667 42.666667 0 0 0-42.666667 42.666666v16.213334l-63.146667-63.146667a119.04 119.04 0 0 0-167.68 0l-29.866666 29.866667-105.813334-105.813334a121.6 121.6 0 0 0-167.68 0L170.666667 537.6V298.666667a42.666667 42.666667 0 0 1 42.666666-42.666667h341.333334a42.666667 42.666667 0 0 0 0-85.333333H213.333333a128 128 0 0 0-128 128v512a128 128 0 0 0 128 128h512a128 128 0 0 0 128-128v-213.333334a42.666667 42.666667 0 0 0-42.666666-42.666666zM213.333333 853.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-152.32l123.733333-123.733334a33.706667 33.706667 0 0 1 46.506667 0l135.253333 135.253334 183.466667 183.466666z m554.666667-42.666666a37.973333 37.973333 0 0 1-7.68 22.613333L567.893333 640l29.866667-29.866667a32.853333 32.853333 0 0 1 46.933333 0L768 734.293333z",
statistics: "m22,0c-12.15,0-22,9.85-22,22s9.85,22 22,22 22-9.85 22-22-9.85-22-22-22zm10.975,38.71l-10.118-17.231-.017,.011c-0.176-0.288-0.479-0.49-0.84-0.49-0.552,0-1,0.447-1,1 0,0.175 0.057,0.33 0.135,0.473l-.01,.006 10.125,17.244c-2.768,1.447-5.91,2.277-9.25,2.277-11.046,0-20-8.954-20-20s8.954-20 20-20c11.045,0 20,8.954 20,20 0,6.99-3.592,13.135-9.025,16.71z M36.142,6.529L23,19.56V1h-2v21c0,0.553,0.448,1,1,1c0.328,0,0.606-0.169,0.788-0.413L37.556,7.943L36.142,6.529z",
tabulation: "M15,14 L15,10 L9,10 L9,14 L15,14 Z M15,15 L9,15 L9,19 L15,19 L15,15 Z M4,14 L8,14 L8,10 L4,10 L4,14 Z M4,15 L4,17.5 C4,18.3284271 4.67157288,19 5.5,19 L8,19 L8,15 L4,15 Z M20,14 L20,10 L16,10 L16,14 L20,14 Z M20,15 L16,15 L16,19 L18.5,19 C19.3284271,19 20,18.3284271 20,17.5 L20,15 Z M15,9 L15,5 L9,5 L9,9 L15,9 Z M4,9 L8,9 L8,5 L5.5,5 C4.67157288,5 4,5.67157288 4,6.5 L4,9 Z M20,9 L20,6.5 C20,5.67157288 19.3284271,5 18.5,5 L16,5 L16,9 L20,9 Z M5.5,4 L18.5,4 C19.8807119,4 21,5.11928813 21,6.5 L21,17.5 C21,18.8807119 19.8807119,20 18.5,20 L5.5,20 C4.11928813,20 3,18.8807119 3,17.5 L3,6.5 C3,5.11928813 4.11928813,4 5.5,4 Z",
exception: "M176 432c0 44.112-35.888 80-80 80s-80-35.888-80-80s35.888-80 80-80s80 35.888 80 80M25.26 25.199l13.6 272C39.499 309.972 50.041 320 62.83 320h66.34c12.789 0 23.331-10.028 23.97-22.801l13.6-272C167.425 11.49 156.496 0 142.77 0H49.23C35.504 0 24.575 11.49 25.26 25.199"
},
resizeDelay: 100,
mark: {
series: {
z: 0,
name: "标注",
type: "mark",
color: "#333"
},
shape: {
symbol: {
label: {
fill: "#fff",
borderWidth: 1,
borderRadius: 20,
padding: [2, 4, 0, 4],
fontSize: 12
}
},
index: {
lineStyle: {
lineDash: [6, 6, 6],
lineWidth: 1,
opacity: 0.9
}
},
rect: {},
line: {
itemStyle: {
stroke: "red",
lineWidth: 1,
lineDash: [6]
}
},
text: {
label: {
fill: "red",
align: "center",
fontSize: 12
}
}
},
side: [{
symbol: "M195.5,18H10.85l8.5-16.55A1,1,0,0,0,18.46,0H1A1,1,0,0,0,.11,1.45l8.73,17a1,1,0,0,0,1,.53H195.5a.5.5,0,0,0,.5-.5A.5.5,0,0,0,195.5,18Z",
itemStyle: {
scale: [0.8, 0.8],
offset: [-7, -14]
},
label: {
offset: [12, -15],
align: "left"
}
}, {
symbol: "M.5,18H185.15l-8.5-16.55A1,1,0,0,1,177.54,0H195a1,1,0,0,1,.89,1.45l-8.73,17a1,1,0,0,1-1,.53H.5a.5.5,0,0,1-.5-.5A.5.5,0,0,1,.5,18Z",
itemStyle: {
scale: [0.8, 0.8],
offset: [-68, -14.5]
},
label: {
offset: [69, -15],
align: "right"
}
}]
},
tooltip: function tooltip(items) {
var content = items.map(function (e) {
return "<li>".concat(e.marker, "<i>").concat(e.seriesName, "</i><i>").concat(e.value[e.encode.y[0]] || "-", "</i></li>");
}).join("");
return "<article class=\"tooltip\"><fieldset><legend>".concat(items[0].axisValueLabel, "</legend>").concat(content, "</fieldset></article>");
}
};
var options = {
$export: {
file: undefined,
sheet: undefined,
prevent: false
},
color: config.color,
toolbox: {
show: false,
top: 5,
right: 0,
height: 30,
itemSize: 20,
feature: {
saveAsImage: {
title: "保存到图片"
}
}
},
tooltip: {
formatter: config.tooltip,
className: "tooltip-container"
},
dataset: {
sourceHeader: false,
source: []
},
axisPointer: {
shadowStyle: {
color: "#fff"
}
},
series: null
};
var axis = {
axisLine: {
show: true
},
axisLabel: {},
axisTick: {},
splitLine: {}
};
var CATEGORY = {
RAINFALL: 1 << 0,
STAGE: 1 << 1,
FLOW: 1 << 2,
CAPACITY: 1 << 3,
SWC: 1 << 4,
OTHER: 1 << 30,
TOP_LEFT: 1 << 0,
TOP_RIGHT: 1 << 1,
MIDDLE_LEFT: 1 << 2,
MIDDLE_RIGHT: 1 << 3,
BOTTOM_LEFT: 1 << 4,
BOTTOM_RIGHT: 1 << 5
};
var TYPE_SYMBOL = {
top: "altitude",
bottom: "altitude",
under: "stage",
current: "stage"
};
function setup(newConfig, newOptions) {
assign(config, newConfig);
assign(options, newOptions);
}
export { CATEGORY, TYPE_SYMBOL, axis, config as default, options, setup };