|
@@ -26,7 +26,7 @@
|
|
|
border
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column prop="name" label="部件"> </el-table-column>
|
|
|
+ <el-table-column prop="name" label="部件" />
|
|
|
<el-table-column
|
|
|
prop="amount1"
|
|
|
sortable
|
|
@@ -103,312 +103,20 @@ export default {
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
- var myChart = echarts.init(document.getElementById("box"));
|
|
|
- const series = [
|
|
|
- {
|
|
|
- name: "散点数据",
|
|
|
- type: "effectScatter",
|
|
|
- showEffectOn: "emphasis",
|
|
|
- data: [
|
|
|
- [174.0, 65.6],
|
|
|
- [175.3, 71.8],
|
|
|
- [193.5, 80.7],
|
|
|
- [186.5, 72.6],
|
|
|
- [187.2, 78.8],
|
|
|
- [181.5, 74.8],
|
|
|
- [184.0, 86.4],
|
|
|
- [184.5, 78.4],
|
|
|
- [175.0, 62.0],
|
|
|
- [184.0, 81.6],
|
|
|
- [180.0, 76.6],
|
|
|
- [177.8, 83.6],
|
|
|
- [192.0, 90.0],
|
|
|
- [176.0, 74.6],
|
|
|
- [174.0, 71.0],
|
|
|
- [184.0, 79.6],
|
|
|
- [192.7, 93.8],
|
|
|
- [171.5, 70.0],
|
|
|
- [173.0, 72.4],
|
|
|
- [176.0, 85.9],
|
|
|
- [176.0, 78.8],
|
|
|
- [180.5, 77.8],
|
|
|
- ],
|
|
|
- xAxisIndex: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "折线数据",
|
|
|
- type: "line",
|
|
|
- smooth: true, //这个是把线变成曲线
|
|
|
- data: [
|
|
|
- 10, 20, 30, 40, 30, 20, 50, 80, 50, 80, 50, 80, 60, 40, 20, 40, 60,
|
|
|
- 80, 60, 40, 20,
|
|
|
- ],
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- color: "#05bb4c",
|
|
|
- lineStyle: {
|
|
|
- color: "#05bb4c",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- xAxisIndex: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "散点图内折线图数据",
|
|
|
- type: "line",
|
|
|
- smooth: true, //这个是把线变成曲线
|
|
|
- data: [
|
|
|
- 0, 10, 20, 30, 40, 50, 60, 70, 80, 80, 80, 80, 90, 90, 90, 95, 95,
|
|
|
- 100, 100, 100, 100,
|
|
|
- ],
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- color: "#f8de5b",
|
|
|
- lineStyle: {
|
|
|
- color: "#f8de5b",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- xAxisIndex: 0,
|
|
|
- },
|
|
|
- ];
|
|
|
- //指定图表的配置项和数据
|
|
|
- var option = {
|
|
|
- //标题
|
|
|
- title: {
|
|
|
- text: "生鲜销量统计",
|
|
|
- textStyle: {
|
|
|
- fontSize: util.vh(16),
|
|
|
- color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- },
|
|
|
- backgroundColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? "rgba(0,0,0,0.4)"
|
|
|
- : "rgba(255,255,255,0.5)",
|
|
|
- //工具箱
|
|
|
- toolbox: {
|
|
|
- show: true,
|
|
|
- x: "right",
|
|
|
- position: [10, 10],
|
|
|
- backgroundColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? "rgba(0,0,0,0.4)"
|
|
|
- : "rgba(255,255,255,0.5)",
|
|
|
- borderColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? partten.getColor("gray")
|
|
|
- : "#000",
|
|
|
- textStyle: {
|
|
|
- fontSize: util.vh(16),
|
|
|
- color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- iconStyle: {
|
|
|
- borderColor: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
- iconStyle: {
|
|
|
- borderColor:
|
|
|
- this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- },
|
|
|
- // feature: {
|
|
|
- // dataZoom: {
|
|
|
- // yAxisIndex: "none",
|
|
|
- // },
|
|
|
- // dataView: { readOnly: false },
|
|
|
- // magicType: { type: ["line", "bar"] },
|
|
|
- // restore: {},
|
|
|
- // saveAsImage: {},
|
|
|
- // },
|
|
|
+ const that = this;
|
|
|
+ that.API.requestData({
|
|
|
+ method: "POST",
|
|
|
+ baseURL: "http://192.168.1.18:9002/",
|
|
|
+ subUrl: "scatter/list",
|
|
|
+ data: {
|
|
|
+ station: "NSS_FDC",
|
|
|
+ wtId: "NG01_01",
|
|
|
+ time: "2022-02",
|
|
|
},
|
|
|
- tooltip: {
|
|
|
- trigger: "item",
|
|
|
- axisPointer: {
|
|
|
- type: "cross",
|
|
|
- },
|
|
|
- backgroundColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? "rgba(0,0,0,0.4)"
|
|
|
- : "rgba(255,255,255,0.5)",
|
|
|
- borderColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? partten.getColor("gray")
|
|
|
- : "#000",
|
|
|
- textStyle: {
|
|
|
- fontSize: util.vh(16),
|
|
|
- color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- formatter(params) {
|
|
|
- return params.seriesName + "<br>" + params.name + ":" + params.data;
|
|
|
- },
|
|
|
- },
|
|
|
- brush: {
|
|
|
- xAxisIndex: "all",
|
|
|
- yAxisIndex: "all",
|
|
|
- transformable: true,
|
|
|
- throttleType: "debounce",
|
|
|
- throttleDelay: 600,
|
|
|
- removeOnClick: false,
|
|
|
- brushType: "polygon",
|
|
|
- brushMode: "multiple",
|
|
|
- brushStyle: {
|
|
|
- borderWidth: 1,
|
|
|
- color: "rgba(255,36,36,0.2)",
|
|
|
- borderColor: "#ff2424",
|
|
|
- },
|
|
|
- // outOfBrush: {
|
|
|
- // colorAlpha: 0.5,
|
|
|
- // },
|
|
|
- },
|
|
|
- dataZoom: [
|
|
|
- {
|
|
|
- type: "inside", //图表下方的伸缩条
|
|
|
- show: true, //是否显示
|
|
|
- realtime: true, //拖动时,是否实时更新系列的视图
|
|
|
- start: 0, //伸缩条开始位置(1-100),可以随时更改
|
|
|
- end: 100, //伸缩条结束位置(1-100),可以随时更改
|
|
|
- },
|
|
|
- {
|
|
|
- type: "slider", //图表下方的伸缩条
|
|
|
- show: true, //是否显示
|
|
|
- realtime: true, //拖动时,是否实时更新系列的视图
|
|
|
- start: 0, //伸缩条开始位置(1-100),可以随时更改
|
|
|
- end: 100, //伸缩条结束位置(1-100),可以随时更改
|
|
|
- },
|
|
|
- ],
|
|
|
- textStyle: {
|
|
|
- fontSize: util.vh(16),
|
|
|
- color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
- },
|
|
|
- //图例-每一条数据的名字叫销量
|
|
|
- legend: {
|
|
|
- show: true,
|
|
|
- data: ["销量"],
|
|
|
- inactiveColor:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? partten.getColor("gray")
|
|
|
- : "#000",
|
|
|
- textStyle: {
|
|
|
- color:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? partten.getColor("grayl")
|
|
|
- : "#000",
|
|
|
- fontSize: 12,
|
|
|
- },
|
|
|
- },
|
|
|
- grid: {
|
|
|
- top: 32,
|
|
|
- left: 40,
|
|
|
- right: 40,
|
|
|
- bottom: 24,
|
|
|
- },
|
|
|
- //x轴
|
|
|
- xAxis: [
|
|
|
- {
|
|
|
- data: [
|
|
|
- "t1",
|
|
|
- "t2",
|
|
|
- "t3",
|
|
|
- "t4",
|
|
|
- "t5",
|
|
|
- "t6",
|
|
|
- "t7",
|
|
|
- "t8",
|
|
|
- "t9",
|
|
|
- "t10",
|
|
|
- "t11",
|
|
|
- "t12",
|
|
|
- "t13",
|
|
|
- "t14",
|
|
|
- "t15",
|
|
|
- "t16",
|
|
|
- "t17",
|
|
|
- "t18",
|
|
|
- "t19",
|
|
|
- "t20",
|
|
|
- "t21",
|
|
|
- "t22",
|
|
|
- ],
|
|
|
- axisLabel: {
|
|
|
- formatter: "{value}",
|
|
|
- fontSize: util.vh(14),
|
|
|
- },
|
|
|
- textStyle: {
|
|
|
- color:
|
|
|
- this.$store.state.themeName === "dark"
|
|
|
- ? partten.getColor("gray")
|
|
|
- : "#000",
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- show: false,
|
|
|
- type: "category",
|
|
|
- max: 150,
|
|
|
- },
|
|
|
- ],
|
|
|
- //y轴没有显式设置,根据值自动生成y轴
|
|
|
- yAxis: {
|
|
|
- splitLine: { show: false },
|
|
|
- },
|
|
|
- //数据-data是最终要显示的数据
|
|
|
- series,
|
|
|
- };
|
|
|
-
|
|
|
- myChart.on("brushSelected", (params) => {
|
|
|
- const selected = params.batch[0]?.selected;
|
|
|
- let selectRes = [];
|
|
|
- selected?.forEach((pEle) => {
|
|
|
- if (pEle.dataIndex.length) {
|
|
|
- let item = {
|
|
|
- name: pEle.seriesName,
|
|
|
- data: [],
|
|
|
- };
|
|
|
- pEle.dataIndex.forEach((cEle) => {
|
|
|
- item.data.push(
|
|
|
- Array.isArray(series[pEle.seriesIndex].data[cEle])
|
|
|
- ? series[pEle.seriesIndex].data[cEle][
|
|
|
- series[pEle.seriesIndex].data[cEle].length - 1
|
|
|
- ]
|
|
|
- : series[pEle.seriesIndex].data[cEle]
|
|
|
- );
|
|
|
- });
|
|
|
- selectRes.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- let altMsg = "选中了";
|
|
|
- if (selectRes.length) {
|
|
|
- selectRes.forEach((ele) => {
|
|
|
- altMsg +=
|
|
|
- ele.data.length +
|
|
|
- "条" +
|
|
|
- ele.name +
|
|
|
- ":[" +
|
|
|
- ele.data.toString() +
|
|
|
- "].";
|
|
|
- });
|
|
|
- this.BASE.showMsg({
|
|
|
- type: "success",
|
|
|
- msg: altMsg,
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //使用刚刚指定的配置项和数据项显示图表
|
|
|
- myChart.setOption(option);
|
|
|
-
|
|
|
- myChart.dispatchAction({
|
|
|
- type: "takeGlobalCursor",
|
|
|
- // 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
|
|
|
- key: "brush",
|
|
|
- brushOption: {
|
|
|
- // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
|
|
|
- brushType: "polygon",
|
|
|
- // 参见 brush 组件的 brushMode。如果不设置,则取 brush 组件的 brushMode 设置。
|
|
|
- brushMode: "multiple",
|
|
|
+ success(res) {
|
|
|
+ that.initChart(res);
|
|
|
},
|
|
|
});
|
|
|
-
|
|
|
return;
|
|
|
let thArray = [
|
|
|
[
|
|
@@ -450,6 +158,346 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ initChart(res) {
|
|
|
+ let myChart = echarts.init(document.getElementById("box"));
|
|
|
+
|
|
|
+ let sjgl = [];
|
|
|
+ let zygl = [];
|
|
|
+ let xAxisData = [];
|
|
|
+
|
|
|
+ res.data.lineactual.forEach((ele, index) => {
|
|
|
+ sjgl.push(ele[1]);
|
|
|
+ xAxisData.push(index);
|
|
|
+ });
|
|
|
+
|
|
|
+ res.data.lineoptimal.forEach((ele) => {
|
|
|
+ zygl.push(ele[1]);
|
|
|
+ });
|
|
|
+
|
|
|
+ const series = [
|
|
|
+ {
|
|
|
+ name: "风速功率",
|
|
|
+ type: "effectScatter",
|
|
|
+ showEffectOn: "emphasis",
|
|
|
+ symbolSize: 5,
|
|
|
+ data: res.data.scatter || [
|
|
|
+ [174.0, 65.6],
|
|
|
+ [175.3, 71.8],
|
|
|
+ [193.5, 80.7],
|
|
|
+ [186.5, 72.6],
|
|
|
+ [187.2, 78.8],
|
|
|
+ [181.5, 74.8],
|
|
|
+ [184.0, 86.4],
|
|
|
+ [184.5, 78.4],
|
|
|
+ [175.0, 62.0],
|
|
|
+ [184.0, 81.6],
|
|
|
+ [180.0, 76.6],
|
|
|
+ [177.8, 83.6],
|
|
|
+ [192.0, 90.0],
|
|
|
+ [176.0, 74.6],
|
|
|
+ [174.0, 71.0],
|
|
|
+ [184.0, 79.6],
|
|
|
+ [192.7, 93.8],
|
|
|
+ [171.5, 70.0],
|
|
|
+ [173.0, 72.4],
|
|
|
+ [176.0, 85.9],
|
|
|
+ [176.0, 78.8],
|
|
|
+ [180.5, 77.8],
|
|
|
+ ],
|
|
|
+ xAxisIndex: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "实际功率",
|
|
|
+ type: "line",
|
|
|
+ smooth: true, //这个是把线变成曲线
|
|
|
+ data: sjgl || [
|
|
|
+ 10, 20, 30, 40, 30, 20, 50, 80, 50, 80, 50, 80, 60, 40, 20, 40, 60,
|
|
|
+ 80, 60, 40, 20,
|
|
|
+ ],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: "#05bb4c",
|
|
|
+ lineStyle: {
|
|
|
+ color: "#05bb4c",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ xAxisIndex: 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "最优功率",
|
|
|
+ type: "line",
|
|
|
+ smooth: true, //这个是把线变成曲线
|
|
|
+ data: zygl || [
|
|
|
+ 0, 10, 20, 30, 40, 50, 60, 70, 80, 80, 80, 80, 90, 90, 90, 95, 95,
|
|
|
+ 100, 100, 100, 100,
|
|
|
+ ],
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: "#f8de5b",
|
|
|
+ lineStyle: {
|
|
|
+ color: "#f8de5b",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ xAxisIndex: 0,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ //指定图表的配置项和数据
|
|
|
+ var option = {
|
|
|
+ //标题
|
|
|
+ title: {
|
|
|
+ text: "折线散点图",
|
|
|
+ textStyle: {
|
|
|
+ fontSize: util.vh(16),
|
|
|
+ color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ backgroundColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? "rgba(0,0,0,0.4)"
|
|
|
+ : "rgba(255,255,255,0.5)",
|
|
|
+ //工具箱
|
|
|
+ toolbox: {
|
|
|
+ show: true,
|
|
|
+ x: "right",
|
|
|
+ position: [10, 10],
|
|
|
+ backgroundColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? "rgba(0,0,0,0.4)"
|
|
|
+ : "rgba(255,255,255,0.5)",
|
|
|
+ borderColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? partten.getColor("gray")
|
|
|
+ : "#000",
|
|
|
+ textStyle: {
|
|
|
+ fontSize: util.vh(16),
|
|
|
+ color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ iconStyle: {
|
|
|
+ borderColor:
|
|
|
+ this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ iconStyle: {
|
|
|
+ borderColor:
|
|
|
+ this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // feature: {
|
|
|
+ // dataZoom: {
|
|
|
+ // yAxisIndex: "none",
|
|
|
+ // },
|
|
|
+ // dataView: { readOnly: false },
|
|
|
+ // magicType: { type: ["line", "bar"] },
|
|
|
+ // restore: {},
|
|
|
+ // saveAsImage: {},
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: "item",
|
|
|
+ axisPointer: {
|
|
|
+ type: "cross",
|
|
|
+ },
|
|
|
+ backgroundColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? "rgba(0,0,0,0.4)"
|
|
|
+ : "rgba(255,255,255,0.5)",
|
|
|
+ borderColor:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? partten.getColor("gray")
|
|
|
+ : "#000",
|
|
|
+ textStyle: {
|
|
|
+ fontSize: util.vh(16),
|
|
|
+ color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ formatter(params) {
|
|
|
+ return params.name
|
|
|
+ ? `${params.seriesName}<br />风速:${params.name}米/s<br />功率:${params.value}KW`
|
|
|
+ : `${params.seriesName}<br />风速:${params.data[0]}米/s<br />功率:${params.data[1]}KW`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ brush: {
|
|
|
+ xAxisIndex: "all",
|
|
|
+ yAxisIndex: "all",
|
|
|
+ transformable: true,
|
|
|
+ throttleType: "debounce",
|
|
|
+ throttleDelay: 600,
|
|
|
+ removeOnClick: false,
|
|
|
+ brushType: "polygon",
|
|
|
+ brushMode: "multiple",
|
|
|
+ brushStyle: {
|
|
|
+ borderWidth: 1,
|
|
|
+ color: "rgba(255,36,36,0.2)",
|
|
|
+ borderColor: "#ff2424",
|
|
|
+ },
|
|
|
+ // outOfBrush: {
|
|
|
+ // colorAlpha: 0.5,
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ {
|
|
|
+ type: "inside", //图表下方的伸缩条
|
|
|
+ show: true, //是否显示
|
|
|
+ realtime: true, //拖动时,是否实时更新系列的视图
|
|
|
+ start: 0, //伸缩条开始位置(1-100),可以随时更改
|
|
|
+ end: 100, //伸缩条结束位置(1-100),可以随时更改
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slider", //图表下方的伸缩条
|
|
|
+ show: true, //是否显示
|
|
|
+ realtime: true, //拖动时,是否实时更新系列的视图
|
|
|
+ start: 0, //伸缩条开始位置(1-100),可以随时更改
|
|
|
+ end: 100, //伸缩条结束位置(1-100),可以随时更改
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: util.vh(16),
|
|
|
+ color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
|
|
|
+ },
|
|
|
+ //图例-每一条数据的名字叫销量
|
|
|
+ legend: {
|
|
|
+ show: true,
|
|
|
+ data: ["风速功率", "实际功率", "最优功率"],
|
|
|
+ right: "120",
|
|
|
+ top:"5",
|
|
|
+ icon: "circle",
|
|
|
+ itemWidth: 6,
|
|
|
+ inactiveColor: this.$store.state.themeName === "dark" ? partten.getColor("gray") : "#000",
|
|
|
+ textStyle: {
|
|
|
+ color: this.$store.state.themeName === "dark" ? partten.getColor("grayl") : "#000",
|
|
|
+ fontSize: 12,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ top: 32,
|
|
|
+ left: 40,
|
|
|
+ right: 40,
|
|
|
+ bottom: 24,
|
|
|
+ },
|
|
|
+ //x轴
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: "category",
|
|
|
+ boundaryGap: false,
|
|
|
+ data: xAxisData || [
|
|
|
+ "0",
|
|
|
+ "1",
|
|
|
+ "2",
|
|
|
+ "3",
|
|
|
+ "4",
|
|
|
+ "5",
|
|
|
+ "6",
|
|
|
+ "7",
|
|
|
+ "8",
|
|
|
+ "9",
|
|
|
+ "10",
|
|
|
+ "11",
|
|
|
+ "12",
|
|
|
+ "13",
|
|
|
+ "14",
|
|
|
+ "15",
|
|
|
+ "16",
|
|
|
+ "17",
|
|
|
+ "18",
|
|
|
+ "19",
|
|
|
+ "20",
|
|
|
+ "21",
|
|
|
+ "22",
|
|
|
+ "23",
|
|
|
+ "24",
|
|
|
+ "25",
|
|
|
+ ],
|
|
|
+ min: 0,
|
|
|
+ axisLabel: {
|
|
|
+ formatter: "{value}",
|
|
|
+ fontSize: util.vh(14),
|
|
|
+ },
|
|
|
+ textStyle: {
|
|
|
+ color:
|
|
|
+ this.$store.state.themeName === "dark"
|
|
|
+ ? partten.getColor("gray")
|
|
|
+ : "#000",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // name: this.xTitle,
|
|
|
+ show: false,
|
|
|
+ type: "value",
|
|
|
+ boundaryGap: false,
|
|
|
+ min: xAxisData[0],
|
|
|
+ max: xAxisData[xAxisData.length - 1],
|
|
|
+ scale: true,
|
|
|
+ axisLabel: {
|
|
|
+ formatter: "{value}",
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ //y轴没有显式设置,根据值自动生成y轴
|
|
|
+ yAxis: {
|
|
|
+ splitLine: { show: false },
|
|
|
+ },
|
|
|
+ //数据-data是最终要显示的数据
|
|
|
+ series,
|
|
|
+ };
|
|
|
+
|
|
|
+ myChart.on("brushSelected", (params) => {
|
|
|
+ const selected = params.batch[0]?.selected;
|
|
|
+ let selectRes = [];
|
|
|
+ selected?.forEach((pEle) => {
|
|
|
+ if (pEle.dataIndex.length) {
|
|
|
+ let item = {
|
|
|
+ name: pEle.seriesName,
|
|
|
+ data: [],
|
|
|
+ };
|
|
|
+ pEle.dataIndex.forEach((cEle) => {
|
|
|
+ item.data.push(
|
|
|
+ Array.isArray(series[pEle.seriesIndex].data[cEle])
|
|
|
+ ? series[pEle.seriesIndex].data[cEle][
|
|
|
+ series[pEle.seriesIndex].data[cEle].length - 1
|
|
|
+ ]
|
|
|
+ : series[pEle.seriesIndex].data[cEle]
|
|
|
+ );
|
|
|
+ });
|
|
|
+ selectRes.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let altMsg = "选中了";
|
|
|
+ if (selectRes.length) {
|
|
|
+ selectRes.forEach((ele) => {
|
|
|
+ altMsg +=
|
|
|
+ ele.data.length +
|
|
|
+ "条" +
|
|
|
+ ele.name +
|
|
|
+ ":[" +
|
|
|
+ ele.data.toString() +
|
|
|
+ "].";
|
|
|
+ });
|
|
|
+ this.BASE.showMsg({
|
|
|
+ type: "success",
|
|
|
+ msg: altMsg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //使用刚刚指定的配置项和数据项显示图表
|
|
|
+ myChart.setOption(option);
|
|
|
+
|
|
|
+ myChart.dispatchAction({
|
|
|
+ type: "takeGlobalCursor",
|
|
|
+ // 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
|
|
|
+ key: "brush",
|
|
|
+ brushOption: {
|
|
|
+ // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
|
|
|
+ brushType: "polygon",
|
|
|
+ // 参见 brush 组件的 brushMode。如果不设置,则取 brush 组件的 brushMode 设置。
|
|
|
+ brushMode: "multiple",
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
showDialog() {
|
|
|
this.show = true;
|
|
|
},
|