vislite 1.12.0-alpha.1 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/AUTHORS.txt +6 -6
  2. package/CHANGELOG +402 -401
  3. package/LICENSE +20 -20
  4. package/README-en.md +245 -245
  5. package/README.md +245 -245
  6. package/bin/formatArgv.js +30 -30
  7. package/bin/help.js +17 -17
  8. package/bin/run +21 -21
  9. package/bin/skills.js +26 -26
  10. package/lib/BarLayout/index.es.js +348 -348
  11. package/lib/Buffer/index.es.js +34 -34
  12. package/lib/Canvas/index.es.js +804 -789
  13. package/lib/Canvas/index.es.min.js +1 -1
  14. package/lib/Cardinal/index.es.js +89 -89
  15. package/lib/Eoap/index.es.js +32 -32
  16. package/lib/Hermite/index.es.js +34 -34
  17. package/lib/MapCoordinate/index.es.js +199 -199
  18. package/lib/Matrix4/index.es.js +123 -123
  19. package/lib/Mercator/index.es.js +18 -18
  20. package/lib/PieLayout/index.es.js +115 -115
  21. package/lib/RawCanvas/index.es.js +736 -721
  22. package/lib/RawCanvas/index.es.min.js +1 -1
  23. package/lib/SVG/index.es.js +626 -626
  24. package/lib/Shader/index.es.js +34 -34
  25. package/lib/Texture/index.es.js +52 -52
  26. package/lib/TreeLayout/index.es.js +301 -301
  27. package/lib/animation/index.es.js +2 -2
  28. package/lib/assemble/index.es.js +19 -19
  29. package/lib/getLoopColors/index.es.js +34 -34
  30. package/lib/getWebGLContext/index.es.js +61 -61
  31. package/lib/index.umd.js +2797 -2782
  32. package/lib/index.umd.min.js +2 -2
  33. package/lib/initOption/index.es.js +5 -5
  34. package/lib/mergeOption/index.es.js +34 -34
  35. package/lib/move/index.es.js +6 -6
  36. package/lib/rotate/index.es.js +6 -6
  37. package/lib/ruler/index.es.js +136 -136
  38. package/lib/scale/index.es.js +5 -5
  39. package/minialipay/ui-canvas/drawImage.js +35 -35
  40. package/minialipay/ui-canvas/index.acss +4 -4
  41. package/minialipay/ui-canvas/index.axml +3 -3
  42. package/minialipay/ui-canvas/index.d.ts +1 -1
  43. package/minialipay/ui-canvas/index.js +100 -100
  44. package/minialipay/ui-canvas/index.json +6 -6
  45. package/miniprogram/ui-canvas/drawImage.js +35 -35
  46. package/miniprogram/ui-canvas/index.js +125 -125
  47. package/miniprogram/ui-canvas/index.json +4 -4
  48. package/miniprogram/ui-canvas/index.wxml +4 -4
  49. package/miniprogram/ui-canvas/index.wxss +5 -5
  50. package/package/BarLayout/index.ts +2 -2
  51. package/package/Buffer/index.ts +2 -2
  52. package/package/Canvas/index.ts +2 -2
  53. package/package/Cardinal/index.ts +2 -2
  54. package/package/Eoap/index.ts +2 -2
  55. package/package/Hermite/index.ts +2 -2
  56. package/package/MapCoordinate/index.ts +2 -2
  57. package/package/Matrix4/index.ts +2 -2
  58. package/package/Mercator/index.ts +2 -2
  59. package/package/PieLayout/index.ts +2 -2
  60. package/package/RawCanvas/index.ts +2 -2
  61. package/package/SVG/index.ts +2 -2
  62. package/package/Shader/index.ts +2 -2
  63. package/package/Texture/index.ts +2 -2
  64. package/package/TreeLayout/index.ts +2 -2
  65. package/package/animation/index.ts +5 -5
  66. package/package/assemble/index.ts +2 -2
  67. package/package/getLoopColors/index.ts +2 -2
  68. package/package/getWebGLContext/index.ts +40 -40
  69. package/package/index.ts +84 -84
  70. package/package/initOption/index.ts +2 -2
  71. package/package/mergeOption/index.ts +2 -2
  72. package/package/move/index.ts +2 -2
  73. package/package/rotate/index.ts +2 -2
  74. package/package/ruler/index.ts +2 -2
  75. package/package/scale/index.ts +2 -2
  76. package/package/throttle/index.ts +2 -2
  77. package/package.json +79 -79
  78. package/skills/vislite-lib/BarLayout.md +117 -117
  79. package/skills/vislite-lib/Canvas.md +183 -183
  80. package/skills/vislite-lib/Interpolation.md +129 -129
  81. package/skills/vislite-lib/Matrix.md +174 -174
  82. package/skills/vislite-lib/PieLayout.md +131 -131
  83. package/skills/vislite-lib/Projections.md +158 -158
  84. package/skills/vislite-lib/SKILL.md +179 -179
  85. package/skills/vislite-lib/SVG.md +137 -137
  86. package/skills/vislite-lib/TreeLayout.md +176 -176
  87. package/skills/vislite-lib/Utilities.md +261 -261
  88. package/skills/vislite-lib/WebGL.md +106 -106
  89. package/skills/vislite-lib/minialipay/ui-canvas.md +95 -95
  90. package/skills/vislite-lib/miniprogram/ui-canvas.md +98 -98
  91. package/skills/vislite-lib/uniapp/ui-canvas.md +113 -113
  92. package/src/Canvas.ts +89 -89
  93. package/src/Eoap.ts +66 -66
  94. package/src/Matrix4/index.ts +84 -84
  95. package/src/Matrix4/move.ts +12 -12
  96. package/src/Matrix4/rotate.ts +15 -15
  97. package/src/Matrix4/scale.ts +11 -11
  98. package/src/Matrix4/transform.ts +64 -64
  99. package/src/Mercator.ts +27 -27
  100. package/src/SVG.ts +86 -86
  101. package/src/common/assemble.ts +30 -30
  102. package/src/common/canvas/arc.ts +51 -51
  103. package/src/common/canvas/config.ts +176 -176
  104. package/src/common/canvas/default.ts +64 -64
  105. package/src/common/canvas/gradient.ts +31 -31
  106. package/src/common/canvas/index.ts +189 -189
  107. package/src/common/canvas/painter.ts +475 -454
  108. package/src/common/canvas/texts.ts +18 -18
  109. package/src/common/map/getBoundary.ts +15 -15
  110. package/src/common/map/tool.ts +29 -29
  111. package/src/common/option.ts +31 -31
  112. package/src/common/setStyle.ts +5 -5
  113. package/src/common/svg/config.ts +213 -213
  114. package/src/common/svg/default.ts +29 -29
  115. package/src/common/svg/gradient.ts +53 -53
  116. package/src/common/svg/index.ts +420 -420
  117. package/src/common/svg/tool.ts +51 -51
  118. package/src/common/tree/index.ts +25 -25
  119. package/src/common/tree/toInnerTree.ts +61 -61
  120. package/src/common/tree/toPlainTree.ts +135 -135
  121. package/src/common/type.ts +26 -26
  122. package/src/common/webgl/buffer.ts +79 -79
  123. package/src/common/webgl/getWebGLContext.ts +45 -45
  124. package/src/common/webgl/shader.ts +75 -75
  125. package/src/common/webgl/texture.ts +98 -98
  126. package/src/coordinate/MapCoordinate.ts +80 -80
  127. package/src/getLoopColors.ts +42 -42
  128. package/src/interpolation/Cardinal.ts +110 -110
  129. package/src/interpolation/Hermite.ts +65 -65
  130. package/src/layout/BarLayout.ts +249 -249
  131. package/src/layout/PieLayout.ts +146 -146
  132. package/src/layout/TreeLayout.ts +200 -200
  133. package/src/move.ts +7 -7
  134. package/src/rotate.ts +7 -7
  135. package/src/ruler.ts +209 -209
  136. package/src/scale.ts +6 -6
  137. package/types/Bar.d.ts +91 -91
  138. package/types/BarConfig.d.ts +4 -4
  139. package/types/BarLayout.d.ts +48 -48
  140. package/types/BarOption.d.ts +31 -31
  141. package/types/Buffer.d.ts +30 -30
  142. package/types/Canvas.d.ts +379 -379
  143. package/types/CanvasConfig.d.ts +61 -61
  144. package/types/CanvasOption.d.ts +13 -13
  145. package/types/CanvasOpts.d.ts +9 -9
  146. package/types/Cardinal.d.ts +20 -20
  147. package/types/Gradient.d.ts +20 -20
  148. package/types/Hermite.d.ts +25 -25
  149. package/types/Map.d.ts +9 -9
  150. package/types/MapConfig.d.ts +27 -27
  151. package/types/MapCoordinate.d.ts +22 -22
  152. package/types/Matrix4.d.ts +79 -79
  153. package/types/Pie.d.ts +73 -73
  154. package/types/PieConfig.d.ts +26 -26
  155. package/types/PieLayout.d.ts +40 -40
  156. package/types/PieOption.d.ts +21 -21
  157. package/types/SVG.d.ts +282 -282
  158. package/types/SVGConfig.d.ts +54 -54
  159. package/types/Shader.d.ts +22 -22
  160. package/types/Texture.d.ts +22 -22
  161. package/types/Tree.d.ts +74 -74
  162. package/types/TreeConfig.d.ts +52 -52
  163. package/types/TreeLayout.d.ts +71 -71
  164. package/types/TreeOption.d.ts +48 -48
  165. package/types/animation.d.ts +26 -26
  166. package/types/assemble.d.ts +14 -14
  167. package/types/getLoopColors.d.ts +13 -13
  168. package/types/getWebGLContext.d.ts +7 -7
  169. package/types/index.d.ts +220 -221
  170. package/types/module.d.ts +110 -110
  171. package/types/move.d.ts +15 -15
  172. package/types/option.d.ts +12 -12
  173. package/types/painterConfig.d.ts +14 -14
  174. package/types/rotate.d.ts +15 -15
  175. package/types/ruler.d.ts +24 -24
  176. package/types/scale.d.ts +15 -15
  177. package/types/throttle.d.ts +6 -6
  178. package/types/ui-canvas.d.ts +4 -4
  179. package/types/uni-canvas.d.ts +3 -3
  180. package/uni-app/drawImage.js +19 -19
  181. package/uni-app/ui-canvas.vue +295 -295
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) zxl20070701 走一步,再走一步
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) zxl20070701 走一步,再走一步
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README-en.md CHANGED
@@ -1,245 +1,245 @@
1
- **English** · [中文](./README.md) · [📖 Online Docs](https://oi-contrib.github.io/VISLite)
2
-
3
- - 💘 Open source is not easy, please <i>[Give a Star on Github](https://github.com/oi-contrib/VISLite) </i>!
4
-
5
- <img src='https://oi-contrib.github.io/VISLite/images/logo.png' height='300px'/>
6
-
7
- <p>
8
- <a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=vislite&interval=7">
9
- <img src="https://img.shields.io/npm/dm/vislite.svg" alt="downloads">
10
- </a>
11
- <a href="https://www.npmjs.com/package/vislite">
12
- <img src="https://img.shields.io/npm/v/vislite.svg" alt="npm">
13
- </a>
14
- <a href="https://www.jsdelivr.com/package/npm/vislite">
15
- <img src="https://data.jsdelivr.com/v1/package/npm/vislite/badge" alt="cdn">
16
- </a>
17
- <a href="https://github.com/oi-contrib/VISLite/issues">
18
- <img src="https://img.shields.io/github/issues/oi-contrib/VISLite" alt="issue">
19
- </a>
20
- <a href="https://github.com/oi-contrib/VISLite" target='_blank'>
21
- <img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/VISLite">
22
- </a>
23
- <a href="https://github.com/oi-contrib/VISLite">
24
- <img src="https://img.shields.io/github/forks/oi-contrib/VISLite" alt="forks">
25
- </a>
26
- <a href="https://gitee.com/oi-contrib/VISLite" target='_blank'>
27
- <img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/VISLite/badge/star.svg">
28
- </a>
29
- <a href="https://gitee.com/oi-contrib/VISLite">
30
- <img src="https://gitee.com/oi-contrib/VISLite/badge/fork.svg" alt="forks">
31
- </a>
32
- </p>
33
-
34
- <img src="https://nodei.co/npm/vislite.png?downloads=true&amp;downloadRank=true&amp;stars=true" alt="NPM">
35
-
36
- # VISLite
37
-
38
- 🚀 A lightweight and elegant cross-platform data visualization solution
39
-
40
- `VISLite` is a high-performance visualization library built with `TypeScript`. Official website: [https://oi-contrib.github.io/VISLite](https://oi-contrib.github.io/VISLite)
41
-
42
- It provides unified cross-platform canvas drawing and computing capabilities, allowing developers to focus on business logic and easily implement visualization applications across Web, uni-app, WeChat Mini Program, Alipay Mini Program and other platforms. Except for minor platform differences in initialization configuration, the core business code is completely universal.
43
-
44
- ## Introduction
45
-
46
- 🎯 Lightweight data visualization development library —— Help you build visualization products faster, simpler and more efficiently.
47
-
48
- > This project has been open sourced on [Open Source China](https://www.oschina.net/p/vislite), welcome to follow and leave comments.
49
-
50
- ## Quick Start
51
-
52
- ### 📦 Installation
53
-
54
- ```bash
55
- npm install --save vislite
56
- ```
57
-
58
- ### 🖼️ Prepare Canvas
59
-
60
- ```html
61
- <div id="root" style="width:500px;height:300px;"></div>
62
- ```
63
-
64
- ### 🎨 Start Drawing
65
-
66
- Get the painter to draw any content you need. For example, get the Canvas painter to draw a red circle:
67
-
68
- ```js
69
- import { Canvas } from 'vislite';
70
-
71
- var painter = new Canvas(document.getElementById('root'));
72
-
73
- painter.config({
74
- fillStyle: "red"
75
- }).fillCircle(200, 150, 100);
76
- ```
77
-
78
- More complex charts? We provide rich auxiliary APIs. Take tree layout as an example, you can draw a tree diagram in just a few steps:
79
-
80
- <img src="https://oi-contrib.github.io/VISLite/images/docs/tree.png" width="500"/>
81
-
82
- ```js
83
- import { Canvas, TreeLayout } from 'vislite';
84
-
85
- var painter = new Canvas(document.getElementById('root'));
86
- var treeLayout = new TreeLayout();
87
-
88
- treeLayout.setOption({
89
- type: "rect",
90
- direction: "TB",
91
- x: 250,
92
- y: 20,
93
- width: 500,
94
- height: 260
95
- });
96
-
97
- var data = {
98
- "name": "Frontend",
99
- "children": [{
100
- "name": "Basic",
101
- "children": [{
102
- "name": "HTML"
103
- }, {
104
- "name": "CSS"
105
- }, {
106
- "name": "JavaScript"
107
- }, {
108
- "name": "DOM"
109
- }]
110
- }, {
111
- "name": "Framework"
112
- }, {
113
- "name": "Techniques"
114
- }]
115
- };
116
-
117
- var tree = treeLayout.use(data);
118
-
119
- // Draw connections
120
- painter.config({
121
- strokeStyle: 'red'
122
- });
123
- for (var key in tree.node) {
124
- var pid = tree.node[key].pid;
125
-
126
- if (pid) {
127
- var dist = (tree.node[key].top - tree.node[pid].top) * 0.5;
128
-
129
- painter
130
- .beginPath()
131
- .moveTo(tree.node[key].left, tree.node[key].top)
132
- .bezierCurveTo(
133
- tree.node[key].left, tree.node[key].top - dist,
134
- tree.node[pid].left, tree.node[pid].top + dist,
135
- tree.node[pid].left, tree.node[pid].top
136
- ).stroke();
137
- }
138
- }
139
-
140
- // Draw nodes and text
141
- painter.config({
142
- strokeStyle: 'red',
143
- fontSize: 12
144
- });
145
- for (var key in tree.node) {
146
- painter.config({
147
- fillStyle: "white"
148
- }).fullCircle(tree.node[key].left, tree.node[key].top, 10);
149
-
150
- painter.config({
151
- fillStyle: "black"
152
- }).fillText(key, tree.node[key].left + 15, tree.node[key].top);
153
- }
154
- ```
155
-
156
- For detailed usage of tree layout, please refer to: [《Tutorial / Tree Layout》](https://oi-contrib.github.io/VISLite/#/course/tree-layout)
157
-
158
- ## Core Features
159
-
160
- ### 🧮 Visualization Algorithm Library
161
-
162
- We have encapsulated commonly used algorithms in visualization development to help you easily draw complex charts. Through simple configuration, you can convert any format of data into drawing data with coordinates:
163
-
164
- <img src="https://oi-contrib.github.io/VISLite/images/docs/what_1.png" width="400"/>
165
-
166
- > Demo: [Left-to-right Tree Diagram](https://oi-contrib.github.io/VISLite/#/example/canvas/tree-layout-lr)
167
-
168
- In addition to [Tree Layout](https://oi-contrib.github.io/VISLite/#/api/treeLayout), we also provide: [Ruler Algorithm](https://oi-contrib.github.io/VISLite/#/api/ruler), [Equirectangular Oblique Azimuthal Projection](https://oi-contrib.github.io/VISLite/#/api/eoap), [Mercator Projection](https://oi-contrib.github.io/VISLite/#/api/mercator), [Interpolation Function](https://oi-contrib.github.io/VISLite/#/api/cardinal), [Transformation Matrix](https://oi-contrib.github.io/VISLite/#/api/matrix4), etc.
169
-
170
- ### 🖌️ Enhanced Painter
171
-
172
- The painter has been carefully designed to be simpler to use and more powerful. Taking Canvas as an example, we abstract the concept of "region", so that no matter how irregular the shape is, you can easily implement interactions:
173
-
174
- <img src="https://oi-contrib.github.io/VISLite/images/docs/what_2.png" width="400"/>
175
-
176
- > Demo: [China Map](https://oi-contrib.github.io/VISLite/#/example/canvas/china)
177
-
178
- The painter not only designs regions for interaction, but also elegantly encapsulates native APIs with more user-friendly and intuitive interfaces (e.g., WebGL makes 3D development zero-threshold, SVG eliminates the need to memorize obscure attributes). It also automatically eliminates browser compatibility differences.
179
-
180
- ### 📱 Cross-platform Support
181
-
182
- In addition to Web, it also supports uni-app, WeChat Mini Program, Alipay Mini Program and other platforms with unified APIs, greatly improving code reuse:
183
-
184
- <img src="https://oi-contrib.github.io/VISLite/images/docs/what_3.png" width="600"/>
185
-
186
- > Demo: [Money Wave Ball](https://oi-contrib.github.io/VISLite/#/example/svg/money-schedule)
187
-
188
- Currently `Canvas` supports: Web, native WeChat Mini Program, native Alipay Mini Program, uni-app (compiled to H5, WeChat Mini Program, Alipay Mini Program, etc.). We will continue to expand more platforms and painter types in the future.
189
-
190
- ## Core Advantages
191
-
192
- - **Flexible import methods**: Supports ES Module / CommonJS import after npm installation, as well as script tag CDN method
193
- - **On-demand loading**: TS source import, on-demand JS import or full import, multiple modes to choose from
194
- - **Simplicity and power coexist**: Provides basic visualization components that can be freely combined, and also supports encapsulation solutions for common scenarios
195
- - **Stable and reliable**: Fully backward compatible within the same major version (except alpha and beta versions), always keep the latest version as the best choice
196
-
197
- > Version specification: alpha (development version) → beta (testing version) → rc (release candidate) → next (pre-release version) → official release
198
-
199
- ## Feedback
200
-
201
- We are committed to continuously improving visualization functions and look forward to your valuable suggestions! Welcome to communicate with us through [Issues](https://github.com/oi-contrib/VISLite/issues).
202
-
203
- All suggestions will be responded to within one week.
204
-
205
- ## Changelog
206
-
207
- See [CHANGELOG](./CHANGELOG) for details, updated after each official version release.
208
-
209
- ## Roadmap
210
-
211
- Recent work focus:
212
-
213
- - Provide commonly used coordinate systems and layout components to accelerate development
214
- - Continuously optimize documentation (improve readability, enrich examples, improve tutorials)
215
-
216
- Want a feature? [Tell us](https://github.com/oi-contrib/VISLite/issues) and we'll prioritize it!
217
-
218
- ## Contribution Guide
219
-
220
- Welcome to participate in the project through the following ways:
221
-
222
- - **Code maintenance**: Handle new feature development and Bug fixes
223
- - **Documentation improvement**: Write and optimize interface documentation and tutorials
224
- - **Test cases**: Supplement test cases in the test directory and examples in the docs directory
225
- - **Direction discussion**: Participate in discussions on the future development of the project
226
-
227
- Interested in joining? Please contact us through [issue](https://github.com/oi-contrib/VISLite/issues), please briefly describe the situation, and we will reply as soon as possible.
228
-
229
- See [VISLite Contribution Guide](./.github/CONTRIBUTING.md) and [AUTHORS.txt](./AUTHORS.txt)
230
-
231
- ## Example Projects
232
-
233
- Examples developed based on VISLite and related plugins (such as [@vislite/canvas](https://github.com/oi-contrib/vislite-plugin-canvas), [@vislite/chart](https://github.com/oi-contrib/vislite-plugin-chart)):
234
-
235
- <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review1.png" style="width:700px;border:2px solid black;margin-bottom:20px;"/>
236
- <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review2.png" style="width:700px;border:2px solid black;margin-bottom:20px;"/>
237
- <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review3.png" style="width:300px;border:2px solid black;margin-bottom:20px;"/>
238
-
239
- For more examples, please visit: [VISLite Example Projects](https://rapid-start.github.io/VISLite-examples/index.html)
240
-
241
- ## License
242
-
243
- MIT License
244
-
245
- Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) Step By Step
1
+ **English** · [中文](./README.md) · [📖 Online Docs](https://oi-contrib.github.io/VISLite)
2
+
3
+ - 💘 Open source is not easy, please <i>[Give a Star on Github](https://github.com/oi-contrib/VISLite) </i>!
4
+
5
+ <img src='https://oi-contrib.github.io/VISLite/images/logo.png' height='300px'/>
6
+
7
+ <p>
8
+ <a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=vislite&interval=7">
9
+ <img src="https://img.shields.io/npm/dm/vislite.svg" alt="downloads">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/vislite">
12
+ <img src="https://img.shields.io/npm/v/vislite.svg" alt="npm">
13
+ </a>
14
+ <a href="https://www.jsdelivr.com/package/npm/vislite">
15
+ <img src="https://data.jsdelivr.com/v1/package/npm/vislite/badge" alt="cdn">
16
+ </a>
17
+ <a href="https://github.com/oi-contrib/VISLite/issues">
18
+ <img src="https://img.shields.io/github/issues/oi-contrib/VISLite" alt="issue">
19
+ </a>
20
+ <a href="https://github.com/oi-contrib/VISLite" target='_blank'>
21
+ <img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/VISLite">
22
+ </a>
23
+ <a href="https://github.com/oi-contrib/VISLite">
24
+ <img src="https://img.shields.io/github/forks/oi-contrib/VISLite" alt="forks">
25
+ </a>
26
+ <a href="https://gitee.com/oi-contrib/VISLite" target='_blank'>
27
+ <img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/VISLite/badge/star.svg">
28
+ </a>
29
+ <a href="https://gitee.com/oi-contrib/VISLite">
30
+ <img src="https://gitee.com/oi-contrib/VISLite/badge/fork.svg" alt="forks">
31
+ </a>
32
+ </p>
33
+
34
+ <img src="https://nodei.co/npm/vislite.png?downloads=true&amp;downloadRank=true&amp;stars=true" alt="NPM">
35
+
36
+ # VISLite
37
+
38
+ 🚀 A lightweight and elegant cross-platform data visualization solution
39
+
40
+ `VISLite` is a high-performance visualization library built with `TypeScript`. Official website: [https://oi-contrib.github.io/VISLite](https://oi-contrib.github.io/VISLite)
41
+
42
+ It provides unified cross-platform canvas drawing and computing capabilities, allowing developers to focus on business logic and easily implement visualization applications across Web, uni-app, WeChat Mini Program, Alipay Mini Program and other platforms. Except for minor platform differences in initialization configuration, the core business code is completely universal.
43
+
44
+ ## Introduction
45
+
46
+ 🎯 Lightweight data visualization development library —— Help you build visualization products faster, simpler and more efficiently.
47
+
48
+ > This project has been open sourced on [Open Source China](https://www.oschina.net/p/vislite), welcome to follow and leave comments.
49
+
50
+ ## Quick Start
51
+
52
+ ### 📦 Installation
53
+
54
+ ```bash
55
+ npm install --save vislite
56
+ ```
57
+
58
+ ### 🖼️ Prepare Canvas
59
+
60
+ ```html
61
+ <div id="root" style="width:500px;height:300px;"></div>
62
+ ```
63
+
64
+ ### 🎨 Start Drawing
65
+
66
+ Get the painter to draw any content you need. For example, get the Canvas painter to draw a red circle:
67
+
68
+ ```js
69
+ import { Canvas } from 'vislite';
70
+
71
+ var painter = new Canvas(document.getElementById('root'));
72
+
73
+ painter.config({
74
+ fillStyle: "red"
75
+ }).fillCircle(200, 150, 100);
76
+ ```
77
+
78
+ More complex charts? We provide rich auxiliary APIs. Take tree layout as an example, you can draw a tree diagram in just a few steps:
79
+
80
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/tree.png" width="500"/>
81
+
82
+ ```js
83
+ import { Canvas, TreeLayout } from 'vislite';
84
+
85
+ var painter = new Canvas(document.getElementById('root'));
86
+ var treeLayout = new TreeLayout();
87
+
88
+ treeLayout.setOption({
89
+ type: "rect",
90
+ direction: "TB",
91
+ x: 250,
92
+ y: 20,
93
+ width: 500,
94
+ height: 260
95
+ });
96
+
97
+ var data = {
98
+ "name": "Frontend",
99
+ "children": [{
100
+ "name": "Basic",
101
+ "children": [{
102
+ "name": "HTML"
103
+ }, {
104
+ "name": "CSS"
105
+ }, {
106
+ "name": "JavaScript"
107
+ }, {
108
+ "name": "DOM"
109
+ }]
110
+ }, {
111
+ "name": "Framework"
112
+ }, {
113
+ "name": "Techniques"
114
+ }]
115
+ };
116
+
117
+ var tree = treeLayout.use(data);
118
+
119
+ // Draw connections
120
+ painter.config({
121
+ strokeStyle: 'red'
122
+ });
123
+ for (var key in tree.node) {
124
+ var pid = tree.node[key].pid;
125
+
126
+ if (pid) {
127
+ var dist = (tree.node[key].top - tree.node[pid].top) * 0.5;
128
+
129
+ painter
130
+ .beginPath()
131
+ .moveTo(tree.node[key].left, tree.node[key].top)
132
+ .bezierCurveTo(
133
+ tree.node[key].left, tree.node[key].top - dist,
134
+ tree.node[pid].left, tree.node[pid].top + dist,
135
+ tree.node[pid].left, tree.node[pid].top
136
+ ).stroke();
137
+ }
138
+ }
139
+
140
+ // Draw nodes and text
141
+ painter.config({
142
+ strokeStyle: 'red',
143
+ fontSize: 12
144
+ });
145
+ for (var key in tree.node) {
146
+ painter.config({
147
+ fillStyle: "white"
148
+ }).fullCircle(tree.node[key].left, tree.node[key].top, 10);
149
+
150
+ painter.config({
151
+ fillStyle: "black"
152
+ }).fillText(key, tree.node[key].left + 15, tree.node[key].top);
153
+ }
154
+ ```
155
+
156
+ For detailed usage of tree layout, please refer to: [《Tutorial / Tree Layout》](https://oi-contrib.github.io/VISLite/#/course/tree-layout)
157
+
158
+ ## Core Features
159
+
160
+ ### 🧮 Visualization Algorithm Library
161
+
162
+ We have encapsulated commonly used algorithms in visualization development to help you easily draw complex charts. Through simple configuration, you can convert any format of data into drawing data with coordinates:
163
+
164
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/what_1.png" width="400"/>
165
+
166
+ > Demo: [Left-to-right Tree Diagram](https://oi-contrib.github.io/VISLite/#/example/canvas/tree-layout-lr)
167
+
168
+ In addition to [Tree Layout](https://oi-contrib.github.io/VISLite/#/api/treeLayout), we also provide: [Ruler Algorithm](https://oi-contrib.github.io/VISLite/#/api/ruler), [Equirectangular Oblique Azimuthal Projection](https://oi-contrib.github.io/VISLite/#/api/eoap), [Mercator Projection](https://oi-contrib.github.io/VISLite/#/api/mercator), [Interpolation Function](https://oi-contrib.github.io/VISLite/#/api/cardinal), [Transformation Matrix](https://oi-contrib.github.io/VISLite/#/api/matrix4), etc.
169
+
170
+ ### 🖌️ Enhanced Painter
171
+
172
+ The painter has been carefully designed to be simpler to use and more powerful. Taking Canvas as an example, we abstract the concept of "region", so that no matter how irregular the shape is, you can easily implement interactions:
173
+
174
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/what_2.png" width="400"/>
175
+
176
+ > Demo: [China Map](https://oi-contrib.github.io/VISLite/#/example/canvas/china)
177
+
178
+ The painter not only designs regions for interaction, but also elegantly encapsulates native APIs with more user-friendly and intuitive interfaces (e.g., WebGL makes 3D development zero-threshold, SVG eliminates the need to memorize obscure attributes). It also automatically eliminates browser compatibility differences.
179
+
180
+ ### 📱 Cross-platform Support
181
+
182
+ In addition to Web, it also supports uni-app, WeChat Mini Program, Alipay Mini Program and other platforms with unified APIs, greatly improving code reuse:
183
+
184
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/what_3.png" width="600"/>
185
+
186
+ > Demo: [Money Wave Ball](https://oi-contrib.github.io/VISLite/#/example/svg/money-schedule)
187
+
188
+ Currently `Canvas` supports: Web, native WeChat Mini Program, native Alipay Mini Program, uni-app (compiled to H5, WeChat Mini Program, Alipay Mini Program, etc.). We will continue to expand more platforms and painter types in the future.
189
+
190
+ ## Core Advantages
191
+
192
+ - **Flexible import methods**: Supports ES Module / CommonJS import after npm installation, as well as script tag CDN method
193
+ - **On-demand loading**: TS source import, on-demand JS import or full import, multiple modes to choose from
194
+ - **Simplicity and power coexist**: Provides basic visualization components that can be freely combined, and also supports encapsulation solutions for common scenarios
195
+ - **Stable and reliable**: Fully backward compatible within the same major version (except alpha and beta versions), always keep the latest version as the best choice
196
+
197
+ > Version specification: alpha (development version) → beta (testing version) → rc (release candidate) → next (pre-release version) → official release
198
+
199
+ ## Feedback
200
+
201
+ We are committed to continuously improving visualization functions and look forward to your valuable suggestions! Welcome to communicate with us through [Issues](https://github.com/oi-contrib/VISLite/issues).
202
+
203
+ All suggestions will be responded to within one week.
204
+
205
+ ## Changelog
206
+
207
+ See [CHANGELOG](./CHANGELOG) for details, updated after each official version release.
208
+
209
+ ## Roadmap
210
+
211
+ Recent work focus:
212
+
213
+ - Provide commonly used coordinate systems and layout components to accelerate development
214
+ - Continuously optimize documentation (improve readability, enrich examples, improve tutorials)
215
+
216
+ Want a feature? [Tell us](https://github.com/oi-contrib/VISLite/issues) and we'll prioritize it!
217
+
218
+ ## Contribution Guide
219
+
220
+ Welcome to participate in the project through the following ways:
221
+
222
+ - **Code maintenance**: Handle new feature development and Bug fixes
223
+ - **Documentation improvement**: Write and optimize interface documentation and tutorials
224
+ - **Test cases**: Supplement test cases in the test directory and examples in the docs directory
225
+ - **Direction discussion**: Participate in discussions on the future development of the project
226
+
227
+ Interested in joining? Please contact us through [issue](https://github.com/oi-contrib/VISLite/issues), please briefly describe the situation, and we will reply as soon as possible.
228
+
229
+ See [VISLite Contribution Guide](./.github/CONTRIBUTING.md) and [AUTHORS.txt](./AUTHORS.txt)
230
+
231
+ ## Example Projects
232
+
233
+ Examples developed based on VISLite and related plugins (such as [@vislite/canvas](https://github.com/oi-contrib/vislite-plugin-canvas), [@vislite/chart](https://github.com/oi-contrib/vislite-plugin-chart)):
234
+
235
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review1.png" style="width:700px;border:2px solid black;margin-bottom:20px;"/>
236
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review2.png" style="width:700px;border:2px solid black;margin-bottom:20px;"/>
237
+ <img src="https://oi-contrib.github.io/VISLite/images/docs/examples/review3.png" style="width:300px;border:2px solid black;margin-bottom:20px;"/>
238
+
239
+ For more examples, please visit: [VISLite Example Projects](https://rapid-start.github.io/VISLite-examples/index.html)
240
+
241
+ ## License
242
+
243
+ MIT License
244
+
245
+ Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) Step By Step