@oliasoft-open-source/charts-library 7.0.0 → 7.0.1

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.
package/README.md CHANGED
@@ -1,3 +1,418 @@
1
1
  # Chart Library
2
2
 
3
3
  Reusable charts for use in React applications.
4
+
5
+ ## Usage and defaults
6
+
7
+ The component JSDoc contains usage examples with sample data, labels and an explicit height.
8
+ Those example values are not defaults.
9
+
10
+ The sections below show the complete library-normalized configuration for `getDefaultProps({ chart: {} })`.
11
+ You do not need to pass these objects: omitted options receive these values automatically.
12
+
13
+ - `undefined` means the library leaves that value unspecified; it does not mean zero or false.
14
+ - Empty data is the default. Supply your own DS to draw a chart.
15
+ - These are library defaults, not a dump of Chart.js or plugin defaults. Final rendering can also depend on
16
+ data, container size, theme, plugin configuration and, for LineChart, persisted control state.
17
+ - Compatibility fields may appear in normalized output without affecting rendering; see their public type documentation.
18
+ - Default unit-selector callbacks are no-ops; consumers own unit selection and data conversion.
19
+ - The snapshots describe the initial empty configuration. Per-item defaults for supplied annotations and DS are
20
+ applied separately by their normalizers and renderers.
21
+
22
+ ## LineChart
23
+
24
+ ```ts
25
+ const noop = () => {
26
+ // Default unit selection does not change consumer state.
27
+ };
28
+
29
+ const defaultChart = {
30
+ persistenceId: '',
31
+ controlsPortalId: '',
32
+ testId: undefined,
33
+ data: {
34
+ datasets: [],
35
+ },
36
+ options: {
37
+ title: '',
38
+ scales: {
39
+ x: {},
40
+ y: {},
41
+ },
42
+ axes: {
43
+ x: [
44
+ {
45
+ label: '',
46
+ position: 'bottom',
47
+ color: '',
48
+ unit: {
49
+ options: [],
50
+ selectedUnit: '',
51
+ setSelectedUnit: noop,
52
+ },
53
+ },
54
+ ],
55
+ y: [
56
+ {
57
+ label: '',
58
+ position: 'left',
59
+ color: '',
60
+ unit: {
61
+ options: [],
62
+ selectedUnit: '',
63
+ setSelectedUnit: noop,
64
+ },
65
+ },
66
+ ],
67
+ },
68
+ additionalAxesOptions: {
69
+ chartScaleType: 'linear',
70
+ reverse: false,
71
+ beginAtZero: false,
72
+ stepSize: undefined,
73
+ suggestedMin: undefined,
74
+ suggestedMax: undefined,
75
+ range: undefined,
76
+ autoAxisPadding: false,
77
+ },
78
+ chartStyling: {
79
+ width: undefined,
80
+ height: undefined,
81
+ maintainAspectRatio: false,
82
+ staticChartHeight: false,
83
+ performanceMode: true,
84
+ squareAspectRatio: false,
85
+ layoutPadding: {
86
+ top: 0,
87
+ bottom: 20,
88
+ left: 0,
89
+ right: 0,
90
+ },
91
+ },
92
+ tooltip: {
93
+ tooltips: true,
94
+ showLabelsInTooltips: false,
95
+ hideSimulationName: false,
96
+ scientificNotation: true,
97
+ callbacks: undefined,
98
+ },
99
+ graph: {
100
+ lineTension: 0.01,
101
+ spanGaps: false,
102
+ showDataLabels: false,
103
+ showMinorGridlines: false,
104
+ },
105
+ annotations: {
106
+ labelAnnotation: {
107
+ showLabel: false,
108
+ text: '',
109
+ position: 'bottom-right',
110
+ fontSize: 12,
111
+ xOffset: 5,
112
+ yOffset: 5,
113
+ maxWidth: 300,
114
+ lineHeight: 12,
115
+ },
116
+ showAnnotations: false,
117
+ controlAnnotation: false,
118
+ enableDragAnnotation: false,
119
+ enableCalloutAnnotation: false,
120
+ lineMarkersAnnotation: {
121
+ enabled: false,
122
+ itemGapPx: 4,
123
+ edgePaddingPx: 8,
124
+ horizontalLineLengthPx: undefined,
125
+ lineDirection: undefined,
126
+ labelCollisionPx: 4,
127
+ labelCollisionClusterXPx: 36,
128
+ enableLabelCollisionResolver: true,
129
+ stickToEdge: true,
130
+ stickToGroup: false,
131
+ stickSide: 'right',
132
+ reverse: false,
133
+ xValue: undefined,
134
+ yValue: undefined,
135
+ yStartValue: undefined,
136
+ yEndValue: undefined,
137
+ xStartValue: undefined,
138
+ xEndValue: undefined,
139
+ lengthPx: undefined,
140
+ color: 'rgba(20,20,20,0.9)',
141
+ opacity: 1,
142
+ lineWidth: 1,
143
+ lineDash: [],
144
+ startTick: undefined,
145
+ endTick: undefined,
146
+ items: [],
147
+ },
148
+ annotationsData: [],
149
+ },
150
+ legend: {
151
+ display: true,
152
+ position: 'bottom-left',
153
+ align: 'center',
154
+ customLegend: {
155
+ customLegendPlugin: null,
156
+ customLegendContainerID: '',
157
+ },
158
+ usePointStyle: true,
159
+ },
160
+ chartOptions: {
161
+ showPoints: true,
162
+ showLine: true,
163
+ enableZoom: true,
164
+ enablePan: false,
165
+ enableDragAnnotation: false,
166
+ closeOnOutsideClick: false,
167
+ },
168
+ interactions: {
169
+ onLegendClick: undefined,
170
+ onHover: undefined,
171
+ onUnhover: undefined,
172
+ onAnimationComplete: undefined,
173
+ },
174
+ dragData: {
175
+ enableDragData: false,
176
+ showTooltip: true,
177
+ roundPoints: true,
178
+ dragX: true,
179
+ dragY: true,
180
+ onDragStart: undefined,
181
+ onDrag: undefined,
182
+ onDragEnd: undefined,
183
+ },
184
+ depthType: {},
185
+ },
186
+ };
187
+ ```
188
+
189
+ ## BarChart
190
+
191
+ ```ts
192
+ const defaultChart = {
193
+ testId: '',
194
+ controlsPortalId: '',
195
+ data: {
196
+ labels: [],
197
+ datasets: [],
198
+ },
199
+ options: {
200
+ title: '',
201
+ direction: 'vertical',
202
+ axes: {
203
+ x: [{}],
204
+ y: [{}],
205
+ },
206
+ additionalAxesOptions: {
207
+ chartScaleType: 'linear',
208
+ reverse: false,
209
+ stacked: false,
210
+ beginAtZero: true,
211
+ stepSize: undefined,
212
+ suggestedMin: undefined,
213
+ suggestedMax: undefined,
214
+ min: undefined,
215
+ max: undefined,
216
+ stackedX: undefined,
217
+ stackedY: undefined,
218
+ },
219
+ chartStyling: {
220
+ width: undefined,
221
+ height: undefined,
222
+ maintainAspectRatio: false,
223
+ staticChartHeight: false,
224
+ performanceMode: true,
225
+ },
226
+ tooltip: {
227
+ tooltips: true,
228
+ showLabelsInTooltips: false,
229
+ scientificNotation: true,
230
+ },
231
+ graph: {
232
+ showDataLabels: false,
233
+ showMinorGridlines: false,
234
+ },
235
+ scales: {},
236
+ annotations: {
237
+ showAnnotations: true,
238
+ controlAnnotation: false,
239
+ annotationsData: [],
240
+ },
241
+ legend: {
242
+ display: true,
243
+ position: 'top-left',
244
+ align: 'center',
245
+ customLegend: {
246
+ customLegendPlugin: null,
247
+ customLegendContainerID: '',
248
+ },
249
+ },
250
+ chartOptions: {
251
+ enableZoom: false,
252
+ enablePan: false,
253
+ },
254
+ interactions: {
255
+ onLegendClick: undefined,
256
+ onHover: undefined,
257
+ onUnhover: undefined,
258
+ },
259
+ dragData: {
260
+ enableDragData: false,
261
+ showTooltip: true,
262
+ roundPoints: true,
263
+ dragX: true,
264
+ dragY: true,
265
+ onDragStart: undefined,
266
+ onDrag: undefined,
267
+ onDragEnd: undefined,
268
+ },
269
+ },
270
+ };
271
+ ```
272
+
273
+ ## PieChart
274
+
275
+ ```ts
276
+ const defaultChart = {
277
+ testId: null,
278
+ data: {
279
+ labels: [],
280
+ datasets: [],
281
+ },
282
+ options: {
283
+ title: '',
284
+ chartStyling: {
285
+ width: undefined,
286
+ height: undefined,
287
+ maintainAspectRatio: false,
288
+ staticChartHeight: false,
289
+ performanceMode: true,
290
+ },
291
+ tooltip: {
292
+ tooltips: true,
293
+ showLabelsInTooltips: false,
294
+ scientificNotation: true,
295
+ },
296
+ graph: {
297
+ showDataLabels: false,
298
+ stacked: false,
299
+ cutout: 0,
300
+ },
301
+ legend: {
302
+ display: true,
303
+ useDataset: false,
304
+ position: 'bottom',
305
+ align: 'center',
306
+ },
307
+ chartOptions: {
308
+ enableZoom: false,
309
+ enablePan: false,
310
+ },
311
+ interactions: {
312
+ onLegendClick: undefined,
313
+ onHover: undefined,
314
+ onUnhover: undefined,
315
+ },
316
+ },
317
+ };
318
+ ```
319
+
320
+ ## ScatterChart
321
+
322
+ ```ts
323
+ import { GradientDirection } from '@oliasoft-open-source/charts-library';
324
+
325
+ const defaultChart = {
326
+ testId: null,
327
+ data: {
328
+ labels: [],
329
+ datasets: [],
330
+ },
331
+ options: {
332
+ title: '',
333
+ axes: {
334
+ x: [{}],
335
+ y: [{}],
336
+ },
337
+ additionalAxesOptions: {
338
+ chartScaleType: 'linear',
339
+ reverse: false,
340
+ stacked: false,
341
+ beginAtZero: true,
342
+ stepSize: undefined,
343
+ suggestedMin: undefined,
344
+ suggestedMax: undefined,
345
+ min: undefined,
346
+ max: undefined,
347
+ },
348
+ direction: 'vertical',
349
+ chartStyling: {
350
+ width: 'auto',
351
+ height: 'auto',
352
+ maintainAspectRatio: false,
353
+ staticChartHeight: false,
354
+ performanceMode: true,
355
+ gradient: {
356
+ display: false,
357
+ gradientColors: [
358
+ {
359
+ offset: 0,
360
+ color: 'rgba(144,238,144,0.8)',
361
+ },
362
+ {
363
+ offset: 0.6,
364
+ color: 'rgba(255,255,224,0.8)',
365
+ },
366
+ {
367
+ offset: 0.8,
368
+ color: 'rgba(255,255,224,0.8)',
369
+ },
370
+ {
371
+ offset: 0.92,
372
+ color: 'rgba(255,182,193,0.5)',
373
+ },
374
+ {
375
+ offset: 0.99,
376
+ color: 'rgba(255,182,193,0.8)',
377
+ },
378
+ ],
379
+ direction: GradientDirection.BottomLeftToTopRight,
380
+ },
381
+ },
382
+ tooltip: {
383
+ enabled: true,
384
+ tooltips: true,
385
+ showLabelsInTooltips: false,
386
+ backgroundColor: '#333',
387
+ displayColors: false,
388
+ scientificNotation: true,
389
+ },
390
+ graph: {
391
+ showMinorGridlines: false,
392
+ showDataLabels: false,
393
+ },
394
+ scales: {},
395
+ legend: {
396
+ display: true,
397
+ useDataset: false,
398
+ position: 'bottom-left',
399
+ align: 'center',
400
+ },
401
+ annotations: {
402
+ showAnnotations: true,
403
+ controlAnnotation: false,
404
+ annotationsData: [],
405
+ },
406
+ chartOptions: {
407
+ enableZoom: false,
408
+ enablePan: false,
409
+ },
410
+ interactions: {
411
+ onLegendClick: undefined,
412
+ onHover: undefined,
413
+ onUnhover: undefined,
414
+ onAnimationComplete: undefined,
415
+ },
416
+ },
417
+ };
418
+ ```