echarts 的使用
一、echarts 介绍
二、echarts 使用
3.1 echarts 安装
npm install echarts
# 或者
yarn add echarts
3.2 初始化
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
import { init } from "echarts";
// 若要使用主题则需要单独引入主题,下载macarons.js
import "./macarons";
function PieExample() {
// 获取图标的dom
const container = document.getElementById("pie");
// 初始化,"macarons"为引入主题,可不写
const myChart = init(container, "macarons");
// 获取自定义的配置项
const options = getPieOptions();
// 设置配置项
myChart.setOption(options);
}