复制代码//安装 Frappe Charts
$ npm install frappe-charts
//在项目中引入并初始化
import { Chart } from "frappe-charts"
const data = {
labels: ["周一", "周二", "周三", "周四","周五", "周六", "周日"],
datasets: [
{
name: "用户注册数", chartType: "bar",
values: [250, 400, 300, 350, 800, 520, 170]
},
{
name: "订单量", chartType: "line",
values: [2500, 5000, 3100, 1589, 1823, 3245, 2787]
}
]
}
// 支持选择器或直接传入 DOM element 对象
const chart = new Chart("#chart", {
title: "图表名称",
data: data,
type: 'axis-mixed', // 指定图表类型为混合型
height: 250,
colors: ['#7cd6fd', '#743ee2'] // 定义图例颜色
})