Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
e12aaa90
Commit
e12aaa90
authored
May 12, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化图表
parent
d5e2e189
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
20 deletions
+40
-20
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+2
-2
index.js
packages/extend-components/EC_HistoryView/src/index.js
+21
-11
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+17
-7
No files found.
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
e12aaa90
...
@@ -14,7 +14,7 @@ const SimgleChart = memo((props) => {
...
@@ -14,7 +14,7 @@ const SimgleChart = memo((props) => {
showGridLine
=
true
,
showGridLine
=
true
,
deviceAlarmSchemes
,
deviceAlarmSchemes
,
chartType
,
chartType
,
justLine
,
//
justLine,
showBoxOption
showBoxOption
}
=
props
;
}
=
props
;
const
chartRef
=
useRef
();
const
chartRef
=
useRef
();
...
@@ -28,7 +28,7 @@ const SimgleChart = memo((props) => {
...
@@ -28,7 +28,7 @@ const SimgleChart = memo((props) => {
showMarkLine
:
true
,
showMarkLine
:
true
,
showPoint
:
true
,
showPoint
:
true
,
chartType
,
chartType
,
justLine
,
//
justLine,
showBoxOption
showBoxOption
};
};
return
optionGenerator
(
dataSource
,
null
,
contrast
,
contrastOption
,
smooth
,
config
);
return
optionGenerator
(
dataSource
,
null
,
contrast
,
contrastOption
,
smooth
,
config
);
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
e12aaa90
...
@@ -80,14 +80,15 @@ const CheckboxData = [
...
@@ -80,14 +80,15 @@ const CheckboxData = [
showInTable
:
true
,
showInTable
:
true
,
tooltip
:
'本算法采用递推平均滤波法(滑动平均滤波法)对采样数据进行均值化平滑处理。'
,
tooltip
:
'本算法采用递推平均滤波法(滑动平均滤波法)对采样数据进行均值化平滑处理。'
,
},
},
{
// 需求变更,剔除
/* {
key: 'justLine',
key: 'justLine',
label: '仅查看曲线',
label: '仅查看曲线',
type: '',
type: '',
checked: false,
checked: false,
showInCurve: false,
showInCurve: false,
showInTable: false,
showInTable: false,
},
},
*/
{
{
key
:
'dataThin'
,
key
:
'dataThin'
,
label
:
'数据抽稀'
,
label
:
'数据抽稀'
,
...
@@ -360,11 +361,13 @@ const HistoryView = (props) => {
...
@@ -360,11 +361,13 @@ const HistoryView = (props) => {
onContrastChange
(
contrastOption
);
onContrastChange
(
contrastOption
);
setShowBoxOption
(
false
);
setShowBoxOption
(
false
);
setChartType
(
'lineChart'
);
setChartType
(
'lineChart'
);
onCheckboxChange
({
target
:
{
value
:
false
}},
'chartType'
)
onCheckboxChange
({
target
:
{
value
:
false
}},
'chartType'
);
onCheckboxChange
({
target
:
{
value
:
false
}},
'ignoreOutliers'
);
}
else
{
}
else
{
// 自定义
// 自定义
// 不需要处理
// 不需要处理
setShowBoxOption
(
true
)
setShowBoxOption
(
true
);
onCheckboxChange
({
target
:
{
value
:
true
}},
'chartType'
);
}
}
};
};
...
@@ -429,22 +432,29 @@ const HistoryView = (props) => {
...
@@ -429,22 +432,29 @@ const HistoryView = (props) => {
// 曲线设置项选择/取消
// 曲线设置项选择/取消
const
onCheckboxChange
=
(
e
,
key
,
showJustLine
)
=>
{
const
onCheckboxChange
=
(
e
,
key
,
showJustLine
)
=>
{
let
data
=
[...
checkboxData
];
let
data
=
[...
checkboxData
];
let
_index
=
data
.
findIndex
(
item
=>
item
.
key
===
'justLine'
);
// 仅查看曲线会在勾选了数据滤波后展示
//
let _index = data.findIndex(item => item.key === 'justLine'); // 仅查看曲线会在勾选了数据滤波后展示
let
_index1
=
data
.
findIndex
(
item
=>
item
.
key
===
'ignoreOutliers'
);
// 仅查看曲线会在勾选了数据滤波后展示
let
_index1
=
data
.
findIndex
(
item
=>
item
.
key
===
'ignoreOutliers'
);
// 仅查看曲线会在勾选了数据滤波后展示
data
.
forEach
((
item
)
=>
{
data
.
forEach
((
item
)
=>
{
if
(
item
.
key
===
key
)
{
if
(
item
.
key
===
key
)
{
item
.
checked
=
e
.
target
.
checked
;
item
.
checked
=
e
.
target
.
checked
;
}
}
});
});
if
(
key
===
'ignoreOutliers'
&&
showJustLine
)
{
if
(
key
===
'ignoreOutliers'
)
{
// 需求变更,仅查看曲线剔除
/* if (showJustLine) {
data[_index].showInCurve = e.target.checked;
data[_index].showInCurve = e.target.checked;
data[_index].checked = e.target.checked;
data[_index].checked = e.target.checked;
} else {*/
data
[
_index1
].
showInCurve
=
true
;
// data[_index1].checked = false;
// }
}
}
if
(
key
===
'chartType'
)
{
if
(
key
===
'chartType'
)
{
data
[
_index1
].
showInCurve
=
e
.
target
.
value
;
data
[
_index1
].
showInCurve
=
e
.
target
.
value
;
data
[
_index1
].
checked
=
false
;
data
[
_index1
].
checked
=
false
;
data
[
_index
].
showInCurve
=
false
;
//
data[_index].showInCurve = false;
data
[
_index
].
checked
=
false
;
//
data[_index].checked = false;
}
}
setCheckboxData
(
data
);
setCheckboxData
(
data
);
};
};
...
@@ -463,7 +473,7 @@ const HistoryView = (props) => {
...
@@ -463,7 +473,7 @@ const HistoryView = (props) => {
return
(
return
(
(
curveAccess
||
tableAccess
)
&&
(
(
curveAccess
||
tableAccess
)
&&
(
<>
<>
<
Checkbox
checked
=
{
child
.
checked
}
onChange
=
{(
e
)
=>
onCheckboxChange
(
e
,
child
.
key
,
showJustLine
)}
>
<
Checkbox
checked
=
{
child
.
checked
}
onChange
=
{(
e
)
=>
onCheckboxChange
(
e
,
child
.
key
)}
>
{
child
.
label
}
{
child
.
label
}
<
/Checkbox
>
<
/Checkbox
>
{
child
.
tooltip
&&
(
{
child
.
tooltip
&&
(
...
@@ -690,7 +700,7 @@ const HistoryView = (props) => {
...
@@ -690,7 +700,7 @@ const HistoryView = (props) => {
return;
return;
}
}
dateRange.forEach((item) => {
dateRange.forEach((item) => {
let _showLine = checkboxData.find(item => item.key === 'justLine');
//
let _showLine = checkboxData.find(item => item.key === 'justLine');
const param = {
const param = {
isDilute,
isDilute,
zoom,
zoom,
...
@@ -780,7 +790,7 @@ const HistoryView = (props) => {
...
@@ -780,7 +790,7 @@ const HistoryView = (props) => {
showGridLine={chartGrid}
showGridLine={chartGrid}
prefixCls={prefixCls}
prefixCls={prefixCls}
dataSource={chartDataSource}
dataSource={chartDataSource}
justLine={!!checkboxData.find(item => item.key === 'justLine' && item.checked)}
//
justLine={!!checkboxData.find(item => item.key === 'justLine' && item.checked)}
chartType={isBoxPlots ? chartType : null}
chartType={isBoxPlots ? chartType : null}
contrast={timeValue === 'contrast'}
contrast={timeValue === 'contrast'}
contrastOption={contrastOption}
contrastOption={contrastOption}
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
e12aaa90
...
@@ -138,8 +138,8 @@ export const minMaxMarkPoint = (dataItem, index, dataSource) => {
...
@@ -138,8 +138,8 @@ export const minMaxMarkPoint = (dataItem, index, dataSource) => {
// 只有一个数据曲线时显示markline
// 只有一个数据曲线时显示markline
if
(
!
dataItem
||
dataSource
.
length
!==
1
)
return
{};
if
(
!
dataItem
||
dataSource
.
length
!==
1
)
return
{};
const
data
=
[];
const
data
=
[];
data
.
push
({
type
:
'min'
,
name
:
'最小: '
});
data
.
push
({
type
:
'min'
,
name
:
'最小: '
,
});
data
.
push
({
type
:
'max'
,
name
:
'最大: '
});
data
.
push
({
type
:
'max'
,
name
:
'最大: '
,
});
return
{
return
{
symbolSize
:
1
,
symbolSize
:
1
,
symbolOffset
:
[
0
,
'50%'
],
symbolOffset
:
[
0
,
'50%'
],
...
@@ -258,7 +258,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -258,7 +258,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
const
showPoint
=
_
.
get
(
config
,
'showPoint'
,
false
);
const
showPoint
=
_
.
get
(
config
,
'showPoint'
,
false
);
const
deviceAlarmSchemes
=
_
.
get
(
config
,
'deviceAlarmSchemes'
,
[]);
const
deviceAlarmSchemes
=
_
.
get
(
config
,
'deviceAlarmSchemes'
,
[]);
const
chartType
=
_
.
get
(
config
,
'chartType'
,
null
);
const
chartType
=
_
.
get
(
config
,
'chartType'
,
null
);
const
justLine
=
_
.
get
(
config
,
'justLine'
,
false
);
//
const justLine = _.get(config, 'justLine', false);
const
showBoxOption
=
_
.
get
(
config
,
'showBoxOption'
,
false
);
const
showBoxOption
=
_
.
get
(
config
,
'showBoxOption'
,
false
);
// 自定义属性
// 自定义属性
const
restOption
=
_
.
pick
(
cusOption
,
[
'title'
,
'legend'
]);
const
restOption
=
_
.
pick
(
cusOption
,
[
'title'
,
'legend'
]);
...
@@ -373,7 +373,6 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -373,7 +373,6 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
const tooltipAccessor = (unit) => {
const tooltipAccessor = (unit) => {
return {
return {
formatter: function (params, ticket, callback) {
formatter: function (params, ticket, callback) {
debugger
let tooltipHeader = '';
let tooltipHeader = '';
let tooltipContent = '';
let tooltipContent = '';
if (isArray(params)) {
if (isArray(params)) {
...
@@ -385,7 +384,6 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -385,7 +384,6 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
tooltipHeader = headTemplate(params);
tooltipHeader = headTemplate(params);
tooltipContent += seriesTemplate(params, unit);
tooltipContent += seriesTemplate(params, unit);
}
}
debugger
return `
return `
<
div
>
<
div
>
$
{
tooltipHeader
}
$
{
tooltipHeader
}
...
@@ -471,7 +469,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -471,7 +469,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
// }
// }
};
};
// 增加箱线图的逻辑,单曲线才存在
// 增加箱线图的逻辑,单曲线才存在
if (
!justLine &&
chartType && showBoxOption) {
if (chartType && showBoxOption) {
if (chartType === 'boxChart') {
if (chartType === 'boxChart') {
const otherData = dataSource?.[0]?.dataModel.map(item => {
const otherData = dataSource?.[0]?.dataModel.map(item => {
const {firstPV, lastPV, maxPV, minPV, pt} = item;
const {firstPV, lastPV, maxPV, minPV, pt} = item;
...
@@ -578,9 +576,21 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
...
@@ -578,9 +576,21 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
bottom
:
10
,
bottom
:
10
,
start
:
0
,
start
:
0
,
end
:
100
,
end
:
100
,
height
:
28
height
:
28
,
type
:
'inside'
,
zoomOnMouseWheel
:
true
},
{
show
:
true
,
bottom
:
10
,
start
:
0
,
end
:
100
,
height
:
28
,
type
:
'slider'
,
zoomOnMouseWheel
:
true
}
}
];
];
xAxis
.
minInterval
=
3600
*
1
*
1000
return
{
return
{
yAxis
,
yAxis
,
grid
,
grid
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment