mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
perf: Implement Echarts treeshaking (#29874)
This commit is contained in:
committed by
GitHub
parent
db1d77cba2
commit
c220245414
@@ -28,7 +28,35 @@ import {
|
||||
} from 'react';
|
||||
|
||||
import { styled } from '@superset-ui/core';
|
||||
import { ECharts, init } from 'echarts';
|
||||
import { use, init, EChartsType } from 'echarts/core';
|
||||
import {
|
||||
SankeyChart,
|
||||
PieChart,
|
||||
BarChart,
|
||||
FunnelChart,
|
||||
GaugeChart,
|
||||
GraphChart,
|
||||
LineChart,
|
||||
ScatterChart,
|
||||
RadarChart,
|
||||
BoxplotChart,
|
||||
TreeChart,
|
||||
TreemapChart,
|
||||
HeatmapChart,
|
||||
SunburstChart,
|
||||
} from 'echarts/charts';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
import {
|
||||
TooltipComponent,
|
||||
GridComponent,
|
||||
VisualMapComponent,
|
||||
LegendComponent,
|
||||
DataZoomComponent,
|
||||
ToolboxComponent,
|
||||
GraphicComponent,
|
||||
AriaComponent,
|
||||
} from 'echarts/components';
|
||||
import { LabelLayout } from 'echarts/features';
|
||||
import { EchartsHandler, EchartsProps, EchartsStylesProps } from '../types';
|
||||
|
||||
const Styles = styled.div<EchartsStylesProps>`
|
||||
@@ -36,6 +64,33 @@ const Styles = styled.div<EchartsStylesProps>`
|
||||
width: ${({ width }) => width};
|
||||
`;
|
||||
|
||||
use([
|
||||
CanvasRenderer,
|
||||
BarChart,
|
||||
BoxplotChart,
|
||||
FunnelChart,
|
||||
GaugeChart,
|
||||
GraphChart,
|
||||
HeatmapChart,
|
||||
LineChart,
|
||||
PieChart,
|
||||
RadarChart,
|
||||
SankeyChart,
|
||||
ScatterChart,
|
||||
SunburstChart,
|
||||
TreeChart,
|
||||
TreemapChart,
|
||||
AriaComponent,
|
||||
DataZoomComponent,
|
||||
GraphicComponent,
|
||||
GridComponent,
|
||||
LegendComponent,
|
||||
ToolboxComponent,
|
||||
TooltipComponent,
|
||||
VisualMapComponent,
|
||||
LabelLayout,
|
||||
]);
|
||||
|
||||
function Echart(
|
||||
{
|
||||
width,
|
||||
@@ -53,7 +108,7 @@ function Echart(
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
refs.divRef = divRef;
|
||||
}
|
||||
const chartRef = useRef<ECharts>();
|
||||
const chartRef = useRef<EChartsType>();
|
||||
const currentSelection = useMemo(
|
||||
() => Object.keys(selectedValues) || [],
|
||||
[selectedValues],
|
||||
|
||||
Reference in New Issue
Block a user