Skip to content

Commit

Permalink
refactor: use tree-shakable api from echarts 5
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenOutman committed Jun 16, 2022
1 parent b4b6279 commit 29e9602
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 27 deletions.
6 changes: 4 additions & 2 deletions src/components/DataZoom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { DataZoomComponentOption } from 'echarts';
import 'echarts/lib/component/dataZoom';
import * as echarts from 'echarts/core';
import { DataZoomComponent, type DataZoomComponentOption } from 'echarts/components';
import { symbols } from '../constants';

echarts.use([DataZoomComponent]);

export type DataZoomProps = DataZoomComponentOption;

function DataZoom(_: DataZoomProps) {
Expand Down
7 changes: 4 additions & 3 deletions src/components/Legend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { LegendComponentOption } from 'echarts';
import 'echarts/lib/component/legend';
import 'echarts/lib/component/legendScroll';
import * as echarts from 'echarts/core';
import { LegendComponent, type LegendComponentOption } from 'echarts/components';
import { symbols } from '../constants';

echarts.use([LegendComponent]);

export type LegendProps = LegendComponentOption;

function Legend(_: LegendProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Radar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { RadarComponentOption } from 'echarts';
import 'echarts/lib/component/radar';
import * as echarts from 'echarts/core';
import { RadarComponent, type RadarComponentOption } from 'echarts/components';
import { symbols } from '../constants';

echarts.use([RadarComponent]);

export type RadarProps = RadarComponentOption;

function Radar(_: RadarProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { TooltipComponentOption } from 'echarts';
import 'echarts/lib/component/tooltip';
import * as echarts from 'echarts/core';
import { TooltipComponent, type TooltipComponentOption } from 'echarts/components';
import { symbols } from '../constants';

echarts.use([TooltipComponent]);

export type TooltipProps = TooltipComponentOption;

function Tooltip(_: TooltipProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/VisualMap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { VisualMapComponentOption } from 'echarts';
import 'echarts/lib/component/visualMap';
import * as echarts from 'echarts/core';
import { VisualMapComponent, type VisualMapComponentOption } from 'echarts/components';
import { symbols } from '../constants';

echarts.use([VisualMapComponent]);

export type VisualMapProps = VisualMapComponentOption;

function VisualMap(_: VisualMapProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/series/Bars.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { BarSeriesOption } from 'echarts';
import 'echarts/lib/chart/bar';
import * as echarts from 'echarts/core';
import { BarChart, type BarSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([BarChart]);

type BarsProps = Omit<BarSeriesOption, 'stack'> & {
color?: string | string[];
stack?: string | true;
Expand Down
6 changes: 4 additions & 2 deletions src/series/Funnel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { FunnelSeriesOption } from 'echarts';
import 'echarts/lib/chart/funnel';
import * as echarts from 'echarts/core';
import { FunnelChart, type FunnelSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([FunnelChart]);

export interface FunnelProps extends FunnelSeriesOption {
asc?: boolean;
}
Expand Down
6 changes: 4 additions & 2 deletions src/series/Line.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { LineSeriesOption } from 'echarts';
import 'echarts/lib/chart/line';
import * as echarts from 'echarts/core';
import { LineChart, type LineSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([LineChart]);

export type LineProps = Omit<LineSeriesOption, 'stack'> & {
stack?: string | boolean;
area?: boolean;
Expand Down
6 changes: 4 additions & 2 deletions src/series/Map.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { MapSeriesOption } from 'echarts';
import 'echarts/lib/chart/map';
import * as echarts from 'echarts/core';
import { MapChart, type MapSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([MapChart]);

export type MapProps = MapSeriesOption;

function Map(_: MapProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/series/Pie.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { PieSeriesOption } from 'echarts';
import 'echarts/lib/chart/pie';
import * as echarts from 'echarts/core';
import { PieChart, type PieSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([PieChart]);

export interface PieProps extends PieSeriesOption {
donut?: boolean;
}
Expand Down
6 changes: 4 additions & 2 deletions src/series/Scatter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { ScatterSeriesOption } from 'echarts';
import 'echarts/lib/chart/scatter';
import * as echarts from 'echarts/core';
import { ScatterChart, type ScatterSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([ScatterChart]);

export type ScatterProps = ScatterSeriesOption;

function Scatter(_: ScatterProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/series/Tree.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { TreeSeriesOption } from 'echarts';
import 'echarts/lib/chart/tree';
import * as echarts from 'echarts/core';
import { TreeChart, type TreeSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([TreeChart]);

export type TreeProps = TreeSeriesOption;

function Tree(_: TreeProps) {
Expand Down
6 changes: 4 additions & 2 deletions src/series/Treemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { TreemapSeriesOption } from 'echarts';
import 'echarts/lib/chart/treemap';
import * as echarts from 'echarts/core';
import { TreemapChart, type TreemapSeriesOption } from 'echarts/charts';
import { symbols } from '../constants';

echarts.use([TreemapChart]);

export type TreemapProps = TreemapSeriesOption;

function Treemap(_: TreemapProps) {
Expand Down

0 comments on commit 29e9602

Please sign in to comment.