@carbon/charts-svelte 1.7.6 → 1.9.0-rc.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 (111) hide show
  1. package/CHANGELOG.md +16 -6
  2. package/README.md +128 -217
  3. package/dist/AlluvialChart.svelte +20 -0
  4. package/dist/AlluvialChart.svelte.d.ts +25 -0
  5. package/dist/AreaChart.svelte +20 -0
  6. package/dist/AreaChart.svelte.d.ts +25 -0
  7. package/dist/BarChartGrouped.svelte +20 -0
  8. package/dist/BarChartGrouped.svelte.d.ts +25 -0
  9. package/dist/BarChartSimple.svelte +20 -0
  10. package/dist/BarChartSimple.svelte.d.ts +25 -0
  11. package/dist/BarChartStacked.svelte +20 -0
  12. package/dist/BarChartStacked.svelte.d.ts +25 -0
  13. package/dist/BaseChart.svelte +35 -0
  14. package/dist/BaseChart.svelte.d.ts +29 -0
  15. package/dist/BoxplotChart.svelte +20 -0
  16. package/dist/BoxplotChart.svelte.d.ts +25 -0
  17. package/dist/BubbleChart.svelte +20 -0
  18. package/dist/BubbleChart.svelte.d.ts +25 -0
  19. package/dist/BulletChart.svelte +20 -0
  20. package/dist/BulletChart.svelte.d.ts +25 -0
  21. package/dist/ChoroplethChart.svelte +20 -0
  22. package/dist/ChoroplethChart.svelte.d.ts +25 -0
  23. package/dist/CirclePackChart.svelte +20 -0
  24. package/dist/CirclePackChart.svelte.d.ts +25 -0
  25. package/dist/ComboChart.svelte +20 -0
  26. package/dist/ComboChart.svelte.d.ts +25 -0
  27. package/dist/DonutChart.svelte +20 -0
  28. package/dist/DonutChart.svelte.d.ts +25 -0
  29. package/dist/GaugeChart.svelte +20 -0
  30. package/dist/GaugeChart.svelte.d.ts +25 -0
  31. package/dist/HeatmapChart.svelte +20 -0
  32. package/dist/HeatmapChart.svelte.d.ts +25 -0
  33. package/dist/HistogramChart.svelte +20 -0
  34. package/dist/HistogramChart.svelte.d.ts +25 -0
  35. package/dist/LineChart.svelte +20 -0
  36. package/dist/LineChart.svelte.d.ts +25 -0
  37. package/dist/LollipopChart.svelte +20 -0
  38. package/dist/LollipopChart.svelte.d.ts +25 -0
  39. package/dist/MeterChart.svelte +20 -0
  40. package/dist/MeterChart.svelte.d.ts +25 -0
  41. package/dist/PieChart.svelte +20 -0
  42. package/dist/PieChart.svelte.d.ts +25 -0
  43. package/dist/RadarChart.svelte +20 -0
  44. package/dist/RadarChart.svelte.d.ts +25 -0
  45. package/dist/ScatterChart.svelte +20 -0
  46. package/dist/ScatterChart.svelte.d.ts +25 -0
  47. package/dist/StackedAreaChart.svelte +20 -0
  48. package/dist/StackedAreaChart.svelte.d.ts +25 -0
  49. package/dist/TreeChart.svelte +20 -0
  50. package/dist/TreeChart.svelte.d.ts +25 -0
  51. package/dist/TreemapChart.svelte +20 -0
  52. package/dist/TreemapChart.svelte.d.ts +25 -0
  53. package/dist/WordCloudChart.svelte +20 -0
  54. package/dist/WordCloudChart.svelte.d.ts +25 -0
  55. package/dist/index.d.ts +26 -0
  56. package/{src → dist}/index.js +10 -35
  57. package/dist/styles.css +28264 -0
  58. package/dist/styles.css.map +1 -0
  59. package/dist/styles.min.css +1 -0
  60. package/dist/styles.min.css.map +1 -0
  61. package/package.json +89 -62
  62. package/src/AlluvialChart.svelte +0 -16
  63. package/src/AreaChart.svelte +0 -16
  64. package/src/BarChartGrouped.svelte +0 -16
  65. package/src/BarChartSimple.svelte +0 -16
  66. package/src/BarChartStacked.svelte +0 -16
  67. package/src/BaseChart.svelte +0 -80
  68. package/src/BoxplotChart.svelte +0 -16
  69. package/src/BubbleChart.svelte +0 -16
  70. package/src/BulletChart.svelte +0 -16
  71. package/src/CirclePackChart.svelte +0 -16
  72. package/src/ComboChart.svelte +0 -16
  73. package/src/DonutChart.svelte +0 -16
  74. package/src/GaugeChart.svelte +0 -16
  75. package/src/HeatmapChart.svelte +0 -16
  76. package/src/HistogramChart.svelte +0 -16
  77. package/src/LineChart.svelte +0 -16
  78. package/src/LollipopChart.svelte +0 -16
  79. package/src/MeterChart.svelte +0 -16
  80. package/src/PieChart.svelte +0 -16
  81. package/src/RadarChart.svelte +0 -16
  82. package/src/ScatterChart.svelte +0 -16
  83. package/src/StackedAreaChart.svelte +0 -16
  84. package/src/TreeChart.svelte +0 -16
  85. package/src/TreemapChart.svelte +0 -16
  86. package/src/WordCloudChart.svelte +0 -16
  87. package/types/AlluvialChart.d.ts +0 -5
  88. package/types/AreaChart.d.ts +0 -5
  89. package/types/BarChartGrouped.d.ts +0 -5
  90. package/types/BarChartSimple.d.ts +0 -5
  91. package/types/BarChartStacked.d.ts +0 -5
  92. package/types/BaseChart.d.ts +0 -69
  93. package/types/BoxplotChart.d.ts +0 -5
  94. package/types/BubbleChart.d.ts +0 -5
  95. package/types/BulletChart.d.ts +0 -5
  96. package/types/CirclePackChart.d.ts +0 -5
  97. package/types/ComboChart.d.ts +0 -5
  98. package/types/DonutChart.d.ts +0 -5
  99. package/types/GaugeChart.d.ts +0 -5
  100. package/types/HistogramChart.d.ts +0 -5
  101. package/types/LineChart.d.ts +0 -5
  102. package/types/LollipopChart.d.ts +0 -5
  103. package/types/MeterChart.d.ts +0 -5
  104. package/types/PieChart.d.ts +0 -5
  105. package/types/RadarChart.d.ts +0 -5
  106. package/types/ScatterChart.d.ts +0 -5
  107. package/types/StackedAreaChart.d.ts +0 -5
  108. package/types/TreeChart.d.ts +0 -15
  109. package/types/TreemapChart.d.ts +0 -5
  110. package/types/WordCloudChart.d.ts +0 -5
  111. package/types/index.d.ts +0 -23
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.8.0](https://github.com/carbon-design-system/carbon-charts/compare/v1.7.6...v1.8.0) (2023-06-03)
7
+
8
+ ### Features
9
+
10
+ - **core:** Add choropleth chart
11
+ ([#1487](https://github.com/carbon-design-system/carbon-charts/issues/1487))
12
+ ([62caeb1](https://github.com/carbon-design-system/carbon-charts/commit/62caeb1fd6fab9e2a39d85b024f2d9b97f8bd1fa))
13
+
14
+ # Change Log
15
+
16
+ All notable changes to this project will be documented in this file. See
17
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
18
+
6
19
  ## [1.7.6](https://github.com/carbon-design-system/carbon-charts/compare/v1.7.5...v1.7.6) (2023-05-01)
7
20
 
8
21
  **Note:** Version bump only for package @carbon/charts-svelte
@@ -154,8 +167,7 @@ All notable changes to this project will be documented in this file. See
154
167
  - **core:** allow theme to be set via options prop
155
168
  ([#1412](https://github.com/carbon-design-system/carbon-charts/issues/1412))
156
169
  ([6288548](https://github.com/carbon-design-system/carbon-charts/commit/62885487a700e2222d51f70aea790eddd5d6d086)),
157
- closes
158
- [#1411](https://github.com/carbon-design-system/carbon-charts/issues/1411)
170
+ closes [#1411](https://github.com/carbon-design-system/carbon-charts/issues/1411)
159
171
 
160
172
  ## [1.3.2](https://github.com/carbon-design-system/carbon-charts/compare/v1.3.1...v1.3.2) (2022-06-30)
161
173
 
@@ -361,8 +373,7 @@ All notable changes to this project will be documented in this file. See
361
373
 
362
374
  ### Features
363
375
 
364
- - **svelte:** add TypeScript definitions for Alluvial, Histogram, and Tree
365
- charts
376
+ - **svelte:** add TypeScript definitions for Alluvial, Histogram, and Tree charts
366
377
  ([#1219](https://github.com/carbon-design-system/carbon-charts/issues/1219))
367
378
  ([3e7fcc2](https://github.com/carbon-design-system/carbon-charts/commit/3e7fcc2f16d16d67c4f39f4d4389878b5d829aba))
368
379
 
@@ -465,8 +476,7 @@ All notable changes to this project will be documented in this file. See
465
476
  - **core:** create alluvial chart
466
477
  ([#1132](https://github.com/carbon-design-system/carbon-charts/issues/1132))
467
478
  ([08fa194](https://github.com/carbon-design-system/carbon-charts/commit/08fa194f1c59ab2110c0d221886fc0174c936194)),
468
- closes
469
- [#871](https://github.com/carbon-design-system/carbon-charts/issues/871)
479
+ closes [#871](https://github.com/carbon-design-system/carbon-charts/issues/871)
470
480
 
471
481
  ## [0.48.4](https://github.com/carbon-design-system/carbon-charts/compare/v0.48.3...v0.48.4) (2021-09-13)
472
482
 
package/README.md CHANGED
@@ -14,8 +14,8 @@
14
14
 
15
15
  These Svelte wrappers have been developed by Eric Liu.
16
16
 
17
- Please direct all questions regarding support, bug fixes, and feature requests
18
- to [@metonym](https://github.com/metonym).
17
+ Please direct all questions regarding support, bug fixes, and feature requests to
18
+ [@metonym](https://github.com/metonym).
19
19
 
20
20
  ## Getting started
21
21
 
@@ -25,111 +25,71 @@ Run the following command using [npm](https://www.npmjs.com/):
25
25
  npm install -D @carbon/charts-svelte d3
26
26
  ```
27
27
 
28
- If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
29
- instead:
28
+ If you prefer [Yarn](https://yarnpkg.com/en/), use the following command instead:
30
29
 
31
30
  ```bash
32
31
  yarn add -D @carbon/charts-svelte d3
33
32
  ```
34
33
 
35
- **Note:** you'd also need to install `carbon-components` if you're not using a
36
- bundled version of the library.
34
+ **Note:** you'd also need to install `carbon-components` if you're not using a bundled version of
35
+ the library.
37
36
 
38
37
  ## Set-up
39
38
 
40
39
  This is an overview of using Carbon Charts with common Svelte set-ups.
41
40
 
42
- - [SvelteKit](#sveltekit)
43
- - [Vite](#vite)
44
- - [Rollup](#rollup)
45
- - [Webpack](#webpack)
41
+ - [SvelteKit](#sveltekit)
42
+ - [Vite](#vite)
46
43
 
47
44
  ### SvelteKit
48
45
 
49
- [SvelteKit](https://github.com/sveltejs/kit) is the official framework for
50
- building apps that support client-side rendering (CSR) and server-side rendering
51
- (SSR). SvelteKit is powered by [Vite](https://github.com/vitest-dev/vitest).
46
+ [SvelteKit](https://github.com/sveltejs/kit) is the official framework for building apps that
47
+ support client-side rendering (CSR) and server-side rendering (SSR). SvelteKit is powered by
48
+ [Vite](https://github.com/vitest-dev/vitest).
52
49
 
53
- `@carbon/charts` and `carbon-components` should not be externalized for SSR when
54
- building for production.
50
+ `@carbon/charts` and `carbon-components` should not be externalized for SSR when building for
51
+ production.
55
52
 
56
53
  ```js
57
54
  // vite.config.js
58
- import { sveltekit } from '@sveltejs/kit/vite';
55
+ import { sveltekit } from '@sveltejs/kit/vite'
59
56
 
60
57
  /** @type {import('vite').UserConfig} */
61
- export default {
58
+ const config = {
62
59
  plugins: [sveltekit()],
63
60
  ssr: {
64
- noExternal:
65
- process.env.NODE_ENV === 'production'
66
- ? ['@carbon/charts', 'carbon-components']
67
- : [],
68
- },
69
- };
61
+ noExternal: process.env.NODE_ENV === 'production' ? ['@carbon/charts', 'carbon-components'] : []
62
+ }
63
+ }
64
+
65
+ export default config
70
66
  ```
71
67
 
72
68
  ### Vite
73
69
 
74
- You can also use Vite without SvelteKit. Instruct `vite` to optimize
75
- `@carbon/charts` in `vite.config.js`.
70
+ You can also use Vite without SvelteKit. Instruct `vite` to optimize `@carbon/charts` in
71
+ `vite.config.js`.
76
72
 
77
73
  ```js
78
74
  // vite.config.js
79
- import { svelte } from '@sveltejs/vite-plugin-svelte';
75
+ import { svelte } from '@sveltejs/vite-plugin-svelte'
80
76
 
81
77
  /** @type {import('vite').UserConfig} */
82
- export default {
78
+ const config = {
83
79
  plugins: [svelte()],
84
- optimizeDeps: { include: ['@carbon/charts'] },
85
- };
86
- ```
87
-
88
- ### Rollup
89
-
90
- #### ReferenceError: process is not defined
91
-
92
- Install and add
93
- [@rollup/plugin-replace](https://github.com/rollup/plugins/tree/master/packages/replace)
94
- to the list of plugins in `rollup.config.js` to avoid the
95
- `process is not defined` runtime error.
96
-
97
- This plugin statically replaces strings in bundled files with the specified
98
- value.
99
-
100
- In the example below, all instances of `process.env.NODE_ENV` will be replaced
101
- with `"production"` while bundling.
102
-
103
- ```js
104
- // rollup.config.js
105
- import replace from '@rollup/plugin-replace';
106
-
107
- export default {
108
- // ...
109
- plugins: [
110
- replace({
111
- preventAssignment: true,
112
- 'process.env.NODE_ENV': JSON.stringify('production'),
113
- }),
114
- ],
115
- };
116
- ```
117
-
118
- #### `this` has been rewritten to `undefined`
119
-
120
- Set [`context: "window"`](https://rollupjs.org/guide/en/#context) to address the
121
- `this has been rewritten to undefined` Rollup error.
80
+ optimizeDeps: {
81
+ include: ['@carbon/charts', 'carbon-components'],
82
+ exclude: ['@carbon/telemetry']
83
+ }
84
+ }
122
85
 
123
- ```diff
124
- export default {
125
- + context: "window",
126
- };
86
+ export default config
127
87
  ```
128
88
 
129
89
  #### Circular dependency warnings
130
90
 
131
- You may see circular dependency warnings for `d3` and `@carbon/charts` packages
132
- that can be safely ignored.
91
+ You may see circular dependency warnings for `d3` and `@carbon/charts` packages that can be safely
92
+ ignored.
133
93
 
134
94
  Use the `onwarn` option to selectively ignore these warnings.
135
95
 
@@ -140,101 +100,65 @@ export default {
140
100
  // omit circular dependency warnings emitted from
141
101
  // "d3-*" packages and "@carbon/charts"
142
102
  if (warning.code === 'CIRCULAR_DEPENDENCY') {
143
- if (
144
- warning.ids.some((id) =>
145
- /node_modules\/(d3-|@carbon\/charts)/.test(id)
146
- )
147
- ) {
148
- return;
103
+ if (warning.ids.some((id) => /node_modules\/(d3-|@carbon\/charts)/.test(id))) {
104
+ return
149
105
  }
150
106
  }
151
107
 
152
108
  // preserve all other warnings
153
- warn(warning);
154
- },
155
- };
156
- ```
157
-
158
- #### Code-splitting
159
-
160
- If using [dynamic imports](https://rollupjs.org/guide/en/#dynamic-import), use
161
- `type="module"` alongside `output.dir` for code-splitting.
162
-
163
- ```diff
164
- # index.html
165
- - <script src="build/bundle.js"></script>
166
- + <script type="module" src="build/index.js"></script>
167
- ```
168
-
169
- ```diff
170
- # rollup.config.js
171
- export default {
172
- output: {
173
- - format: "iife",
174
- - file: "public/build/bundle.js",
175
- + dir: "public/build",
176
- }
109
+ warn(warning)
110
+ }
177
111
  }
178
112
  ```
179
113
 
180
- ### Webpack
181
-
182
- [Webpack](https://github.com/webpack/webpack) is another popular application
183
- bundler used to build Svelte apps.
184
-
185
- No additional configuration should be necessary.
186
-
187
114
  ## Usage
188
115
 
189
116
  Styles must be imported from both `@carbon/charts` and `@carbon/styles`.
190
117
 
191
118
  ```js
192
- import '@carbon/styles/css/styles.css';
193
- import '@carbon/charts/styles.css';
119
+ import '@carbon/styles/css/styles.css'
120
+ import '@carbon/charts/styles.css'
194
121
  ```
195
122
 
196
123
  ### Basic
197
124
 
198
125
  ```svelte
199
126
  <script>
200
- import "@carbon/styles/css/styles.css";
201
- import "@carbon/charts/styles.css";
202
- import { BarChartSimple } from "@carbon/charts-svelte";
127
+ import '@carbon/styles/css/styles.css'
128
+ import '@carbon/charts/styles.css'
129
+ import { BarChartSimple } from '@carbon/charts-svelte'
203
130
  </script>
204
131
 
205
132
  <BarChartSimple
206
- data={[
207
- { group: "Qty", value: 65000 },
208
- { group: "More", value: 29123 },
209
- { group: "Sold", value: 35213 },
210
- { group: "Restocking", value: 51213 },
211
- { group: "Misc", value: 16932 },
212
- ]}
213
- options={{
214
- title: "Simple bar (discrete)",
215
- height: "400px",
216
- axes: {
217
- left: { mapsTo: "value" },
218
- bottom: { mapsTo: "group", scaleType: "labels" },
219
- },
220
- }}
221
- />
222
-
133
+ data={[
134
+ { group: 'Qty', value: 65000 },
135
+ { group: 'More', value: 29123 },
136
+ { group: 'Sold', value: 35213 },
137
+ { group: 'Restocking', value: 51213 },
138
+ { group: 'Misc', value: 16932 }
139
+ ]}
140
+ options={{
141
+ title: 'Simple bar (discrete)',
142
+ height: '400px',
143
+ axes: {
144
+ left: { mapsTo: 'value' },
145
+ bottom: { mapsTo: 'group', scaleType: 'labels' }
146
+ }
147
+ }} />
223
148
  ```
224
149
 
225
150
  ### Theming
226
151
 
227
152
  `@carbon/styles` uses
228
153
  [CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
229
- for dynamic, client-side theming. Update the Carbon theme using the `theme`
230
- prop.
154
+ for dynamic, client-side theming. Update the Carbon theme using the `theme` prop.
231
155
 
232
156
  Supported themes include:
233
157
 
234
- - `"white"`
235
- - `"g10"` (Gray 10)
236
- - `"g90"` (Gray 90)
237
- - `"g100"` (Gray 100)
158
+ - `"white"`
159
+ - `"g10"` (Gray 10)
160
+ - `"g90"` (Gray 90)
161
+ - `"g100"` (Gray 100)
238
162
 
239
163
  The default theme is `"white"`.
240
164
 
@@ -250,20 +174,12 @@ The default theme is `"white"`.
250
174
 
251
175
  Each Svelte chart component dispatches the following events:
252
176
 
253
- - **on:load**: fired when the chart is instantiated
254
- - **on:update**: fired when `data` or `options` are updated
255
- - **on:destroy**: fired when the component is unmounted and the chart is
256
- destroyed
177
+ - **on:load**: fired when the chart is instantiated
178
+ - **on:update**: fired when `data` or `options` are updated
179
+ - **on:destroy**: fired when the component is unmounted and the chart is destroyed
257
180
 
258
181
  ```svelte
259
- <BarChartSimple
260
- {data}
261
- {options}
262
- on:load
263
- on:update
264
- on:destroy
265
- />
266
-
182
+ <BarChartSimple {data} {options} on:load on:update on:destroy />
267
183
  ```
268
184
 
269
185
  ### Dynamic import
@@ -273,108 +189,103 @@ Dynamically import a chart and instantiate it using the
273
189
 
274
190
  ```svelte
275
191
  <script>
276
- import "@carbon/styles/css/styles.css";
277
- import "@carbon/charts/styles.css";
278
- import { onMount } from "svelte";
192
+ import '@carbon/styles/css/styles.css'
193
+ import '@carbon/charts/styles.css'
194
+ import { onMount } from 'svelte'
279
195
 
280
- let chart;
196
+ let chart
281
197
 
282
- onMount(async () => {
283
- const charts = await import("@carbon/charts-svelte");
284
- chart = charts.BarChartSimple;
285
- });
198
+ onMount(async () => {
199
+ const charts = await import('@carbon/charts-svelte')
200
+ chart = charts.BarChartSimple
201
+ })
286
202
  </script>
287
203
 
288
204
  <svelte:component
289
- this={chart}
290
- data={[
291
- { group: "Qty", value: 65000 },
292
- { group: "More", value: 29123 },
293
- { group: "Sold", value: 35213 },
294
- { group: "Restocking", value: 51213 },
295
- { group: "Misc", value: 16932 },
296
- ]}
297
- options={{
298
- title: "Simple bar (discrete)",
299
- height: "400px",
300
- axes: {
301
- left: { mapsTo: "value" },
302
- bottom: { mapsTo: "group", scaleType: "labels" },
303
- },
304
- }}
305
- />
306
-
205
+ this={chart}
206
+ data={[
207
+ { group: 'Qty', value: 65000 },
208
+ { group: 'More', value: 29123 },
209
+ { group: 'Sold', value: 35213 },
210
+ { group: 'Restocking', value: 51213 },
211
+ { group: 'Misc', value: 16932 }
212
+ ]}
213
+ options={{
214
+ title: 'Simple bar (discrete)',
215
+ height: '400px',
216
+ axes: {
217
+ left: { mapsTo: 'value' },
218
+ bottom: { mapsTo: 'group', scaleType: 'labels' }
219
+ }
220
+ }} />
307
221
  ```
308
222
 
309
223
  ### Event listeners
310
224
 
311
- In this example, an event listener is attached to the `BarChartSimple` component
312
- that fires when hovering over a bar.
225
+ In this example, an event listener is attached to the `BarChartSimple` component that fires when
226
+ hovering over a bar.
313
227
 
314
228
  ```svelte
315
229
  <script>
316
- import "@carbon/styles/css/styles.css";
317
- import "@carbon/charts/styles.css";
318
- import { onMount } from "svelte";
319
- import { BarChartSimple } from "@carbon/charts-svelte";
230
+ import '@carbon/styles/css/styles.css'
231
+ import '@carbon/charts/styles.css'
232
+ import { onMount } from 'svelte'
233
+ import { BarChartSimple } from '@carbon/charts-svelte'
320
234
 
321
- let chart;
235
+ let chart
322
236
 
323
- function barMouseOver(e) {
324
- console.log(e.detail);
325
- }
237
+ function barMouseOver(e) {
238
+ console.log(e.detail)
239
+ }
326
240
 
327
- onMount(() => {
328
- return () => {
329
- if (chart) chart.services.events.removeEventListener("bar-mouseover", barMouseOver);
330
- };
331
- });
241
+ onMount(() => {
242
+ return () => {
243
+ if (chart) chart.services.events.removeEventListener('bar-mouseover', barMouseOver)
244
+ }
245
+ })
332
246
 
333
- $: if (chart) chart.services.events.addEventListener("bar-mouseover", barMouseOver);
247
+ $: if (chart) chart.services.events.addEventListener('bar-mouseover', barMouseOver)
334
248
  </script>
335
249
 
336
250
  <BarChartSimple
337
- bind:chart
338
- data={[
339
- { group: "Qty", value: 65000 },
340
- { group: "More", value: 29123 },
341
- { group: "Sold", value: 35213 },
342
- { group: "Restocking", value: 51213 },
343
- { group: "Misc", value: 16932 },
344
- ]}
345
- options={{
346
- title: "Simple bar (discrete)",
347
- height: "400px",
348
- axes: {
349
- left: { mapsTo: "value" },
350
- bottom: { mapsTo: "group", scaleType: "labels" },
351
- },
352
- }}
353
- />
354
-
251
+ bind:chart
252
+ data={[
253
+ { group: 'Qty', value: 65000 },
254
+ { group: 'More', value: 29123 },
255
+ { group: 'Sold', value: 35213 },
256
+ { group: 'Restocking', value: 51213 },
257
+ { group: 'Misc', value: 16932 }
258
+ ]}
259
+ options={{
260
+ title: 'Simple bar (discrete)',
261
+ height: '400px',
262
+ axes: {
263
+ left: { mapsTo: 'value' },
264
+ bottom: { mapsTo: 'group', scaleType: 'labels' }
265
+ }
266
+ }} />
355
267
  ```
356
268
 
357
269
  ## Codesandbox examples
358
270
 
359
271
  [Sample use cases can be seen here](https://carbon-design-system.github.io/carbon-charts/svelte).
360
272
 
361
- **When opening the link above**, click on the **Edit on Codesandbox** button for
362
- each demo to see an isolated project showing you how to reproduce the demo.
273
+ **When opening the link above**, click on the **Edit on Codesandbox** button for each demo to see an
274
+ isolated project showing you how to reproduce the demo.
363
275
 
364
276
  ## Charting data & options
365
277
 
366
- Although we will definitely introduce new models in the future as we start
367
- shipping new components such as maps, Data and options follow the same model in
368
- all charts, with minor exceptions and differences in specific components.
278
+ Although we will definitely introduce new models in the future as we start shipping new components
279
+ such as maps, Data and options follow the same model in all charts, with minor exceptions and
280
+ differences in specific components.
369
281
 
370
- For instance in the case of a donut chart you're able to pass in an additional
371
- field called `center` in your options configuring the donut center.
282
+ For instance in the case of a donut chart you're able to pass in an additional field called `center`
283
+ in your options configuring the donut center.
372
284
 
373
285
  For instructions on using the **tabular data format**, see
374
286
  [here](https://carbon-design-system.github.io/carbon-charts/?path=/story/docs-tutorials--tabular-data-format)
375
287
 
376
- There are also additional options available depending on the chart type being
377
- used,
288
+ There are also additional options available depending on the chart type being used,
378
289
  [see our demo examples here](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/core/demo/data).
379
290
 
380
291
  Customizable options (specific to chart type) can be found
@@ -0,0 +1,20 @@
1
+ <script>import {
2
+ AlluvialChart as AlluvialChartCore
3
+ } from "@carbon/charts";
4
+ import BaseChart from "./BaseChart.svelte";
5
+ export let chart;
6
+ export let options;
7
+ export let data;
8
+ export let ref;
9
+ </script>
10
+
11
+ <BaseChart
12
+ {...$$restProps}
13
+ Chart={AlluvialChartCore}
14
+ {options}
15
+ {data}
16
+ bind:ref
17
+ bind:chart
18
+ on:load
19
+ on:update
20
+ on:destroy />
@@ -0,0 +1,25 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import { AlluvialChart as AlluvialChartCore, type AlluvialChartOptions, type ChartTabularData } from '@carbon/charts';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ chart: AlluvialChartCore;
7
+ options: AlluvialChartOptions;
8
+ data: ChartTabularData;
9
+ ref: HTMLDivElement;
10
+ };
11
+ events: {
12
+ load: CustomEvent<any>;
13
+ update: CustomEvent<any>;
14
+ destroy: CustomEvent<any>;
15
+ } & {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {};
19
+ };
20
+ export type AlluvialChartProps = typeof __propDef.props;
21
+ export type AlluvialChartEvents = typeof __propDef.events;
22
+ export type AlluvialChartSlots = typeof __propDef.slots;
23
+ export default class AlluvialChart extends SvelteComponentTyped<AlluvialChartProps, AlluvialChartEvents, AlluvialChartSlots> {
24
+ }
25
+ export {};
@@ -0,0 +1,20 @@
1
+ <script>import {
2
+ AreaChart as AreaChartCore
3
+ } from "@carbon/charts";
4
+ import BaseChart from "./BaseChart.svelte";
5
+ export let chart;
6
+ export let options;
7
+ export let data;
8
+ export let ref;
9
+ </script>
10
+
11
+ <BaseChart
12
+ {...$$restProps}
13
+ Chart={AreaChartCore}
14
+ {options}
15
+ {data}
16
+ bind:ref
17
+ bind:chart
18
+ on:load
19
+ on:update
20
+ on:destroy />
@@ -0,0 +1,25 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import { AreaChart as AreaChartCore, type AreaChartOptions, type ChartTabularData } from '@carbon/charts';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ chart: AreaChartCore;
7
+ options: AreaChartOptions;
8
+ data: ChartTabularData;
9
+ ref: HTMLDivElement;
10
+ };
11
+ events: {
12
+ load: CustomEvent<any>;
13
+ update: CustomEvent<any>;
14
+ destroy: CustomEvent<any>;
15
+ } & {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {};
19
+ };
20
+ export type AreaChartProps = typeof __propDef.props;
21
+ export type AreaChartEvents = typeof __propDef.events;
22
+ export type AreaChartSlots = typeof __propDef.slots;
23
+ export default class AreaChart extends SvelteComponentTyped<AreaChartProps, AreaChartEvents, AreaChartSlots> {
24
+ }
25
+ export {};
@@ -0,0 +1,20 @@
1
+ <script>import {
2
+ GroupedBarChart as GroupedBarChartCore
3
+ } from "@carbon/charts";
4
+ import BaseChart from "./BaseChart.svelte";
5
+ export let chart;
6
+ export let options;
7
+ export let data;
8
+ export let ref;
9
+ </script>
10
+
11
+ <BaseChart
12
+ {...$$restProps}
13
+ Chart={GroupedBarChartCore}
14
+ {options}
15
+ {data}
16
+ bind:ref
17
+ bind:chart
18
+ on:load
19
+ on:update
20
+ on:destroy />
@@ -0,0 +1,25 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import { GroupedBarChart as GroupedBarChartCore, type BarChartOptions, type ChartTabularData } from '@carbon/charts';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ chart: GroupedBarChartCore;
7
+ options: BarChartOptions;
8
+ data: ChartTabularData;
9
+ ref: HTMLDivElement;
10
+ };
11
+ events: {
12
+ load: CustomEvent<any>;
13
+ update: CustomEvent<any>;
14
+ destroy: CustomEvent<any>;
15
+ } & {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {};
19
+ };
20
+ export type BarChartGroupedProps = typeof __propDef.props;
21
+ export type BarChartGroupedEvents = typeof __propDef.events;
22
+ export type BarChartGroupedSlots = typeof __propDef.slots;
23
+ export default class BarChartGrouped extends SvelteComponentTyped<BarChartGroupedProps, BarChartGroupedEvents, BarChartGroupedSlots> {
24
+ }
25
+ export {};