From 9af2818990da6765c1f07e8a790fd218feb6cab1 Mon Sep 17 00:00:00 2001 From: rongweikang <1174906669@qq.com> Date: Thu, 28 Mar 2024 09:33:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iotCarePlan/components/Echart/index.tsx | 160 +++++++++++++++++- 1 file changed, 154 insertions(+), 6 deletions(-) diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx index 24a6c54..a068416 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx @@ -143,22 +143,170 @@ function Index({ series, full }: Props) { color: "#ff8410", }, }, - series: [], - }); + series: [] + }) + // let data = true + // const newParams = { + // animation: false, + // grid: { + // // 让图表占满容器 + // // containLabel: true, + // top: "32rpx", + // left: "48rpx", + // right: "86rpx", + // bottom: "38rpx", + // }, + // // legend: { + // // itemStyle: { + // // decal: { + // // rotation: 90 + // // } + // // } + // // }, + // yAxis: { + // // name: '', + // // nameGap: 5, + // // nameTextStyle: { + // // color: '#e4e4e4', + // // fontSize:7 + // // }, + // type: "category", + // inverse: true, + // axisLine: { + // //坐标轴轴线相关设置。数学上的x轴 + // show: true, + // lineStyle: { + // color: "#cccccc", + // }, + // }, + // axisLabel: { + // //坐标轴刻度标签的相关设置 + // color: "#cccccc", + // fontSize: 14, + // rotate: -90, + // margin: 18 + // }, + // axisTick: { + // show: false, + // }, + // data: [ + // "00:01", + // "00:02", + // "00:03", + // "00:04", + // "00:05", + // "00:06", + // "00:07", + // "00:08", + // "00:09", + // "00:10", + // ], + // }, + // xAxis: { + // type: "value", + // min: 0, + // max: 8, + // splitNumber: 8, + // splitLine: { + // show: true, + // lineStyle: { + // color: "#cccccc", + // type: [4, 2], + // dashOffset: 4, + // }, + // }, + // axisLine: { + // show: false, + // }, + // axisLabel: { + // show: false, + // }, + // axisTick: { + // show: false, + // }, + // }, + // visualMap: { + // z: 1, + // top: 0, + // right: 0, + // seriesIndex: 0, + // show: false, + // dimension: 0, + // pieces: [ + // { + // gt: 0, + // lte: 1, + // color: "#fff8c9", + // }, + // { + // gt: 1, + // lte: 2, + // color: "#fff0c6", + // }, + // { + // gt: 2, + // lte: 3, + // color: "#ffe5c3", + // }, + // { + // gt: 3, + // lte: 4, + // color: "#ffdbbf", + // }, + // { + // gt: 4, + // lte: 5, + // color: "#ffcfbb", + // }, + // { + // gt: 5, + // lte: 6, + // color: "#ffbab5", + // }, + // { + // gt: 6, + // lte: 7, + // color: "#ffb4b3", + // }, + // { + // gt: 7, + // lte: 8, + // color: "#ffb4b3", + // }, + // ], + // outOfRange: { + // color: "#ff8410", + // }, + // }, + // series: [] + // } const level = [8, 7, 6, 5, 4, 3, 2]; const [newOptions, setNewOptions] = useState(options); const updata = useCallback((res) => { - let option = JSON.parse(JSON.stringify(options)); - option.series = JSON.parse(JSON.stringify(res)); + // let option + // if (data) { + // option = JSON.parse(JSON.stringify(newParams)) + // } else { + // option = JSON.parse(JSON.stringify(options)) + // } + let option = JSON.parse(JSON.stringify(options)) + option.series = JSON.parse(JSON.stringify(res)) // 更新图表数据 setNewOptions(option); }, []); const cancelFull = useCallback((res) => { - full(); - }, []); + // let option = JSON.parse(JSON.stringify(newParams)) + // setNewOptions(option) + // console.log(data, 88888); + // data = !data + // console.log(data, 88888); + full() + }, []) + + useEffect(() => { setOptions(newOptions);