GitHub Pages / build (push) Canceled after 0s
GitHub Pages / deploy (push) Canceled after 0s
Docker image / meta (push) Successful in 24s
Docs Docker image / meta (push) Successful in 7s
Docker image / build (amd64, linux/amd64, ubuntu-latest) (push) Failing after 59s
Docs Docker image / build (amd64, linux/amd64, ubuntu-latest) (push) Failing after 30s
Docker image / merge (push) Canceled after 0s
Docs Docker image / merge (push) Canceled after 0s
Docker image / build (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Docs Docker image / build (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { Col, Radio, Row, Card } from 'tdesign-react';
|
|
import { EChartOption } from 'echarts';
|
|
import ReactEcharts from 'echarts-for-react';
|
|
import { getBarOptions } from '../chart';
|
|
import useDynamicChart from 'hooks/useDynamicChart';
|
|
import DynamicLineChart from './DynamicLineChart';
|
|
import Style from './TopChart.module.less';
|
|
|
|
const TopChart = () => {
|
|
const [barOptions, setBarOptions] = useState<EChartOption>(getBarOptions());
|
|
|
|
const tabChange = (isMonth: boolean) => {
|
|
setBarOptions(getBarOptions(isMonth));
|
|
};
|
|
const dynamicBarChartOptions = useDynamicChart(barOptions, {
|
|
placeholderColor: ['legend.textStyle.color', 'xAxis.0.axisLabel.color', 'yAxis.0.axisLabel.color'],
|
|
});
|
|
return (
|
|
<Row gutter={16} className={Style.panel}>
|
|
<Col span={6}>
|
|
<Card title='部署趋势' bordered={false}>
|
|
<div className={Style.deployPanelLeft}>
|
|
<DynamicLineChart />
|
|
</div>
|
|
</Card>
|
|
</Col>
|
|
<Col span={6}>
|
|
<Card
|
|
title='告警情况'
|
|
actions={
|
|
<Radio.Group defaultValue='week' onChange={(val) => tabChange(val === 'month')}>
|
|
<Radio.Button value='week'>本周</Radio.Button>
|
|
<Radio.Button value='month'>本月</Radio.Button>
|
|
</Radio.Group>
|
|
}
|
|
bordered={false}
|
|
>
|
|
<ReactEcharts
|
|
option={dynamicBarChartOptions} // option:图表配置项
|
|
notMerge={true}
|
|
lazyUpdate={true}
|
|
style={{ height: 255 }}
|
|
/>
|
|
</Card>
|
|
</Col>
|
|
</Row>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TopChart);
|