| | |
| | | <!-- TimeRange v-model 跟 @change 中的值会不一样,以@change 中为准 --> |
| | | <template v-if="visibleParams && visibleParams.length > 0"> |
| | | <component |
| | | class="flex-0 m-1" |
| | | class="flex-0 m-2" |
| | | v-model="paramsValueList[index].value" |
| | | v-for="(item, index) in visibleParams as any" |
| | | :key="item.id" |
| | |
| | | ></component> |
| | | </template> |
| | | <slot> </slot> |
| | | <YRange @input="yRangeInput" /> |
| | | <el-tooltip |
| | | v-if="originChartType === ChartTypeEnum.Score" |
| | | :content="`${Object.keys(scoreMap) |
| | | .map((key) => `${key} 表示${scoreMap[key]}`) |
| | | .join(', ')}`" |
| | | placement="top-start" |
| | | > |
| | | <SvgIcon name="fa fa-question-circle-o" :size="15" class="ml-1 cursor-help flex-center" color="#909399" /> |
| | | </el-tooltip> |
| | | |
| | | <YRange v-model="yRange" @input="yRangeInput" /> |
| | | <el-checkbox class="m-1" v-model="isMultiCompare" label="多日对比" @change="multiCompareChange"></el-checkbox> |
| | | <el-checkbox class="m-2" v-model="isMultiCompare" label="多日对比" @change="multiCompareChange"></el-checkbox> |
| | | |
| | | <DisplayMode class="ml-auto" v-model="showMode" @change="displayModeChange" /> |
| | | </div> |
| | |
| | | import { deepClone } from '/@/utils/other'; |
| | | import { debounce } from '/@/utils/util'; |
| | | const chartRef = ref<HTMLDivElement>(null); |
| | | const yRange = ref({ |
| | | min: null as number, |
| | | max: null as number, |
| | | }); |
| | | |
| | | const showMode = ref(DisplayModeType.Chart); |
| | | // const props = defineProps({ |
| | |
| | | handleData(); |
| | | setNewOption(); |
| | | }; |
| | | const { chartContainerResize, chartInstance, initChart } = useDrawChatChart({ chartRef, drawChart }); |
| | | const { chartContainerResize, chartInstance } = useDrawChatChart({ chartRef, drawChart }); |
| | | |
| | | // 更换列表 |
| | | const changeMap = new Map<string, any>(null); |
| | |
| | | } |
| | | }; |
| | | |
| | | let realRange = { |
| | | min: null, |
| | | max: null, |
| | | }; |
| | | |
| | | const getSingleDayOption = (day = COMMON_DAY) => |
| | | ({ |
| | | tooltip: { |
| | |
| | | } as echarts.EChartsOption); |
| | | //#region ====================== 设置Y范围 ====================== |
| | | const debounceSetYRange = debounce((val) => { |
| | | (realRange.min = val.min), (realRange.max = val.max); |
| | | chartInstance.value.setOption({ |
| | | yAxis: { |
| | | min: val.min, |
| | | max: val.max, |
| | | }, |
| | | yAxis: realRange, |
| | | }); |
| | | |
| | | currentSeries.value = currentSeries.value.concat([]); |
| | |
| | | |
| | | const tableData = computed(() => { |
| | | if (!currentSeries.value) return []; |
| | | // const min = yRange.value.min == null ? -Infinity : yRange.value.min; |
| | | // const max = yRange.value.max == null ? Infinity : yRange.value.max; |
| | | const min = realRange.min == null ? -Infinity : realRange.min; |
| | | const max = realRange.max == null ? Infinity : realRange.max; |
| | | const timeDataMap = currentSeries.value.reduce((preVal, curVal, index) => { |
| | | for (const item of curVal.data) { |
| | | const [time, value] = item; |
| | | |
| | | // if (value < min || value > max) { |
| | | // continue; |
| | | // } |
| | | let [time, value] = item; |
| | | // 多日对比,只显示时分秒 |
| | | if (isMultiCompare.value) { |
| | | time = time.slice(11); |
| | | } |
| | | if (value < min || value > max) { |
| | | continue; |
| | | } |
| | | if (!preVal[time]) { |
| | | preVal[time] = []; |
| | | } |
| | | |
| | | // score 类型,value 值,需要映射成另一个值 |
| | | if (originChartType === ChartTypeEnum.Score) { |
| | | value = scoreMap[value]; |
| | | } |
| | | preVal[time][index] = value; |
| | | } |
| | |
| | | watch( |
| | | () => currentSeries.value, |
| | | (val) => { |
| | | if (!tableIsShow.value) return; |
| | | tableKey.value = _.random(0, 100000) + ''; |
| | | } |
| | | ); |