Merge pull request #5 from VisActor/refactor/univer-2.x Refactor/univer 2.x
Merge pull request #5 from VisActor/refactor/univer-2.x
Refactor/univer 2.x
The vchart univer plugin encapsulates the capability to create chart overlays within Univer.
English | 简体中文
VChart is a chart component library within the VisActor visualization system. Univer is an open-source Office suite. Using the univer-vchart-plugin, you can easily create chart overlays.
# npm $ npm install @visactor/univer-vchart-plugin # pnpm $ pnpm add @visactor/univer-vchart-plugin
import { UniverVChartPlugin, CREATE_VCHART_COMMAND_ID, } from "@visactor/univer-vchart-plugin"; export function setupUniver() { const univer = new Univer({ theme: defaultTheme, locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: enUS, }, }); univer.registerPlugin(UniverVChartPlugin); } export function setupVChartDemo($toolbar: HTMLElement, univerAPI: FUniver) { const $button = document.createElement("a"); $button.textContent = "Create vchart demo"; $toolbar.appendChild($button); $button.addEventListener("click", async () => { if (!univerAPI) throw new Error("univerAPI is not defined"); const activeWorkbook = univerAPI.getActiveWorkbook(); if (!activeWorkbook) throw new Error("activeWorkbook is not defined"); const activeSheet = activeWorkbook.getActiveSheet(); if (!activeSheet) throw new Error("activeSheet is not defined"); await univerAPI.executeCommand(CREATE_VCHART_COMMAND_ID, { spec: { type: "line", data: { values: [ { time: "2:00", value: 8, }, { time: "4:00", value: 9, }, { time: "6:00", value: 11, }, { time: "8:00", value: 14, }, { time: "10:00", value: 16, }, { time: "12:00", value: 17, }, { time: "14:00", value: 17, }, { time: "16:00", value: 16, }, { time: "18:00", value: 15, }, ], }, xField: "time", yField: "value", }, }); }); }
If you would like to contribute, please read the Code of Conduct and the Contribution Guide first.
Small streams make big rivers!
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
univer-vchart-plugin
The vchart univer plugin encapsulates the capability to create chart overlays within Univer.
English | 简体中文
Introduction
VChart is a chart component library within the VisActor visualization system. Univer is an open-source Office suite. Using the univer-vchart-plugin, you can easily create chart overlays.
🔨 Usage
📦 Installation
📊 A Simple Chart
🔗 Related Links
🤝 Contributing
If you would like to contribute, please read the Code of Conduct and the Contribution Guide first.
Small streams make big rivers!