@kubex/zinc 1.0.106 → 1.0.107

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.
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  meta:
3
3
  title: Data Chart
4
- description: Charts visualize data using various chart types powered by ApexCharts. Display line charts, bar charts, area charts, and more with full customization options.
4
+ description: Charts visualize data using various chart types powered by Apache ECharts. Display line charts, bar charts, area charts, sankey diagrams, and more with full customization options.
5
5
  layout: component
6
6
  ---
7
7
 
8
8
  ```html:preview
9
9
  <zn-chart
10
10
  type="area"
11
+ smooth
11
12
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;]"
12
13
  data="[{&quot;name&quot;:&quot;Series 1&quot;,&quot;data&quot;:[30,40,45,50,49,60,70,91,125]}]"
13
14
  height="300">
@@ -15,7 +16,7 @@ layout: component
15
16
  ```
16
17
 
17
18
  :::tip
18
- The chart component is built on ApexCharts, providing a powerful and flexible charting library with extensive customization options. Visit the [ApexCharts documentation](https://apexcharts.com/docs/) for advanced configuration options.
19
+ The chart component is built on Apache ECharts, providing a powerful and flexible charting library with extensive customisation options. Visit the [Apache ECharts documentation](https://echarts.apache.org/en/option.html) for advanced configuration reference.
19
20
  :::
20
21
 
21
22
  ## Examples
@@ -27,6 +28,7 @@ Use `type="line"` to create a line chart. The `data` attribute accepts an array
27
28
  ```html:preview
28
29
  <zn-chart
29
30
  type="line"
31
+ scale
30
32
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;]"
31
33
  data="[{&quot;name&quot;:&quot;Revenue&quot;,&quot;data&quot;:[30,40,35,50,49,60]},{&quot;name&quot;:&quot;Expenses&quot;,&quot;data&quot;:[20,29,25,35,39,45]}]"
32
34
  height="300">
@@ -94,6 +96,7 @@ Stacked area charts work similarly to stacked bar charts but with area fills.
94
96
  <zn-chart
95
97
  type="area"
96
98
  stacked
99
+ smooth
97
100
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;]"
98
101
  data="[{&quot;name&quot;:&quot;Desktop&quot;,&quot;data&quot;:[300,400,350,500,490,600]},{&quot;name&quot;:&quot;Mobile&quot;,&quot;data&quot;:[200,290,250,350,390,450]},{&quot;name&quot;:&quot;Tablet&quot;,&quot;data&quot;:[100,150,120,180,170,200]}]"
99
102
  height="300">
@@ -114,6 +117,7 @@ Use the `height` attribute to control the chart's height in pixels. The default
114
117
  <br />
115
118
  <zn-chart
116
119
  type="line"
120
+ scale
117
121
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;]"
118
122
  data="[{&quot;name&quot;:&quot;Sales&quot;,&quot;data&quot;:[40,55,45,60]}]"
119
123
  height="400">
@@ -127,6 +131,7 @@ Use the `d-size` attribute to control the size of data point markers on line and
127
131
  ```html:preview
128
132
  <zn-chart
129
133
  type="line"
134
+ scale
130
135
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;]"
131
136
  data="[{&quot;name&quot;:&quot;Small Markers&quot;,&quot;data&quot;:[30,40,35,50,49]}]"
132
137
  d-size="1"
@@ -135,6 +140,7 @@ Use the `d-size` attribute to control the size of data point markers on line and
135
140
  <br />
136
141
  <zn-chart
137
142
  type="line"
143
+ scale
138
144
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;]"
139
145
  data="[{&quot;name&quot;:&quot;Large Markers&quot;,&quot;data&quot;:[30,40,35,50,49]}]"
140
146
  d-size="6"
@@ -166,31 +172,73 @@ Use `y-axis-append` to add a suffix to y-axis labels and tooltip values. Common
166
172
 
167
173
  ### Time Series with X-Axis Type
168
174
 
169
- Use the `x-axis` attribute to specify the x-axis type. Common values include `datetime`, `category`, and `numeric`.
175
+ Use the `xaxis` attribute to specify the x-axis type. Common values include `datetime`, `category`, and `numeric`.
170
176
 
171
177
  ```html:preview
172
178
  <zn-chart
173
179
  type="line"
174
- x-axis="datetime"
180
+ xaxis="datetime"
175
181
  data="[{&quot;name&quot;:&quot;Traffic&quot;,&quot;data&quot;:[{&quot;x&quot;:1609459200000,&quot;y&quot;:30},{&quot;x&quot;:1612137600000,&quot;y&quot;:40},{&quot;x&quot;:1614556800000,&quot;y&quot;:35},{&quot;x&quot;:1617235200000,&quot;y&quot;:50},{&quot;x&quot;:1619827200000,&quot;y&quot;:49},{&quot;x&quot;:1622505600000,&quot;y&quot;:60}]}]"
176
182
  height="300">
177
183
  </zn-chart>
178
184
  ```
179
185
 
180
186
  :::tip
181
- When using `x-axis="datetime"`, provide data in the format `[{x: timestamp, y: value}]` where `x` is a Unix timestamp in milliseconds. The chart will automatically format the dates on the x-axis.
187
+ When using `xaxis="datetime"`, provide data in the format `[{x: timestamp, y: value}]` where `x` is a Unix timestamp in milliseconds. The chart will automatically format the dates on the x-axis.
182
188
  :::
183
189
 
184
190
  ### Enable Animations
185
191
 
186
- By default, animations are disabled for better performance. Use the `enable-animations` attribute to enable chart animations.
192
+ By default, animations are disabled for better performance. Add the `enable-animations` attribute to animate on first render — bars grow from the baseline and lines draw in. Pass a number (milliseconds) to control the duration; bare `enable-animations` defaults to `1500`.
187
193
 
188
194
  ```html:preview
189
195
  <zn-chart
190
196
  type="bar"
191
197
  categories="[&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;]"
192
198
  data="[{&quot;name&quot;:&quot;Values&quot;,&quot;data&quot;:[44,55,41,37,52]}]"
193
- enable-animations
199
+ enable-animations="2500"
200
+ height="300">
201
+ </zn-chart>
202
+ ```
203
+
204
+ ### Smooth Lines
205
+
206
+ Add the `smooth` attribute to render line and area charts with curved segments instead of straight ones. Ignored for bar and sankey charts.
207
+
208
+ ```html:preview
209
+ <zn-chart
210
+ type="line"
211
+ smooth
212
+ categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;]"
213
+ data="[{&quot;name&quot;:&quot;Revenue&quot;,&quot;data&quot;:[30,40,35,50,49,60]}]"
214
+ height="300">
215
+ </zn-chart>
216
+ ```
217
+
218
+ ### Scaled Y-Axis
219
+
220
+ By default the y-axis starts at `0`. Add the `scale` attribute to adapt the y-axis to the data range — useful when values are clustered far from zero and you want to emphasise variation.
221
+
222
+ ```html:preview
223
+ <zn-chart
224
+ type="line"
225
+ scale
226
+ categories="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;]"
227
+ data="[{&quot;name&quot;:&quot;Temperature&quot;,&quot;data&quot;:[18,19,17,20,22]}]"
228
+ y-axis-append="°C"
229
+ height="300">
230
+ </zn-chart>
231
+ ```
232
+
233
+ Pass a number to `scale` to add that percentage of padding on top and bottom of the data range (e.g. `scale="10"` adds 10% padding). Larger values make the axis "breathe" more around the data.
234
+
235
+ ```html:preview
236
+ <zn-chart
237
+ type="line"
238
+ scale="10"
239
+ categories="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;]"
240
+ data="[{&quot;name&quot;:&quot;Temperature&quot;,&quot;data&quot;:[18,19,17,20,22]}]"
241
+ y-axis-append="°C"
194
242
  height="300">
195
243
  </zn-chart>
196
244
  ```
@@ -221,6 +269,65 @@ When no data is available, the chart will display an empty state. Consider addin
221
269
  </zn-chart>
222
270
  ```
223
271
 
272
+ ### Sankey Diagram
273
+
274
+ Use `type="sankey"` to render a Sankey flow diagram. Each item in the series `data` array is an edge with `source`, `target`, and `value`. Nodes are auto-derived from unique source/target values.
275
+
276
+ ```html:preview
277
+ <zn-chart
278
+ type="sankey"
279
+ height="400"
280
+ data="[{&quot;name&quot;:&quot;Payment Flow&quot;,&quot;data&quot;:[{&quot;source&quot;:&quot;Stripe&quot;,&quot;target&quot;:&quot;USD&quot;,&quot;value&quot;:1200},{&quot;source&quot;:&quot;Stripe&quot;,&quot;target&quot;:&quot;EUR&quot;,&quot;value&quot;:430},{&quot;source&quot;:&quot;USD&quot;,&quot;target&quot;:&quot;Captured&quot;,&quot;value&quot;:900},{&quot;source&quot;:&quot;USD&quot;,&quot;target&quot;:&quot;Declined&quot;,&quot;value&quot;:300},{&quot;source&quot;:&quot;EUR&quot;,&quot;target&quot;:&quot;Captured&quot;,&quot;value&quot;:380},{&quot;source&quot;:&quot;EUR&quot;,&quot;target&quot;:&quot;Declined&quot;,&quot;value&quot;:50}]}]">
281
+ </zn-chart>
282
+ ```
283
+
284
+ ### Cross-Chart Tooltip Sync
285
+
286
+ Use `sync-group="<id>"` on two or more charts to synchronise hover tooltips, zoom, and legend selection across them.
287
+
288
+ ```html:preview
289
+ <zn-chart
290
+ sync-group="demo-group"
291
+ type="line"
292
+ categories="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;]"
293
+ data="[{&quot;name&quot;:&quot;Visits&quot;,&quot;data&quot;:[120,180,150,220,190]}]"
294
+ height="250">
295
+ </zn-chart>
296
+ <br />
297
+ <zn-chart
298
+ sync-group="demo-group"
299
+ type="bar"
300
+ categories="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;]"
301
+ data="[{&quot;name&quot;:&quot;Signups&quot;,&quot;data&quot;:[12,18,15,22,19]}]"
302
+ height="250">
303
+ </zn-chart>
304
+ ```
305
+
306
+ ### Custom Colors
307
+
308
+ Use the `colors` attribute to set the palette that cycles across series.
309
+
310
+ ```html:preview
311
+ <zn-chart
312
+ type="bar"
313
+ colors="[&quot;#ff6c9c&quot;,&quot;#6483F2&quot;,&quot;#29bab5&quot;]"
314
+ categories="[&quot;Q1&quot;,&quot;Q2&quot;,&quot;Q3&quot;]"
315
+ data="[{&quot;name&quot;:&quot;A&quot;,&quot;data&quot;:[10,20,30]},{&quot;name&quot;:&quot;B&quot;,&quot;data&quot;:[15,25,35]},{&quot;name&quot;:&quot;C&quot;,&quot;data&quot;:[20,30,40]}]"
316
+ height="300">
317
+ </zn-chart>
318
+ ```
319
+
320
+ For a specific series colour, add a `color` property to the series object in the `data` array:
321
+
322
+ ```html:preview
323
+ <zn-chart
324
+ type="line"
325
+ categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;]"
326
+ data="[{&quot;name&quot;:&quot;Revenue&quot;,&quot;color&quot;:&quot;hsl(210,70%,50%)&quot;,&quot;data&quot;:[10,20,30]}]"
327
+ height="300">
328
+ </zn-chart>
329
+ ```
330
+
224
331
  ### Dark Mode Support
225
332
 
226
333
  The chart component automatically adapts to dark mode using the `t` attribute. The theme adjusts colors, gridlines, and text to match the current theme.
@@ -229,6 +336,8 @@ The chart component automatically adapts to dark mode using the `t` attribute. T
229
336
  <zn-chart
230
337
  t="dark"
231
338
  type="area"
339
+ scale
340
+ smooth
232
341
  categories="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;]"
233
342
  data="[{&quot;name&quot;:&quot;Series 1&quot;,&quot;data&quot;:[30,40,35,50,49]},{&quot;name&quot;:&quot;Series 2&quot;,&quot;data&quot;:[25,35,30,45,42]}]"
234
343
  height="300">
@@ -257,6 +366,7 @@ You can combine various attributes to create rich, informative charts.
257
366
  ```html:preview
258
367
  <zn-chart
259
368
  type="line"
369
+ scale
260
370
  categories="[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;]"
261
371
  data="[{&quot;name&quot;:&quot;Target&quot;,&quot;data&quot;:[80,85,82,90,88,95,92,98]},{&quot;name&quot;:&quot;Actual&quot;,&quot;data&quot;:[75,82,78,88,91,97,94,102]}]"
262
372
  d-size="4"
@@ -298,7 +408,7 @@ The chart component accepts data in JSON format through the `data` attribute. Th
298
408
 
299
409
  ### Time Series Format
300
410
 
301
- When using `x-axis="datetime"`, use the coordinate format:
411
+ When using `xaxis="datetime"`, use the coordinate format:
302
412
 
303
413
  ```json
304
414
  [
@@ -313,6 +423,22 @@ When using `x-axis="datetime"`, use the coordinate format:
313
423
  ]
314
424
  ```
315
425
 
426
+ ### Sankey Edge Format
427
+
428
+ When `type="sankey"`, each item in the series `data` array is an edge:
429
+
430
+ ```json
431
+ [{
432
+ "name": "Flow",
433
+ "data": [
434
+ {"source": "A", "target": "B", "value": 100},
435
+ {"source": "A", "target": "C", "value": 50}
436
+ ]
437
+ }]
438
+ ```
439
+
440
+ Nodes are auto-derived from unique source/target values. To customise node appearance or ordering, include an explicit `nodes` key on the series object.
441
+
316
442
  ### HTML Encoding
317
443
 
318
444
  When using the data attribute in HTML, JSON must be properly encoded. Use `&quot;` for quotes:
@@ -1,10 +1,12 @@
1
1
  ---
2
2
  meta:
3
3
  title: Simple Chart
4
- description:
4
+ description: A pre-styled compact bar chart for inline sparklines and dashboard tiles.
5
5
  layout: component
6
6
  ---
7
7
 
8
+ `zn-simple-chart` renders a small, opinionated bar chart with no axes or legend — handy for inline sparklines and dashboard summary tiles. It accepts a single series of values via `datasets` and optional x-axis labels via `labels`. If neither is provided, a placeholder dataset is shown.
9
+
8
10
  ```html:preview
9
11
  <zn-simple-chart>
10
12
  </zn-simple-chart>
@@ -12,12 +14,25 @@ layout: component
12
14
 
13
15
  ## Examples
14
16
 
15
- ### First Example
17
+ ### With Your Own Data
16
18
 
17
- TODO
19
+ Pass a `datasets` array with one entry and its `data` values, plus a matching `labels` array for tooltip context.
18
20
 
19
- ### Second Example
21
+ ```html:preview
22
+ <zn-simple-chart
23
+ datasets="[{&quot;data&quot;:[12,18,9,24,30,22,35,42]}]"
24
+ labels="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;,&quot;Sat&quot;,&quot;Sun&quot;,&quot;Mon&quot;]">
25
+ </zn-simple-chart>
26
+ ```
20
27
 
21
- TODO
28
+ ### Enable Animations
22
29
 
30
+ By default, bars render immediately with no animation. Add the `enable-animations` attribute to make bars grow from the baseline on first render. Pass a number (milliseconds) to control the duration; bare `enable-animations` defaults to `1500`.
23
31
 
32
+ ```html:preview
33
+ <zn-simple-chart
34
+ enable-animations="3000"
35
+ datasets="[{&quot;data&quot;:[12,18,9,24,30,22,35,42]}]"
36
+ labels="[&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thu&quot;,&quot;Fri&quot;,&quot;Sat&quot;,&quot;Sun&quot;,&quot;Mon&quot;]">
37
+ </zn-simple-chart>
38
+ ```