Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koishi-plugin-echarts

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koishi-plugin-echarts

Provide echarts with Canvas in Koishi

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44
increased by29.41%
Maintainers
1
Weekly downloads
 
Created
Source

koishi-plugin-echarts

npm

为 Koishi 提供 Echart,

学习 Options | Echarts 官网实例 | 主题相关

使用指南

package.json
....
  "peerDependencies": {
    "koishi": "^4.14.0",
    "koishi-plugin-echarts": "^最新版"
  }
....
// 务必 import,所有服务都要这样
import {} from "koishi-plugin-echarts"

...
// 具体代码实例,仅供参考
const option = {
  legend: {},
  tooltip: {},
  dataset: {
    // 提供一份数据。
    source: [
      ['product', '2015', '2016', '2017'],
      ['Matcha Latte', 43.3, 85.8, 93.7],
      ['Milk Tea', 83.1, 73.4, 55.1],
      ['Cheese Cocoa', 86.4, 65.2, 82.5],
      ['Walnut Brownie', 72.4, 53.9, 39.1]
    ]
  },
  // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。
  xAxis: { type: 'category' },
  // 声明一个 Y 轴,数值轴。
  yAxis: {},
  // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。
  series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
};

const chart = ctx.echarts.createChart(1000, 700, option)
const buffer = chart.canvas.toBuffer("image/png")
chart.dispose() // 除非你还想用否则务必销毁实例
return h.image(buffer, "image/png");

Keywords

FAQs

Package last updated on 23 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc