Commit 1d4f9c9d authored by 崔佳豪's avatar 崔佳豪

fix(EC_HistoryView): 空图表容错处理、滤波配置描述

parent ba383392
...@@ -28,7 +28,7 @@ const SimgleChart = memo((props) => { ...@@ -28,7 +28,7 @@ const SimgleChart = memo((props) => {
useEffect(() => { useEffect(() => {
chartRef.current?.resize?.(); chartRef.current?.resize?.();
const chart = chartRef.current.getEchartsInstance(); const chart = chartRef.current?.getEchartsInstance?.();
function hander(params) { function hander(params) {
const { selected } = params; const { selected } = params;
...@@ -52,7 +52,7 @@ const SimgleChart = memo((props) => { ...@@ -52,7 +52,7 @@ const SimgleChart = memo((props) => {
// 网格开关,不更新整个图表 // 网格开关,不更新整个图表
useEffect(() => { useEffect(() => {
const chart = chartRef.current.getEchartsInstance(); const chart = chartRef.current?.getEchartsInstance?.();
if (!chart) return; if (!chart) return;
const option = chart.getOption(); const option = chart.getOption();
// 交互指针 // 交互指针
......
import React, { useContext, useEffect, useMemo, useState } from 'react'; import React, { useContext, useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Checkbox, ConfigProvider, DatePicker, Radio, Select, Spin, Tabs } from 'antd'; import { Checkbox, ConfigProvider, DatePicker, Radio, Select, Spin, Tabs, Tooltip } from 'antd';
import { CloseCircleFilled, DownloadOutlined, PlusCircleOutlined } from '@ant-design/icons'; import {
CloseCircleFilled,
DownloadOutlined,
PlusCircleOutlined,
QuestionCircleFilled,
} from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import _ from 'lodash'; import _ from 'lodash';
import TimeRangePicker from '@wisdom-components/timerangepicker'; import TimeRangePicker from '@wisdom-components/timerangepicker';
...@@ -60,11 +65,12 @@ const CheckboxData = [ ...@@ -60,11 +65,12 @@ const CheckboxData = [
}, },
{ {
key: 'ignoreOutliers', key: 'ignoreOutliers',
label: '滤波', label: '数据滤波',
type: 'updateIgnoreOutliers', type: 'updateIgnoreOutliers',
checked: false, checked: false,
showInCurve: true, showInCurve: true,
showInTable: true, showInTable: true,
tooltip: '数据滤波针对与样本平均值相差2个标准差以上的值进行过滤。',
}, },
{ {
key: 'dataThin', key: 'dataThin',
...@@ -403,14 +409,27 @@ const HistoryView = (props) => { ...@@ -403,14 +409,27 @@ const HistoryView = (props) => {
setDataThinKey(value); setDataThinKey(value);
}; };
const renderCheckbox = (child) => const renderCheckbox = (child) => {
((activeTabKey === 'curve' && !grid && child.showInCurve) || const curveAccess = activeTabKey === 'curve' && child.showInCurve;
(activeTabKey === 'curve' && grid && child.key === 'curveCenter') || const tableAccess = activeTabKey === 'table' && child.showInTable;
(activeTabKey === 'table' && child.showInTable)) && ( const gridOptions = ['curveCenter'];
<Checkbox checked={child.checked} onChange={(e) => onCheckboxChange(e, child.key)}>
{child.label} if (grid && gridOptions.indexOf(child.key) === -1) return null;
</Checkbox> return (
(curveAccess || tableAccess) && (
<>
<Checkbox checked={child.checked} onChange={(e) => onCheckboxChange(e, child.key)}>
{child.label}
</Checkbox>
{child.tooltip && (
<Tooltip title={child.tooltip}>
<QuestionCircleFilled className={`${prefixCls}-question`} />
</Tooltip>
)}
</>
)
); );
};
const renderCurveOption = () => { const renderCurveOption = () => {
return ( return (
......
...@@ -176,3 +176,13 @@ ...@@ -176,3 +176,13 @@
border-radius: 4px; border-radius: 4px;
} }
} }
.@{history-view}-question {
color: @primary-color;
cursor: pointer;
opacity: 0.8;
&:hover {
opacity: 1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment