feat: model usage
This commit is contained in:
@@ -54,6 +54,13 @@ const Chart: React.FC<{
|
||||
|
||||
const currentChart = chart.current;
|
||||
const optionsYAxis = currentChart.getOption()?.yAxis;
|
||||
|
||||
console.log(
|
||||
'chart finished',
|
||||
finished.current,
|
||||
optionsYAxis,
|
||||
chart.current
|
||||
);
|
||||
if (
|
||||
!optionsYAxis ||
|
||||
!Array.isArray(optionsYAxis) ||
|
||||
@@ -81,10 +88,6 @@ const Chart: React.FC<{
|
||||
const newMax0 = intervals[0] * (unifiedCount - 1);
|
||||
const newMax1 = intervals[1] * (unifiedCount - 1);
|
||||
|
||||
// get yaxis max value
|
||||
const maxValue0 = Math.max();
|
||||
const maxValue1 = yAxisModels[1].get('max');
|
||||
|
||||
// if newMax0 equal to maxValue0, and newMax1 equal to maxValue1, do not update yAxis
|
||||
if (counts[0] === counts[1]) return;
|
||||
|
||||
@@ -127,7 +130,7 @@ const Chart: React.FC<{
|
||||
resize();
|
||||
setOption(options);
|
||||
resizeable.current = true;
|
||||
}, [options]);
|
||||
}, [setOption]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = throttle(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Chart from '@/components/echarts/chart';
|
||||
import useChartConfig from '@/components/echarts/config';
|
||||
import EmptyData from '@/components/empty-data';
|
||||
import _ from 'lodash';
|
||||
import React, { memo, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { ChartProps } from './types';
|
||||
|
||||
const MixLineBarChart: React.FC<
|
||||
@@ -147,4 +147,4 @@ const MixLineBarChart: React.FC<
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(MixLineBarChart);
|
||||
export default MixLineBarChart;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import AutoTooltip from '@/components/auto-tooltip';
|
||||
|
||||
interface SelectRenderProps {
|
||||
maxTagWidth?: number;
|
||||
}
|
||||
|
||||
export default function useSelectRender(config?: SelectRenderProps) {
|
||||
const { maxTagWidth = 100 } = config || {};
|
||||
const TagRender = (props: any) => {
|
||||
const { label } = props;
|
||||
return (
|
||||
<AutoTooltip
|
||||
maxWidth={maxTagWidth}
|
||||
closable={props.closable}
|
||||
onClose={props.onClose}
|
||||
>
|
||||
{label}
|
||||
</AutoTooltip>
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
TagRender
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user