VChart/README.md

172 lines
6.7 KiB
Markdown
Raw Normal View History

2023-06-05 05:42:06 +00:00
<div align="center">
<a href="https://github.com/VisActor#gh-light-mode-only" target="_blank">
<img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/>
</a>
<a href="https://github.com/VisActor#gh-dark-mode-only" target="_blank">
<img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_dark.svg"/>
2023-06-05 05:42:06 +00:00
</a>
</div>
<div align="center">
<h1>VChart</h1>
</div>
<div align="center">
VChart, more than just a cross-platform charting library, but also an expressive data storyteller.
<p align="center">
2023-07-19 08:16:11 +00:00
<a href="https://www.visactor.io/vchart">Introduction</a>
<a href="https://www.visactor.io/vchart/example">Demo</a>
<a href="https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Website_Guide">Tutorial</a>
<a href="https://www.visactor.io/vchart/option/barChart">API</a>
<a href="https://www.visactor.io/vchart/guide/tutorial_docs/cross-terminal_and_developer_ecology/node">Cross-Platform</a>
2023-06-05 05:42:06 +00:00
</p>
2023-06-20 04:54:34 +00:00
![](https://github.com/visactor/vchart/actions/workflows/bug-server.yml/badge.svg)
![](https://github.com/visactor/vchart/actions/workflows/unit-test.yml/badge.svg)
2023-06-05 05:42:06 +00:00
[![npm Version](https://img.shields.io/npm/v/@visactor/vchart.svg)](https://www.npmjs.com/package/@visactor/vchart)
[![npm Download](https://img.shields.io/npm/dm/@visactor/vchart.svg)](https://www.npmjs.com/package/@visactor/vchart)
2023-06-20 04:54:34 +00:00
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/VisActor/VChart/blob/main/CONTRIBUTING.md#your-first-pull-request)
![](https://img.shields.io/badge/language-TypeScript-red.svg) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/visactor/vchart/blob/main/LICENSE)
2023-06-05 05:42:06 +00:00
</div>
<div align="center">
English| [简体中文](./README.zh-CN.md)
</div>
<div align="center">
video
</div>
2023-06-20 04:54:34 +00:00
## Introduction
2023-06-05 05:42:06 +00:00
VChart is a charting component library in VisActor visualization system. It wraps the charting logic based on visual grammar library [VGrammar](https://github.com/VisActor/VGrammar) and the component encapsulation based on visual rendering engine [VRender](https://github.com/VisActor/VRender). The core capabilities are as follows:
2023-06-20 04:54:34 +00:00
1. **Cross-platform**: Automatically adapt to desktop, H5, and multiple small program environments
2. **Storytelling**: Comprehensive annotation, animation, flow control, narrative templates, and other enhanced features for visual storytelling
3. **Scenes**: Deliver visual storytelling capabilities to end-users, unlock developer productivity
2023-06-05 05:42:06 +00:00
2023-07-19 08:16:11 +00:00
### Repository Introduction
2023-06-05 05:42:06 +00:00
This repository includes the following packages:
2023-06-20 04:54:34 +00:00
1. [`vchart`](./packages/vchart/): The core code repository of VChart
2. [`react-vchart`](./packages/react-vchart/): The VChart component encapsulated based on [React](https://react.dev/)
3. [`taro-vchart`](./packages/taro-vchart/): The VChart component encapsulated based on [Taro](https://docs.taro.zone/docs/)
4. [`lark-vchart`](./packages/lark-vchart/): The VChart component encapsulated based on [Lark miniAPP](https://open.feishu.cn/document/client-docs/gadget/introduction/host-environment)
5. [`tt-vchart`](./packages/lark-vchart/): The VChart component encapsulated based on [TikTok miniAPP](https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/introduction/overview/)
6. [`block-vchart`](./packages/block-vchart/): The VChart component encapsulated based on [Lark Block](https://open.feishu.cn/document/client-docs/block/block-introduction)
2023-09-13 11:11:26 +00:00
7. [`wx-vchart`](./packages/wx-vchart/)The VChart component encapsulated based on [Wx miniAPP](https://developers.weixin.qq.com/miniprogram/dev/framework/)
8. [`docs`](./docs/): VChart site source code, and also contains all Chinese and English documents, chart sample codes, etc. of the site.
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
## 🔨 Usage
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
### 📦 Installation
2023-06-05 05:42:06 +00:00
```bash
2023-06-20 04:54:34 +00:00
# npm
$ npm install @visactor/vchart
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
# yarn
$ yarn add @visactor/vchart
2023-06-05 05:42:06 +00:00
```
2023-06-20 04:54:34 +00:00
### 📊 A Chart Example
<img src="https://user-images.githubusercontent.com/135952300/246996854-95cf0db3-42a2-41f9-8f15-8b7bbec1794c.png" style="width: 500px">
```typescript
import VChart from '@visactor/vchart';
2023-06-05 05:42:06 +00:00
const spec = {
2023-06-20 04:54:34 +00:00
type: 'bar',
data: [
2023-06-05 05:42:06 +00:00
{
2023-06-20 04:54:34 +00:00
id: 'barData',
values: [
{ month: 'Monday', sales: 22 },
{ month: 'Tuesday', sales: 13 },
{ month: 'Wednesday', sales: 25 },
{ month: 'Thursday', sales: 29 },
{ month: 'Friday', sales: 38 }
]
2023-06-05 05:42:06 +00:00
}
],
2023-06-20 04:54:34 +00:00
xField: 'month',
yField: 'sales',
crosshair: {
xField: { visible: true }
}
2023-06-05 05:42:06 +00:00
};
2023-06-20 04:54:34 +00:00
// 'chart' is the id of your dom container, such as <div id="chart"></chart>
const vchart = new VChart(spec, { dom: 'chart' });
vchart.renderAsync();
2023-06-05 05:42:06 +00:00
```
2023-06-20 04:54:34 +00:00
## ⌨️ Development
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
First of all, please install [@microsoft/rush](https://rushjs.io/pages/intro/get_started/)
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
```bash
$ npm i --global @microsoft/rush
```
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
Then clone locally:
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
```bash
# clone
$ git clone git@github.com:VisActor/VChart.git
$ cd VChart
# install dependencies
$ rush update
# start vchart development server
$ rush start
# start react-vchart development server
$ rush react
2023-08-31 10:57:37 +00:00
# start site development server
$ rush docs
2023-06-20 04:54:34 +00:00
```
2023-06-05 05:42:06 +00:00
2023-08-28 08:53:52 +00:00
## 📖 Documents
After installation & clone & update, run docs to preview documents locally.
```bash
# start vchart document server
$ rush docs
```
2023-06-20 04:54:34 +00:00
## 🔗 Related Links
2023-06-05 05:42:06 +00:00
2023-07-14 09:41:50 +00:00
- [Homepage](https://www.visactor.io/vchart)
- [VCharts Gallery](https://www.visactor.io/vchart/example)
- [VChart Tutorials](https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Website_Guide)
- [VChart Options](https://www.visactor.io/vchart/option/)
- [VChart API](https://www.visactor.io/vchart/api/API/vchart)
- [VGrammar](https://www.visactor.io/vgrammar)
- [VRender](https://www.visactor.io/vrender)
- [FAQ](https://www.visactor.io/vchart/guide/tutorial_docs/FAQ)
2023-06-20 09:03:34 +00:00
- [CodeSandbox Template](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww?file=/src/index.ts) for bug reports
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
## 💫 Ecosystem
2023-06-05 05:42:06 +00:00
| Project | Description |
| ------------------------------------------------------------------------------------- | ------------------------------------ |
| [React-VChart](https://github.com/VisActor/VChart/tree/develop/packages/react-vchart) | React interface for @VisActor/VChart |
2023-06-20 04:54:34 +00:00
## 🤝 Contribution [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/VisActor/VChart/blob/main/CONTRIBUTING.md#your-first-pull-request)
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
If you would like to contribute, please read the [Code of Conduct](./CODE_OF_CONDUCT.md) and our [contributing guide](./CONTRIBUTING.md) first。
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
Small streams converge to make great rivers and seas!
2023-06-05 05:42:06 +00:00
2023-06-20 04:54:34 +00:00
<a href="https://github.com/visactor/vchart/graphs/contributors"><img src="https://contrib.rocks/image?repo=visactor/vchart" /></a>