Commit b8a70811 authored by 崔佳豪's avatar 崔佳豪

fix: 修复历史曲线图表尺寸显示

parent 39ffa3f1
import React, { memo, useEffect, useMemo, useRef } from 'react';
import React, { memo, useMemo } from 'react';
import { BasicChart } from '@wisdom-components/basicchart'; import { BasicChart } from '@wisdom-components/basicchart';
import optionGenerator from './utils'; import optionGenerator from './utils';
const SimgleChart = memo((props) => { const SimgleChart = memo((props) => {
const { dataSource, contrast = false, contrastOption = 'day', smooth = true } = props; const { dataSource, contrast = false, contrastOption = 'day', smooth = true } = props;
const chartRef = useRef();
const option = useMemo(() => { const option = useMemo(() => {
const config = { const config = {
...@@ -14,7 +13,13 @@ const SimgleChart = memo((props) => { ...@@ -14,7 +13,13 @@ const SimgleChart = memo((props) => {
return optionGenerator(dataSource, null, contrast, contrastOption, smooth, config); return optionGenerator(dataSource, null, contrast, contrastOption, smooth, config);
}, [dataSource, smooth]); }, [dataSource, smooth]);
return <BasicChart option={option} notMerge style={{ width: '100%', height: '100%' }}/> useEffect(() => {
chartRef.current?.resize?.();
}, []);
return (
<BasicChart ref={chartRef} option={option} notMerge style={{ width: '100%', height: '100%' }} />
);
}); });
export default SimgleChart; export default SimgleChart;
...@@ -312,7 +312,7 @@ const HistoryView = (props) => { ...@@ -312,7 +312,7 @@ const HistoryView = (props) => {
const renderTimeOption = () => { const renderTimeOption = () => {
return ( return (
<div className={classNames(`${prefixCls}-date`)}> <div className={classNames(`${prefixCls}-date`)}>
<div className={classNames(`${prefixCls}-label`)}>时间</div> <div className={classNames(`${prefixCls}-label`)}>时间选择</div>
<Radio.Group value={timeValue} onChange={onTimeSetChange}> <Radio.Group value={timeValue} onChange={onTimeSetChange}>
<Radio.Button value="customer">自定义</Radio.Button> <Radio.Button value="customer">自定义</Radio.Button>
<Radio.Button value="contrast">同期对比</Radio.Button> <Radio.Button value="contrast">同期对比</Radio.Button>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
.@{history-view} { .@{history-view} {
height: 100%; height: 100%;
padding: @padding-md;
&-label { &-label {
position: relative; position: relative;
...@@ -40,14 +41,6 @@ ...@@ -40,14 +41,6 @@
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
.@{history-view}-label {
letter-spacing: 27px;
&::after {
right: -20px;
}
}
.@{ant-prefix}-radio-group, .@{ant-prefix}-radio-group,
.@{ant-prefix}-select { .@{ant-prefix}-select {
margin-right: 16px; margin-right: 16px;
...@@ -59,8 +52,6 @@ ...@@ -59,8 +52,6 @@
font-size: 16px; font-size: 16px;
cursor: pointer; cursor: pointer;
} }
} }
.@{history-view}-contrast { .@{history-view}-contrast {
...@@ -99,11 +90,11 @@ ...@@ -99,11 +90,11 @@
.@{history-view}-options { .@{history-view}-options {
display: flex; display: flex;
align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center;
padding-bottom: 10px;
column-gap: 20px; column-gap: 20px;
row-gap: 10px; row-gap: 10px;
padding-bottom: 10px;
} }
.@{history-view}-cover { .@{history-view}-cover {
...@@ -118,21 +109,22 @@ ...@@ -118,21 +109,22 @@
} }
.@{history-view}-grid { .@{history-view}-grid {
height: 100%;
overflow-y: auto;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
background-color: #F0F2F5; height: 100%;
padding: 4px; padding: 4px;
overflow-y: auto;
background-color: #f0f2f5;
&-item { &-item {
width: 50%; width: 50%;
height: 50%;
padding: 4px; padding: 4px;
} }
&-item-wrap { &-item-wrap {
height: 350px; height: 100%;
background-color: #FFF; background-color: #fff;
border-radius: 4px; border-radius: 4px;
} }
} }
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