Skip to content

Commit

Permalink
[add] Chart Element modules
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Feb 28, 2024
1 parent c173443 commit 3542063
Show file tree
Hide file tree
Showing 24 changed files with 473 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "echarts-jsx",
"version": "1.0.0-rc.2",
"version": "1.0.0-rc.3",
"license": "LGPL-3.0",
"author": "[email protected]",
"description": "A real JSX wrapper for ECharts based on TypeScript & Web components",
Expand Down Expand Up @@ -34,7 +34,9 @@
},
"./*": [
"./dist/component/*",
"./dist/component/*.d.ts"
"./dist/component/*.d.ts",
"./dist/chart/*",
"./dist/chart/*.d.ts"
]
},
"engines": {
Expand Down
20 changes: 20 additions & 0 deletions source/chart/bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { BarSeriesOption } from 'echarts';
import { BarChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-bar-chart',
class ECBarElement extends ECOptionElement {}
);
use(BarChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-bar-chart': JsxProps<ECOptionElement> & BarSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/boxplot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { BoxplotSeriesOption } from 'echarts';
import { BoxplotChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-boxplot-chart',
class ECBoxplotElement extends ECOptionElement {}
);
use(BoxplotChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-boxplot-chart': JsxProps<ECOptionElement> & BoxplotSeriesOption;
}
}
}
21 changes: 21 additions & 0 deletions source/chart/candlestick.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { JsxProps } from 'dom-renderer';
import { CandlestickSeriesOption } from 'echarts';
import { CandlestickChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-candlestick-chart',
class ECCandlestickElement extends ECOptionElement {}
);
use(CandlestickChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-candlestick-chart': JsxProps<ECOptionElement> &
CandlestickSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { CustomSeriesOption } from 'echarts';
import { CustomChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-custom-chart',
class ECCustomElement extends ECOptionElement {}
);
use(CustomChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-custom-chart': JsxProps<ECOptionElement> & CustomSeriesOption;
}
}
}
21 changes: 21 additions & 0 deletions source/chart/effect-scatter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { JsxProps } from 'dom-renderer';
import { EffectScatterSeriesOption } from 'echarts';
import { EffectScatterChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-effect-scatter-chart',
class ECEffectScatterElement extends ECOptionElement {}
);
use(EffectScatterChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-effect-scatter-chart': JsxProps<ECOptionElement> &
EffectScatterSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/funnel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { FunnelSeriesOption } from 'echarts';
import { FunnelChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-funnel-chart',
class ECFunnelElement extends ECOptionElement {}
);
use(FunnelChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-funnel-chart': JsxProps<ECOptionElement> & FunnelSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/gauge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { GaugeSeriesOption } from 'echarts';
import { GaugeChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-gauge-chart',
class ECGaugeElement extends ECOptionElement {}
);
use(GaugeChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-gauge-chart': JsxProps<ECOptionElement> & GaugeSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/graph.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { GraphSeriesOption } from 'echarts';
import { GraphChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-graph-chart',
class ECGraphElement extends ECOptionElement {}
);
use(GraphChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-graph-chart': JsxProps<ECOptionElement> & GraphSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/heatmap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { HeatmapSeriesOption } from 'echarts';
import { HeatmapChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-heatmap-chart',
class ECHeatmapElement extends ECOptionElement {}
);
use(HeatmapChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-heatmap-chart': JsxProps<ECOptionElement> & HeatmapSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/line.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { LineSeriesOption } from 'echarts';
import { LineChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-line-chart',
class ECLineElement extends ECOptionElement {}
);
use(LineChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-line-chart': JsxProps<ECOptionElement> & LineSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/lines.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { LinesSeriesOption } from 'echarts';
import { LinesChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-lines-chart',
class ECLinesElement extends ECOptionElement {}
);
use(LinesChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-lines-chart': JsxProps<ECOptionElement> & LinesSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { MapSeriesOption } from 'echarts';
import { MapChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-map-chart',
class ECMapElement extends ECOptionElement {}
);
use(MapChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-map-chart': JsxProps<ECOptionElement> & MapSeriesOption;
}
}
}
21 changes: 21 additions & 0 deletions source/chart/parallel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { JsxProps } from 'dom-renderer';
import { ParallelSeriesOption } from 'echarts';
import { ParallelChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-parallel-chart',
class ECParallelElement extends ECOptionElement {}
);
use(ParallelChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-parallel-chart': JsxProps<ECOptionElement> &
ParallelSeriesOption;
}
}
}
21 changes: 21 additions & 0 deletions source/chart/pictorial-bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { JsxProps } from 'dom-renderer';
import { PictorialBarSeriesOption } from 'echarts';
import { PictorialBarChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-pictorial-bar-chart',
class ECPictorialBarElement extends ECOptionElement {}
);
use(PictorialBarChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-pictorial-bar-chart': JsxProps<ECOptionElement> &
PictorialBarSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/pie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { PieSeriesOption } from 'echarts';
import { PieChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-pie-chart',
class ECPieElement extends ECOptionElement {}
);
use(PieChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-pie-chart': JsxProps<ECOptionElement> & PieSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/radar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { RadarSeriesOption } from 'echarts';
import { RadarChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-radar-chart',
class ECRadarElement extends ECOptionElement {}
);
use(RadarChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-radar-chart': JsxProps<ECOptionElement> & RadarSeriesOption;
}
}
}
20 changes: 20 additions & 0 deletions source/chart/sankey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JsxProps } from 'dom-renderer';
import { SankeySeriesOption } from 'echarts';
import { SankeyChart } from 'echarts/charts';
import { use } from 'echarts/core';

import { ECOptionElement } from '../Option';

globalThis.customElements?.define(
'ec-sankey-chart',
class ECSankeyElement extends ECOptionElement {}
);
use(SankeyChart);

declare global {
namespace JSX {
interface IntrinsicElements {
'ec-sankey-chart': JsxProps<ECOptionElement> & SankeySeriesOption;
}
}
}
Loading

1 comment on commit 3542063

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for echarts-jsx ready!

✅ Preview
https://echarts-fmvxedtwa-techquery.vercel.app

Built with commit 3542063.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.