An open API service indexing awesome lists of open source software.

https://github.com/gsmlg-dev/echarts-el

A html custom element render echarts
https://github.com/gsmlg-dev/echarts-el

echarts lit lit-html

Last synced: 5 months ago
JSON representation

A html custom element render echarts

Awesome Lists containing this project

README

          

# Echarts EL

[![nodejs-lit-validate-and-release](https://github.com/gsmlg-dev/echarts-el/actions/workflows/nodejs-lit-validate-and-release.yml/badge.svg)](https://github.com/gsmlg-dev/echarts-el/actions/workflows/nodejs-lit-validate-and-release.yml)

[![Storybook](https://cdn.jsdelivr.net/gh/storybookjs/brand@main/badge/badge-storybook.svg)](https://gsmlg-dev.github.io/echarts-el)

# Feature

- Auto fit parent element, so your do not need to resize it.
- Rerender if data changed.

# Install

```bash
npm install echarts-el
```

Or import in the fly.

```html

import "https://unpkg.com/echarts-el@1.1.0/es/chart.js";

---

import "https://cdn.jsdelivr.net/npm/echarts-el@1.1.0/es/chart.js";

```

# Use Case

This element will fit parent element and auto resize when parent element size change.

```html

{
tooltip: {
show: true,
},
grid: {
x: 0,
y: 0,
x2: 0,
y2: 0,
},
xAxis: [
{
min: 0,
scale: true,
type: 'value',
},
],
yAxis: [
{
type: 'category',
show: false,
data: ['2021-01', '2021-02', '2021-03', '2021-04', '2021-05', '2021-06'],
},
],
series: [
{
type: 'bar',
data: [2123, 3354, 4012, 2175, 5800, 2630],
},
],
}

```

Render chart:
![bar-chart](./bar-chart.jpg)

# Attrinutes

- `loading`: Show Loading chart
- `renderer`: Use echarts `svg` or `canvas` renderer
- `textContent`: EChart options, JSON string.

# Properties

- `resetChart`: Method to reset chart render
- `chart`: Echart instance
- `options`: Chart render options, readonly.

# TODO

- Add map register element.