| | |
| | | |
| | | let preData = null; |
| | | |
| | | |
| | | let activeChartType: ChartTypeEnum = props.data?.chart_type ?? ChartTypeEnum.Line; |
| | | const originChartType = activeChartType; |
| | | |
| | | const getChartTypeSeriesOption = (type: ChartTypeEnum) => { |
| | | let result = {}; |
| | | switch (type) { |
| | |
| | | }); |
| | | } |
| | | const yAxisFormatter = |
| | | activeChartType === ChartTypeEnum.Score |
| | | originChartType === ChartTypeEnum.Score |
| | | ? (value) => { |
| | | return scoreMap[value]; |
| | | } |
| | | : axisLabelFormatter; |
| | | |
| | | const tooltipValueFormatter = |
| | | activeChartType === ChartTypeEnum.Score |
| | | originChartType === ChartTypeEnum.Score |
| | | ? (value) => { |
| | | return scoreMap[value]; |
| | | } |
| | |
| | | feature: { |
| | | myBar: { |
| | | onclick: () => { |
| | | activeChartType = props.data.chart_type === ChartTypeEnum.Score ? ChartTypeEnum.Score : ChartTypeEnum.Bar; |
| | | activeChartType = originChartType === ChartTypeEnum.Score ? ChartTypeEnum.Score : ChartTypeEnum.Bar; |
| | | chartInstance.value.setOption({ |
| | | series: series.map((item) => ({ |
| | | ...item, |
| | |
| | | name: valueCol?.title, |
| | | /** @description 不强制保留 */ |
| | | scale: true, |
| | | ...(activeChartType === ChartTypeEnum.Score ? scoreYAxisOption : {}), |
| | | ...(originChartType === ChartTypeEnum.Score ? scoreYAxisOption : {}), |
| | | }, |
| | | series: series, |
| | | } as echarts.EChartsOption, |
| | |
| | | ${item.marker}<span style="font-size: 14px; color: #666; font-weight: 400; margin-left: 2px" |
| | | >${item.seriesName}</span |
| | | ><span style="float: right; margin-left: 20px; font-size: 14px; color: #666; font-weight: 900">${ |
| | | activeChartType === ChartTypeEnum.Score ? scoreMap[item.data[1]] : item.data[1] |
| | | originChartType === ChartTypeEnum.Score ? scoreMap[item.data[1]] : item.data[1] |
| | | }</span> |
| | | <div style="clear: both"></div> |
| | | </div> |