@cdc/chart 4.25.7 → 4.25.10

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 (95) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/dist/cdcchart.js +39551 -37016
  3. package/examples/feature/__data__/planet-example-data.json +0 -30
  4. package/examples/grouped-bar-test.json +400 -0
  5. package/examples/private/d.json +382 -0
  6. package/examples/private/example-2.json +49784 -0
  7. package/examples/private/f2.json +1 -0
  8. package/examples/private/f4.json +1577 -0
  9. package/examples/private/forecast.json +1180 -0
  10. package/examples/private/lollipop.json +468 -0
  11. package/examples/private/new.json +48756 -0
  12. package/examples/private/pie-chart-legend.json +904 -0
  13. package/examples/suppressed_tooltip.json +480 -0
  14. package/index.html +10 -22
  15. package/package.json +25 -7
  16. package/src/CdcChart.tsx +10 -4
  17. package/src/CdcChartComponent.tsx +188 -32
  18. package/src/_stories/Chart.Anchors.stories.tsx +2 -2
  19. package/src/_stories/Chart.BoxPlot.stories.tsx +1 -1
  20. package/src/_stories/Chart.CI.stories.tsx +1 -1
  21. package/src/_stories/Chart.CustomColors.stories.tsx +1 -1
  22. package/src/_stories/Chart.DynamicSeries.stories.tsx +2 -2
  23. package/src/_stories/Chart.Filters.stories.tsx +2 -2
  24. package/src/_stories/Chart.Legend.Gradient.stories.tsx +2 -2
  25. package/src/_stories/Chart.Patterns.stories.tsx +19 -0
  26. package/src/_stories/Chart.ScatterPlot.stories.tsx +1 -1
  27. package/src/_stories/Chart.stories.tsx +8 -5
  28. package/src/_stories/Chart.tooltip.stories.tsx +1 -1
  29. package/src/_stories/ChartAnnotation.stories.tsx +1 -1
  30. package/src/_stories/ChartAxisLabels.stories.tsx +2 -2
  31. package/src/_stories/ChartAxisTitles.stories.tsx +2 -2
  32. package/src/_stories/ChartEditor.stories.tsx +60 -60
  33. package/src/_stories/ChartLine.Suppression.stories.tsx +1 -1
  34. package/src/_stories/ChartLine.Symbols.stories.tsx +1 -1
  35. package/src/_stories/ChartPrefixSuffix.stories.tsx +2 -2
  36. package/src/_stories/_mock/stacked-pattern-test.json +520 -0
  37. package/src/components/Annotations/components/AnnotationDraggable.tsx +1 -0
  38. package/src/components/Annotations/components/AnnotationDropdown.tsx +1 -1
  39. package/src/components/BarChart/components/BarChart.Horizontal.tsx +170 -25
  40. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +139 -6
  41. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +215 -73
  42. package/src/components/BarChart/components/BarChart.Vertical.tsx +172 -23
  43. package/src/components/BarChart/helpers/index.ts +43 -4
  44. package/src/components/BarChart/helpers/lollipopColors.ts +27 -0
  45. package/src/components/BarChart/helpers/useBarChart.ts +25 -3
  46. package/src/components/BoxPlot/BoxPlot.Vertical.tsx +2 -1
  47. package/src/components/Brush/BrushChart.tsx +65 -10
  48. package/src/components/Brush/BrushController.tsx +37 -5
  49. package/src/components/Brush/types.tsx +8 -0
  50. package/src/components/DeviationBar.jsx +9 -6
  51. package/src/components/EditorPanel/EditorPanel.tsx +364 -39
  52. package/src/components/EditorPanel/EditorPanelContext.ts +3 -0
  53. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +2 -2
  54. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +414 -0
  55. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +30 -54
  56. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +115 -120
  57. package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
  58. package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +0 -8
  59. package/src/components/EditorPanel/helpers/updateFieldRankByValue.ts +49 -48
  60. package/src/components/Forecasting/Forecasting.tsx +36 -6
  61. package/src/components/ForestPlot/ForestPlot.tsx +11 -7
  62. package/src/components/ForestPlot/ForestPlotProps.ts +1 -1
  63. package/src/components/Legend/Legend.Component.tsx +110 -2
  64. package/src/components/Legend/Legend.tsx +3 -1
  65. package/src/components/Legend/helpers/createFormatLabels.tsx +230 -171
  66. package/src/components/LegendWrapper.tsx +1 -1
  67. package/src/components/LineChart/components/LineChart.BumpCircle.tsx +27 -26
  68. package/src/components/LineChart/components/LineChart.Circle.tsx +2 -2
  69. package/src/components/LineChart/index.tsx +2 -2
  70. package/src/components/LinearChart.tsx +26 -9
  71. package/src/components/PairedBarChart.jsx +6 -4
  72. package/src/components/PieChart/PieChart.tsx +170 -54
  73. package/src/components/Sankey/components/Sankey.tsx +7 -1
  74. package/src/components/ScatterPlot/ScatterPlot.jsx +32 -4
  75. package/src/data/initial-state.js +315 -292
  76. package/src/helpers/buildForecastPaletteMappings.ts +112 -0
  77. package/src/helpers/buildForecastPaletteOptions.ts +109 -0
  78. package/src/helpers/getColorScale.ts +72 -8
  79. package/src/helpers/getNewRuntime.ts +1 -1
  80. package/src/helpers/getTransformedData.ts +1 -1
  81. package/src/hooks/useChartHoverAnalytics.tsx +44 -0
  82. package/src/hooks/useReduceData.ts +105 -70
  83. package/src/hooks/useTooltip.tsx +58 -16
  84. package/src/index.jsx +6 -3
  85. package/src/scss/main.scss +12 -0
  86. package/src/store/chart.reducer.ts +1 -1
  87. package/src/test/CdcChart.test.jsx +8 -3
  88. package/src/types/ChartConfig.ts +30 -6
  89. package/src/types/ChartContext.ts +1 -0
  90. package/vite.config.js +1 -1
  91. package/vitest.config.ts +16 -0
  92. package/src/coreStyles_chart.scss +0 -3
  93. package/src/helpers/configHelpers.ts +0 -28
  94. package/src/helpers/generateColorsArray.ts +0 -8
  95. package/src/hooks/useColorPalette.js +0 -76
@@ -17,34 +17,4 @@
17
17
  "Diameter": "18",
18
18
  "distance": "40"
19
19
  },
20
- {
21
- "name": "Neptune",
22
- "Radius": "700",
23
- "Diameter": "18",
24
- "distance": "0"
25
- },
26
- {
27
- "name": "Venus",
28
- "Radius": "500",
29
- "Diameter": "18",
30
- "distance": "0"
31
- },
32
- {
33
- "name": "Mars",
34
- "Radius": "400",
35
- "Diameter": "18",
36
- "distance": "0"
37
- },
38
- {
39
- "name": "Mercury",
40
- "Radius": "300",
41
- "Diameter": "22",
42
- "distance": "0"
43
- },
44
- {
45
- "name": "Pluto",
46
- "Radius": "200",
47
- "Diameter": "22",
48
- "distance": "0"
49
- }
50
20
  ]
@@ -0,0 +1,400 @@
1
+ {
2
+ "annotations": [],
3
+ "allowLineToBarGraph": "__​undefined__",
4
+ "type": "chart",
5
+ "debugSvg": false,
6
+ "chartMessage": {
7
+ "noData": "No Data Available"
8
+ },
9
+ "title": "Sales Performance by Quarter - Grouped Bar Chart",
10
+ "showTitle": true,
11
+ "showDownloadMediaButton": false,
12
+ "theme": "theme-blue",
13
+ "animate": true,
14
+ "lineDatapointStyle": "hover",
15
+ "lineDatapointColor": "Same as Line",
16
+ "barHasBorder": "true",
17
+ "isLollipopChart": false,
18
+ "lollipopShape": "circle",
19
+ "lollipopColorStyle": "two-tone",
20
+ "visualizationSubType": "regular",
21
+ "barStyle": "",
22
+ "roundingStyle": "standard",
23
+ "tipRounding": "top",
24
+ "isResponsiveTicks": false,
25
+ "general": {
26
+ "annotationDropdownText": "Annotations",
27
+ "showMissingDataLabel": true,
28
+ "showSuppressedSymbol": true,
29
+ "showZeroValueData": true,
30
+ "hideNullValue": true,
31
+ "palette": {
32
+ "isReversed": true,
33
+ "version": "2.0",
34
+ "name": "sequential_bluereverse"
35
+ }
36
+ },
37
+ "padding": {
38
+ "left": 5,
39
+ "right": 5
40
+ },
41
+ "preliminaryData": [],
42
+ "yAxis": {
43
+ "hideAxis": false,
44
+ "displayNumbersOnBar": false,
45
+ "hideLabel": false,
46
+ "hideTicks": false,
47
+ "size": 80,
48
+ "gridLines": true,
49
+ "enablePadding": false,
50
+ "min": "",
51
+ "max": "",
52
+ "labelColor": "#1c1d1f",
53
+ "tickLabelColor": "#1c1d1f",
54
+ "tickColor": "#1c1d1f",
55
+ "rightHideAxis": false,
56
+ "rightAxisSize": 0,
57
+ "rightLabel": "",
58
+ "rightLabelOffsetSize": 0,
59
+ "rightAxisLabelColor": "#1c1d1f",
60
+ "rightAxisTickLabelColor": "#1c1d1f",
61
+ "rightAxisTickColor": "#1c1d1f",
62
+ "numTicks": "",
63
+ "axisPadding": 0,
64
+ "scalePadding": 10,
65
+ "tickRotation": 0,
66
+ "anchors": [],
67
+ "shoMissingDataLabel": true,
68
+ "showMissingDataLine": true,
69
+ "categories": [],
70
+ "label": "Sales (thousands)"
71
+ },
72
+ "boxplot": {
73
+ "plots": [],
74
+ "borders": "true",
75
+ "plotOutlierValues": false,
76
+ "plotNonOutlierValues": true,
77
+ "labels": {
78
+ "q1": "Lower Quartile",
79
+ "q2": "q2",
80
+ "q3": "Upper Quartile",
81
+ "q4": "q4",
82
+ "minimum": "Minimum",
83
+ "maximum": "Maximum",
84
+ "mean": "Mean",
85
+ "median": "Median",
86
+ "sd": "Standard Deviation",
87
+ "iqr": "Interquartile Range",
88
+ "count": "Count",
89
+ "outliers": "Outliers",
90
+ "values": "Values",
91
+ "lowerBounds": "Lower Bounds",
92
+ "upperBounds": "Upper Bounds"
93
+ }
94
+ },
95
+ "topAxis": {
96
+ "hasLine": false
97
+ },
98
+ "isLegendValue": false,
99
+ "barThickness": 0.8,
100
+ "barHeight": 25,
101
+ "barSpace": 15,
102
+ "heights": {
103
+ "vertical": 300,
104
+ "horizontal": 750
105
+ },
106
+ "xAxis": {
107
+ "sortDates": false,
108
+ "anchors": [],
109
+ "type": "categorical",
110
+ "showTargetLabel": true,
111
+ "targetLabel": "Target",
112
+ "hideAxis": false,
113
+ "hideLabel": false,
114
+ "hideTicks": false,
115
+ "size": 60,
116
+ "tickRotation": 0,
117
+ "min": "",
118
+ "max": "",
119
+ "labelColor": "#1c1d1f",
120
+ "tickLabelColor": "#1c1d1f",
121
+ "tickColor": "#1c1d1f",
122
+ "numTicks": "",
123
+ "labelOffset": 0,
124
+ "axisPadding": 200,
125
+ "target": 0,
126
+ "maxTickRotation": 0,
127
+ "padding": 5,
128
+ "showYearsOnce": false,
129
+ "sortByRecentDate": false,
130
+ "brushActive": false,
131
+ "dataKey": "Quarter",
132
+ "label": "Quarter",
133
+ "axisBBox": 62.279998779296875,
134
+ "tickWidthMax": 65
135
+ },
136
+ "table": {
137
+ "label": "Sales Data by Quarter",
138
+ "expanded": false,
139
+ "limitHeight": false,
140
+ "height": "",
141
+ "caption": "",
142
+ "showDownloadUrl": false,
143
+ "showDataTableLink": true,
144
+ "showDownloadLinkBelow": true,
145
+ "indexLabel": "",
146
+ "download": true,
147
+ "showVertical": false,
148
+ "dateDisplayFormat": "",
149
+ "showMissingDataLabel": true,
150
+ "showSuppressedSymbol": true,
151
+ "collapsible": true,
152
+ "show": true
153
+ },
154
+ "orientation": "vertical",
155
+ "columns": {},
156
+ "legend": {
157
+ "hide": false,
158
+ "behavior": "isolate",
159
+ "axisAlign": true,
160
+ "singleRow": false,
161
+ "colorCode": "",
162
+ "reverseLabelOrder": false,
163
+ "description": "",
164
+ "dynamicLegend": false,
165
+ "dynamicLegendDefaultText": "Show All",
166
+ "dynamicLegendItemLimit": 5,
167
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
168
+ "dynamicLegendChartMessage": "Select Options from the Legend",
169
+ "label": "Product Lines",
170
+ "lineMode": false,
171
+ "verticalSorted": false,
172
+ "highlightOnHover": false,
173
+ "hideSuppressedLabels": false,
174
+ "hideSuppressionLink": false,
175
+ "seriesHighlight": [],
176
+ "style": "circles",
177
+ "subStyle": "linear blocks",
178
+ "groupBy": "",
179
+ "shape": "circle",
180
+ "tickRotation": "",
181
+ "order": "dataColumn",
182
+ "hideBorder": {
183
+ "side": false,
184
+ "topBottom": true
185
+ },
186
+ "position": "bottom",
187
+ "orderedValues": [],
188
+ "patterns": {
189
+ "Pattern1": {
190
+ "label": "Pattern1",
191
+ "color": "#000000",
192
+ "shape": "circles",
193
+ "dataKey": "Books",
194
+ "dataValue": "95",
195
+ "patternSize": 8,
196
+ "contrastCheck": false
197
+ }
198
+ },
199
+ "patternField": "",
200
+ "unified": true
201
+ },
202
+ "exclusions": {
203
+ "active": false,
204
+ "keys": []
205
+ },
206
+ "twoColor": {
207
+ "palette": "monochrome-1",
208
+ "isPaletteReversed": false
209
+ },
210
+ "labels": false,
211
+ "dataFormat": {
212
+ "commas": true,
213
+ "prefix": "$",
214
+ "suffix": "K",
215
+ "abbreviated": false,
216
+ "bottomSuffix": "",
217
+ "bottomPrefix": "",
218
+ "bottomAbbreviated": false
219
+ },
220
+ "filters": [],
221
+ "confidenceKeys": {},
222
+ "visual": {
223
+ "border": true,
224
+ "accent": true,
225
+ "background": true,
226
+ "verticalHoverLine": false,
227
+ "horizontalHoverLine": false,
228
+ "lineDatapointSymbol": "none",
229
+ "maximumShapeAmount": 7
230
+ },
231
+ "useLogScale": false,
232
+ "filterBehavior": "Filter Change",
233
+ "highlightedBarValues": [],
234
+ "series": [
235
+ {
236
+ "dataKey": "Electronics",
237
+ "type": "Bar",
238
+ "tooltip": true,
239
+ "axis": "Left"
240
+ },
241
+ {
242
+ "dataKey": "Clothing",
243
+ "type": "Bar",
244
+ "tooltip": true,
245
+ "axis": "Left"
246
+ },
247
+ {
248
+ "dataKey": "HomeGoods",
249
+ "type": "Bar",
250
+ "tooltip": true,
251
+ "axis": "Left"
252
+ },
253
+ {
254
+ "dataKey": "Books",
255
+ "type": "Bar",
256
+ "tooltip": true,
257
+ "axis": "Left"
258
+ }
259
+ ],
260
+ "tooltips": {
261
+ "opacity": 90,
262
+ "singleSeries": false,
263
+ "dateDisplayFormat": ""
264
+ },
265
+ "forestPlot": {
266
+ "startAt": 0,
267
+ "colors": {
268
+ "line": "",
269
+ "shape": ""
270
+ },
271
+ "lineOfNoEffect": {
272
+ "show": true
273
+ },
274
+ "type": "",
275
+ "pooledResult": {
276
+ "diamondHeight": 5,
277
+ "column": ""
278
+ },
279
+ "estimateField": "",
280
+ "estimateRadius": "",
281
+ "shape": "square",
282
+ "rowHeight": 20,
283
+ "description": {
284
+ "show": true,
285
+ "text": "description",
286
+ "location": 0
287
+ },
288
+ "result": {
289
+ "show": true,
290
+ "text": "result",
291
+ "location": 100
292
+ },
293
+ "radius": {
294
+ "min": 2,
295
+ "max": 10,
296
+ "scalingColumn": ""
297
+ },
298
+ "regression": {
299
+ "lower": 0,
300
+ "upper": 0,
301
+ "estimateField": 0
302
+ },
303
+ "leftWidthOffset": 0,
304
+ "rightWidthOffset": 0,
305
+ "showZeroLine": false,
306
+ "leftLabel": "",
307
+ "rightLabel": ""
308
+ },
309
+ "area": {
310
+ "isStacked": false
311
+ },
312
+ "sankey": {
313
+ "title": {
314
+ "defaultColor": "black"
315
+ },
316
+ "iterations": 1,
317
+ "rxValue": 0.9,
318
+ "overallSize": {
319
+ "width": 900,
320
+ "height": 700
321
+ },
322
+ "margin": {
323
+ "margin_y": 25,
324
+ "margin_x": 0
325
+ },
326
+ "nodeSize": {
327
+ "nodeWidth": 26,
328
+ "nodeHeight": 40
329
+ },
330
+ "nodePadding": 55,
331
+ "nodeFontColor": "black",
332
+ "nodeColor": {
333
+ "default": "#ff8500",
334
+ "inactive": "#808080"
335
+ },
336
+ "linkColor": {
337
+ "default": "#ffc900",
338
+ "inactive": "#D3D3D3"
339
+ },
340
+ "opacity": {
341
+ "nodeOpacityDefault": 1,
342
+ "nodeOpacityInactive": 0.1,
343
+ "LinkOpacityDefault": 1,
344
+ "LinkOpacityInactive": 0.1
345
+ },
346
+ "storyNodeFontColor": "#006778",
347
+ "storyNodeText": [],
348
+ "nodeValueStyle": {
349
+ "textBefore": "(",
350
+ "textAfter": ")"
351
+ },
352
+ "data": []
353
+ },
354
+ "visualizationType": "Bar",
355
+ "height": 400,
356
+ "fontSize": "medium",
357
+ "description": "A grouped bar chart showing sales performance across four product lines over five quarters",
358
+ "version": "4.25.9",
359
+ "migrations": {
360
+ "addColorMigration": true
361
+ },
362
+ "dynamicMarginTop": 0,
363
+ "data": [
364
+ {
365
+ "Quarter": "Q1 2023",
366
+ "Electronics": 250,
367
+ "Clothing": 180,
368
+ "HomeGoods": 120,
369
+ "Books": 95
370
+ },
371
+ {
372
+ "Quarter": "Q2 2023",
373
+ "Electronics": 320,
374
+ "Clothing": 220,
375
+ "HomeGoods": 140,
376
+ "Books": 110
377
+ },
378
+ {
379
+ "Quarter": "Q3 2023",
380
+ "Electronics": 380,
381
+ "Clothing": 190,
382
+ "HomeGoods": 160,
383
+ "Books": 85
384
+ },
385
+ {
386
+ "Quarter": "Q4 2023",
387
+ "Electronics": 450,
388
+ "Clothing": 280,
389
+ "HomeGoods": 200,
390
+ "Books": 125
391
+ },
392
+ {
393
+ "Quarter": "Q1 2024",
394
+ "Electronics": 280,
395
+ "Clothing": 240,
396
+ "HomeGoods": 180,
397
+ "Books": 140
398
+ }
399
+ ]
400
+ }