# @wines/echarts

> The echarts @wines

Latest version **2.0.0** (published 2025-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wines/echarts
pnpm add @wines/echarts
yarn add @wines/echarts
bun add @wines/echarts
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-04-01 |
| First published | 2021-12-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=16.0.0 |
| Dependencies | 2 |
| Unpacked size | 2.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tianyingchun |

## Links

- npm: https://www.npmjs.com/package/@wines/echarts
- Repository: https://gitlab.itcjf.com/wines/echarts
- npm.io page: https://npm.io/package/@wines/echarts

## Dependencies (2)

- [@wines/core](https://npm.io/package/@wines/core.md) 2.0.0
- [@wines/styles](https://npm.io/package/@wines/styles.md) 2.0.0

## Recent versions

- 2.0.0 (latest) — 2025-04-01
- 2.0.0-next.7 (next) — 2025-04-01
- 2.0.0-next.6 — 2025-03-06
- 2.0.0-next.5 — 2025-03-05
- 2.0.0-next.4 — 2025-03-05
- 2.0.0-next.3 — 2025-03-04
- 2.0.0-next.2 — 2025-02-28
- 2.0.0-next.1 — 2025-02-27
- 2.0.0-next.0 — 2025-02-27
- 1.5.1 — 2023-03-07
- 1.5.0 — 2022-11-22
- 1.4.0 — 2022-02-23
- 1.3.6 — 2021-12-03
- 1.3.5 — 2021-12-03

## README

# `@wines/echarts`

# Echarts 图表

Echarts

## 使用指南

### 在 page.json 中引入组件

```json
{
  "navigationBarTitleText": "Echarts",
  "usingComponents": {
    "wux-avatar": "@wines/echarts"
  }
}
```

### 示例

```xml
<view class="page">
	<view class="page__hd">
		<view class="page__title">Echarts</view>
		<view class="page__desc">图表</view>
	</view>
	<view class="page__bd">
		<wux-echarts
		 id="mychart-dom-line"
		 height="200px"
		 width="100%"
		 canvas-id="mychart-line"
		 ec="{{ ec }}"
		></wux-echarts>
	</view>
</view>

```

```ts
import { wineEcharts as echarts } from '@wines/echarts';
import './index.less';

function initChart(canvas, width, height) {
  const chart = echarts.init(canvas, null, {
    width: width,
    height: height,
  });
  canvas.setChart(chart);

  const option = {
    tooltip: {
      trigger: 'axis',
    },
    grid: {
      top: 10,
      right: 10,
      bottom: 10,
      left: 20,
      containLabel: true,
    },
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
      axisTick: {
        alignWithLabel: true,
      },
    },
    yAxis: {
      type: 'value',
      axisLabel: {
        formatter: '{value}%',
      },
    },
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        type: 'line',
      },
    ],
  };
  chart.setOption(option);
  return chart;
}

Page({
  data: {
    ec: {
      onInit: initChart,
    },
  },

  onClick(e) {
    console.log('onClick', e.detail);
    if (e.detail.index === 3) {
      void wx.switchTab({
        url: '/pages/index/index',
      });
    }
  },
  onContact(e) {
    console.log('onContact', e);
  },
  onGotUserInfo(e) {
    console.log('onGotUserInfo', e);
  },
  onGotPhoneNumber(e) {
    console.log('onGotPhoneNumber', e);
  },
  onChange(e) {
    console.log('onChange', e);
  },
});
```

## API

### Avatar props

| 参数   | 类型     | 描述     | 默认值 |
| ------ | -------- | -------- | ------ |
| height | `string` | 图表高度 | 100px  |
| width  | `string` | 图表宽度 | 100%   |

### Avatar slot

| 名称 | 描述       |
| ---- | ---------- |
| -    | 自定义内容 |

### Avatar externalClasses

| 名称      | 描述         |
| --------- | ------------ |
| wux-class | 根节点样式类 |

---
_Source: https://npm.io/package/@wines/echarts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
