ECharts component library for @json-render/core. Transform JSON specifications into beautiful ECharts visualizations using SVG rendering.
- Six Chart Types: LineChart, PieChart, BarChart, RadarChart, ScatterChart, BoxplotChart
- SVG Rendering: High-quality vector graphics for all charts
- Full Customization: Comprehensive props for styling and behavior
- Type-Safe: Full TypeScript support with Zod schemas
- React Integration: Seamless integration with @json-render/react
npm install @json-render-plugins/echarts echarts react react-dom
# or
pnpm add @json-render-plugins/echarts echarts react react-dom
# or
yarn add @json-render-plugins/echarts echarts react react-domImport standard definitions from @json-render-plugins/echarts/catalog:
import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { echartsComponentDefinitions } from "@json-render-plugins/echarts/catalog";
const catalog = defineCatalog(schema, {
components: {
LineChart: echartsComponentDefinitions.LineChart,
PieChart: echartsComponentDefinitions.PieChart,
BarChart: echartsComponentDefinitions.BarChart,
RadarChart: echartsComponentDefinitions.RadarChart,
ScatterChart: echartsComponentDefinitions.ScatterChart,
BoxplotChart: echartsComponentDefinitions.BoxplotChart,
},
actions: {},
});Import implementations from @json-render-plugins/echarts:
import { defineRegistry } from "@json-render/react";
import { echartsComponents } from "@json-render-plugins/echarts";
const { registry } = defineRegistry(catalog, {
components: {
LineChart: echartsComponents.LineChart,
PieChart: echartsComponents.PieChart,
BarChart: echartsComponents.BarChart,
RadarChart: echartsComponents.RadarChart,
ScatterChart: echartsComponents.ScatterChart,
BoxplotChart: echartsComponents.BoxplotChart,
},
});import { Renderer } from "@json-render/react";
function App({ spec }) {
return <Renderer spec={spec} registry={registry} />;
}Line charts display data trends over time or categories. Supports area fills, stacking, smooth curves, and symbol customization. Multiple series can share the same coordinate system. Use smooth=true for curved lines, areaStyle=true for filled regions. Customize symbols, line styles, and item styles for visual distinction.
{
"type": "LineChart",
"props": {
"xAxisData": ["Jan", "Feb", "Mar", "Apr", "May"],
"series": [
{
"name": "Revenue",
"data": [120, 200, 150, 80, 70],
"smooth": true,
"areaStyle": true
},
{
"name": "Cost",
"data": [80, 100, 120, 60, 50]
}
],
"title": "Financial Overview",
"showTooltip": true,
"showLegend": true
}
}Key Props:
xAxisData: Array of X-axis labelsseries: Array of line series withname,data, and optional stylingsmooth: Enable smooth curvesareaStyle: Fill area under linesymbol: Point marker shape (circle, rect, triangle, etc.)lineStyle: Line style withwidthandtype(solid, dashed, dotted)
Pie and donut charts showing data proportions and percentages. Use radius property with [inner, outer] to create donut charts. Supports Nightingale rose charts via pieType='rose' with 'radius' mode (central angle shows percentage, radius shows size) or 'area' mode (same angle, radius shows size). Labels can be positioned outside (connected via visual guide line), inside/inner (within sectors), or center. Enable selectedMode for interactive selection.
{
"type": "PieChart",
"props": {
"data": [
{ "name": "Category A", "value": 335 },
{ "name": "Category B", "value": 310 },
{ "name": "Category C", "value": 234 }
],
"title": "Market Share",
"radius": ["40%", "70%"],
"showLabel": true,
"showTooltip": true
}
}Key Props:
data: Array of slices withname,value, and optionalcolorradius: Single value or [inner, outer] for donut chartspieType: Set to "rose" for rose chartselectedMode: Enable selection ("single" or "multiple")labelPosition: Label position - "outside", "inside", "center"
Bar charts featuring stacked series, background bars, and custom styling. Supports stacking multiple series with stack property, custom bar widths, rounded corners via itemStyle.borderRadius, and background bars with showBackground and backgroundStyle. Use horizontal=true for horizontal bars. Multiple series can share the same coordinate system for effective comparison across categories.
{
"type": "BarChart",
"props": {
"xAxisData": ["Product A", "Product B", "Product C"],
"series": [
{ "name": "Sales", "data": [320, 332, 301] },
{ "name": "Marketing", "data": [120, 132, 101], "stack": "total" }
],
"title": "Product Performance",
"showTooltip": true,
"horizontal": false
}
}Key Props:
xAxisData: Array of X-axis labelsseries: Array of bar series withname,data, and optional stylinghorizontal: Flip axes for horizontal barsstack: Group name for stacked barsbarWidth: Control bar width
Radar charts display multi-dimensional data on a spider/web coordinate system where each axis represents one dimension. Ideal for performance analysis, skill assessment, and KPI dashboards.
{
"type": "RadarChart",
"props": {
"indicator": [
{ "name": "Speed", "max": 100 },
{ "name": "Strength", "max": 100 },
{ "name": "Agility", "max": 100 },
{ "name": "Intelligence", "max": 100 },
{ "name": "Stamina", "max": 100 }
],
"data": [
{ "name": "Player A", "value": [80, 70, 90, 60, 75], "areaStyle": {} },
{ "name": "Player B", "value": [65, 85, 55, 80, 70] }
],
"title": "Player Comparison"
}
}Key Props:
indicator: Array of axes withnameand optionalmaxdata: Array of{ name, value: number[], color?, areaStyle? }series: Alternative data format{ name, data: number[], color?, areaStyle? }shape:"polygon"(default) or"circle"splitNumber: Number of split levels (default: 5)
Scatter (bubble) charts show relationships between two numeric dimensions. When colored or sized by additional fields, they become bubble charts.
{
"type": "ScatterChart",
"props": {
"data": [
[10, 20],
[15, 35],
{ "value": [25, 45], "name": "Outlier", "color": "#ff0000" }
],
"title": "Scatter Plot",
"symbolSize": 12,
"xAxisName": "X",
"yAxisName": "Y"
}
}Key Props:
data:[[x, y], ...]or[{ value: [x, y], name?, color? }, ...]symbolSize: Point size (number or[width, height])xAxisType/yAxisType:"value","category","time", or"log"xAxisMin/xAxisMax/yAxisMin/yAxisMax: Axis range
Boxplot charts (box-and-whisker) display statistical distributions through quartiles. Each box shows min, Q1, median, Q3, and max.
{
"type": "BoxplotChart",
"props": {
"data": [
[655, 850, 940, 980, 1175],
[672, 800, 845, 885, 1012],
[780, 840, 855, 880, 940]
],
"xAxisData": ["Experiment 1", "Experiment 2", "Experiment 3"],
"title": "Statistical Distribution"
}
}Key Props:
data:[[min, Q1, median, Q3, max], ...]or[{ value: [...], name? }, ...]xAxisData: Category labels for each boxboxStyle: Custom box appearance withcolor,borderColor,borderWidth
All charts support these common properties:
| Prop | Type | Default | Description |
|---|---|---|---|
width |
number | string |
"100%" |
Chart width |
height |
number | string |
400 |
Chart height |
| Prop | Type | Description |
|---|---|---|
title |
string |
Main title text |
titleSubtext |
string |
Subtitle text |
| Prop | Type | Default | Description |
|---|---|---|---|
showLegend |
boolean |
true (multi-series) |
Show/hide legend |
legendPosition |
"top" | "bottom" | "left" | "right" |
"top" |
Legend position |
| Prop | Type | Default | Description |
|---|---|---|---|
showTooltip |
boolean |
true |
Show/hide tooltip |
| Prop | Type | Description |
|---|---|---|
xAxisName |
string |
X-axis name |
yAxisName |
string |
Y-axis name |
showXAxis |
boolean |
Show X-axis |
showYAxis |
boolean |
Show Y-axis |
| Prop | Type | Default | Description |
|---|---|---|---|
animation |
boolean |
true |
Enable animations |
animationDuration |
number |
1000 |
Duration in ms |
All components support events:
{
"type": "LineChart",
"props": { "..." },
"on": {
"click": "handleChartClick",
"legendselectchanged": "handleLegendChange"
}
}Available events:
click: Triggered when clicking on data points (all charts)legendselectchanged: Triggered when toggling legend items (LineChart, PieChart, BarChart)
| Entry Point | Exports |
|---|---|
@json-render-plugins/echarts |
echartsComponents |
@json-render-plugins/echarts/catalog |
echartsComponentDefinitions, EChartsProps, ComponentDefinition, BindingsConfig, EmitFunction |
The /catalog entry point contains only Zod schemas (no React dependency), so it can be used in server-side code for prompt generation.
MIT