@cdc/chart 4.24.3 → 4.24.5

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 (39) hide show
  1. package/dist/cdcchart.js +34377 -33726
  2. package/examples/feature/line/line-chart.json +361 -37
  3. package/examples/region-issue.json +2065 -0
  4. package/examples/test.json +5409 -0
  5. package/index.html +13 -11
  6. package/package.json +2 -2
  7. package/src/CdcChart.tsx +159 -89
  8. package/src/_stories/Chart.stories.tsx +8 -0
  9. package/src/_stories/_mock/bar-chart-suppressed.json +474 -0
  10. package/src/components/AreaChart/components/AreaChart.jsx +2 -2
  11. package/src/components/BarChart/components/BarChart.Horizontal.tsx +61 -63
  12. package/src/components/BarChart/components/BarChart.Vertical.tsx +79 -94
  13. package/src/components/DeviationBar.jsx +4 -2
  14. package/src/components/EditorPanel/EditorPanel.tsx +1580 -1924
  15. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +19 -2
  16. package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +0 -1
  17. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -5
  18. package/src/components/EditorPanel/editor-panel.scss +0 -724
  19. package/src/components/EditorPanel/useEditorPermissions.js +4 -1
  20. package/src/components/Legend/Legend.Component.tsx +82 -58
  21. package/src/components/Legend/Legend.tsx +5 -1
  22. package/src/components/LineChart/LineChartProps.ts +13 -6
  23. package/src/components/LineChart/components/LineChart.Circle.tsx +22 -11
  24. package/src/components/LineChart/helpers.ts +134 -10
  25. package/src/components/LineChart/index.tsx +69 -42
  26. package/src/components/LinearChart.jsx +156 -139
  27. package/src/components/ZoomBrush.tsx +40 -21
  28. package/src/data/initial-state.js +4 -4
  29. package/src/hooks/useBarChart.js +47 -22
  30. package/src/hooks/useMinMax.ts +21 -2
  31. package/src/hooks/useScales.ts +33 -1
  32. package/src/hooks/useTooltip.tsx +11 -11
  33. package/src/scss/main.scss +80 -5
  34. package/src/types/ChartConfig.ts +3 -13
  35. package/src/types/ChartContext.ts +4 -0
  36. package/src/_stories/ChartLine.preliminary.tsx +0 -19
  37. package/src/_stories/ChartSuppress.stories.tsx +0 -19
  38. package/src/_stories/_mock/suppress_mock.json +0 -911
  39. package/src/helpers/computeMarginBottom.ts +0 -56
@@ -0,0 +1,474 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "Combo Bar-Line Chart",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-purple",
11
+ "animate": false,
12
+ "fontSize": "medium",
13
+ "lineDatapointStyle": "hover",
14
+ "lineDatapointColor": "Same as Line",
15
+ "barHasBorder": "false",
16
+ "isLollipopChart": false,
17
+ "lollipopShape": "circle",
18
+ "lollipopColorStyle": "two-tone",
19
+ "visualizationSubType": "regular",
20
+ "barStyle": "",
21
+ "roundingStyle": "standard",
22
+ "tipRounding": "top",
23
+ "isResponsiveTicks": false,
24
+ "general": {
25
+ "showDownloadButton": false
26
+ },
27
+ "padding": {
28
+ "left": 5,
29
+ "right": 5
30
+ },
31
+ "preliminaryData": [
32
+ {
33
+ "type": "suppression",
34
+ "seriesKey": "",
35
+ "label": "Suppressed",
36
+ "column": "Data 2",
37
+ "value": "ABC",
38
+ "style": "",
39
+ "displayTooltip": true,
40
+ "displayLegend": true,
41
+ "displayTable": true,
42
+ "symbol": "Dagger",
43
+ "iconCode": "†",
44
+ "lineCode": ""
45
+ }
46
+ ],
47
+ "yAxis": {
48
+ "hideAxis": false,
49
+ "displayNumbersOnBar": false,
50
+ "hideLabel": false,
51
+ "hideTicks": false,
52
+ "size": "68",
53
+ "gridLines": true,
54
+ "enablePadding": false,
55
+ "min": "",
56
+ "max": "",
57
+ "labelColor": "#333",
58
+ "tickLabelColor": "#333",
59
+ "tickColor": "#333",
60
+ "rightHideAxis": true,
61
+ "rightAxisSize": 50,
62
+ "rightLabel": "",
63
+ "rightLabelOffsetSize": 0,
64
+ "rightAxisLabelColor": "#333",
65
+ "rightAxisTickLabelColor": "#333",
66
+ "rightAxisTickColor": "#333",
67
+ "numTicks": "",
68
+ "axisPadding": 0,
69
+ "scalePadding": 10,
70
+ "tickRotation": 0,
71
+ "anchors": [],
72
+ "label": "Y-Axis Label Example"
73
+ },
74
+ "boxplot": {
75
+ "plots": [],
76
+ "borders": "true",
77
+ "firstQuartilePercentage": 25,
78
+ "thirdQuartilePercentage": 75,
79
+ "boxWidthPercentage": 40,
80
+ "plotOutlierValues": false,
81
+ "plotNonOutlierValues": true,
82
+ "legend": {
83
+ "showHowToReadText": false,
84
+ "howToReadText": ""
85
+ },
86
+ "labels": {
87
+ "q1": "Lower Quartile",
88
+ "q2": "q2",
89
+ "q3": "Upper Quartile",
90
+ "q4": "q4",
91
+ "minimum": "Minimum",
92
+ "maximum": "Maximum",
93
+ "mean": "Mean",
94
+ "median": "Median",
95
+ "sd": "Standard Deviation",
96
+ "iqr": "Interquartile Range",
97
+ "total": "Total",
98
+ "outliers": "Outliers",
99
+ "values": "Values"
100
+ }
101
+ },
102
+ "topAxis": {
103
+ "hasLine": false
104
+ },
105
+ "isLegendValue": false,
106
+ "barThickness": 0.35,
107
+ "barHeight": 25,
108
+ "barSpace": 15,
109
+ "heights": {
110
+ "vertical": 300,
111
+ "horizontal": 750
112
+ },
113
+ "xAxis": {
114
+ "sortDates": false,
115
+ "anchors": [],
116
+ "type": "date",
117
+ "showTargetLabel": true,
118
+ "targetLabel": "Target",
119
+ "hideAxis": false,
120
+ "hideLabel": false,
121
+ "hideTicks": false,
122
+ "size": "78",
123
+ "tickRotation": "25",
124
+ "min": "",
125
+ "max": "",
126
+ "labelColor": "#333",
127
+ "tickLabelColor": "#333",
128
+ "tickColor": "#333",
129
+ "numTicks": "",
130
+ "labelOffset": 65,
131
+ "axisPadding": 0,
132
+ "target": 0,
133
+ "maxTickRotation": 0,
134
+ "showSuppressedSymbol": true,
135
+ "showSuppressedLine": true,
136
+ "dataKey": "Date",
137
+ "label": "X-Axis Example Label",
138
+ "dateParseFormat": "%d/%m/%Y",
139
+ "dateDisplayFormat": "%d/%m/%Y",
140
+ "tickWidthMax": 91,
141
+ "padding": 6
142
+ },
143
+ "table": {
144
+ "label": "Data Table",
145
+ "expanded": true,
146
+ "limitHeight": false,
147
+ "height": "",
148
+ "caption": "",
149
+ "showDownloadUrl": false,
150
+ "showDataTableLink": true,
151
+ "indexLabel": "",
152
+ "download": true,
153
+ "showVertical": false,
154
+ "dateDisplayFormat": "",
155
+ "show": true
156
+ },
157
+ "orientation": "vertical",
158
+ "color": "pinkpurple",
159
+ "columns": {},
160
+ "legend": {
161
+ "hide": false,
162
+ "behavior": "highlight",
163
+ "axisAlign": true,
164
+ "singleRow": false,
165
+ "colorCode": "",
166
+ "reverseLabelOrder": false,
167
+ "description": "",
168
+ "dynamicLegend": false,
169
+ "dynamicLegendDefaultText": "Show All",
170
+ "dynamicLegendItemLimit": 5,
171
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
172
+ "dynamicLegendChartMessage": "Select Options from the Legend",
173
+ "lineMode": false,
174
+ "verticalSorted": false,
175
+ "highlightOnHover": false,
176
+ "hideSuppressedLabels": false,
177
+ "seriesHighlight": [],
178
+ "position": "right",
179
+ "label": "Data Type"
180
+ },
181
+ "brush": {
182
+ "height": 25,
183
+ "active": false,
184
+ "data": [
185
+ {
186
+ "Date": "1/15/2016",
187
+ "Data 1": "1000",
188
+ "Data 2": "110",
189
+ "Data 3": "100",
190
+ "Data 4": "90",
191
+ "Monthly-Goal": "100"
192
+ },
193
+ {
194
+ "Date": "2/15/2016",
195
+ "Data 1": "100",
196
+ "Data 2": "110",
197
+ "Data 3": "100",
198
+ "Data 4": "100",
199
+ "Monthly-Goal": "100"
200
+ },
201
+ {
202
+ "Date": "3/15/2016",
203
+ "Data 1": "80",
204
+ "Data 2": "90",
205
+ "Data 3": "100",
206
+ "Data 4": "120",
207
+ "Monthly-Goal": "110"
208
+ },
209
+ {
210
+ "Date": "4/15/2016",
211
+ "Data 1": "80",
212
+ "Data 2": "90",
213
+ "Data 3": "110",
214
+ "Data 4": "120",
215
+ "Monthly-Goal": "110"
216
+ },
217
+ {
218
+ "Date": "5/15/2016",
219
+ "Data 1": "70",
220
+ "Data 2": "90",
221
+ "Data 3": "110",
222
+ "Data 4": "130",
223
+ "Monthly-Goal": "120"
224
+ },
225
+ {
226
+ "Date": "6/15/2016",
227
+ "Data 1": "100",
228
+ "Data 2": "120",
229
+ "Data 3": "120",
230
+ "Data 4": "130",
231
+ "Monthly-Goal": "120"
232
+ },
233
+ {
234
+ "Date": "7/15/2016",
235
+ "Data 1": "110",
236
+ "Data 2": "140",
237
+ "Data 3": "120",
238
+ "Data 4": "130",
239
+ "Monthly-Goal": "130"
240
+ },
241
+ {
242
+ "Date": "8/15/2016",
243
+ "Data 1": "110",
244
+ "Data 2": "130",
245
+ "Data 3": "120",
246
+ "Data 4": "140",
247
+ "Monthly-Goal": "130"
248
+ },
249
+ {
250
+ "Date": "9/15/2016",
251
+ "Data 1": "120",
252
+ "Data 2": "130",
253
+ "Data 3": "120",
254
+ "Data 4": "150",
255
+ "Monthly-Goal": "140"
256
+ }
257
+ ]
258
+ },
259
+ "exclusions": {
260
+ "active": false,
261
+ "keys": []
262
+ },
263
+ "palette": "qualitative-soft",
264
+ "isPaletteReversed": false,
265
+ "twoColor": {
266
+ "palette": "monochrome-1",
267
+ "isPaletteReversed": false
268
+ },
269
+ "labels": true,
270
+ "dataFormat": {
271
+ "commas": false,
272
+ "prefix": "",
273
+ "suffix": "",
274
+ "abbreviated": false,
275
+ "bottomSuffix": "",
276
+ "bottomPrefix": "",
277
+ "bottomAbbreviated": false
278
+ },
279
+ "confidenceKeys": {},
280
+ "visual": {
281
+ "border": true,
282
+ "accent": true,
283
+ "background": true,
284
+ "verticalHoverLine": false,
285
+ "horizontalHoverLine": false
286
+ },
287
+ "useLogScale": false,
288
+ "filterBehavior": "Filter Change",
289
+ "highlightedBarValues": [],
290
+ "series": [
291
+ {
292
+ "dataKey": "Data 2",
293
+ "type": "Bar",
294
+ "axis": "Left",
295
+ "tooltip": true
296
+ }
297
+ ],
298
+ "tooltips": {
299
+ "opacity": 90,
300
+ "singleSeries": false,
301
+ "dateDisplayFormat": ""
302
+ },
303
+ "forestPlot": {
304
+ "startAt": 0,
305
+ "colors": {
306
+ "line": "",
307
+ "shape": ""
308
+ },
309
+ "lineOfNoEffect": {
310
+ "show": true
311
+ },
312
+ "type": "",
313
+ "pooledResult": {
314
+ "diamondHeight": 5,
315
+ "column": ""
316
+ },
317
+ "estimateField": "",
318
+ "estimateRadius": "",
319
+ "shape": "",
320
+ "rowHeight": 20,
321
+ "description": {
322
+ "show": true,
323
+ "text": "description",
324
+ "location": 0
325
+ },
326
+ "result": {
327
+ "show": true,
328
+ "text": "result",
329
+ "location": 100
330
+ },
331
+ "radius": {
332
+ "min": 1,
333
+ "max": 8,
334
+ "scalingColumn": ""
335
+ },
336
+ "regression": {
337
+ "lower": 0,
338
+ "upper": 0,
339
+ "estimateField": 0
340
+ },
341
+ "leftWidthOffset": 0,
342
+ "rightWidthOffset": 0,
343
+ "showZeroLine": false,
344
+ "leftLabel": "",
345
+ "rightLabel": "",
346
+ "hideDateCategoryCol": false
347
+ },
348
+ "area": {
349
+ "isStacked": false
350
+ },
351
+ "sankey": {
352
+ "title": {
353
+ "defaultColor": "black"
354
+ },
355
+ "iterations": 1,
356
+ "rxValue": 0.9,
357
+ "overallSize": {
358
+ "width": 900,
359
+ "height": 700
360
+ },
361
+ "margin": {
362
+ "margin_y": 25,
363
+ "margin_x": 0
364
+ },
365
+ "nodeSize": {
366
+ "nodeWidth": 26,
367
+ "nodeHeight": 40
368
+ },
369
+ "nodePadding": 55,
370
+ "nodeFontColor": "black",
371
+ "nodeColor": {
372
+ "default": "#ff8500",
373
+ "inactive": "#808080"
374
+ },
375
+ "linkColor": {
376
+ "default": "#ffc900",
377
+ "inactive": "#D3D3D3"
378
+ },
379
+ "opacity": {
380
+ "nodeOpacityDefault": 1,
381
+ "nodeOpacityInactive": 0.1,
382
+ "LinkOpacityDefault": 1,
383
+ "LinkOpacityInactive": 0.1
384
+ },
385
+ "storyNodeFontColor": "#006778",
386
+ "storyNodeText": [],
387
+ "nodeValueStyle": {
388
+ "textBefore": "(",
389
+ "textAfter": ")"
390
+ },
391
+ "data": []
392
+ },
393
+ "suppressedData": [],
394
+ "height": "332",
395
+ "data": [
396
+ {
397
+ "Date": "1/15/2016",
398
+ "Data 1": "$1,000",
399
+ "Data 2": "ABC",
400
+ "Data 3": "100",
401
+ "Data 4": "90",
402
+ "Monthly-Goal": "100"
403
+ },
404
+ {
405
+ "Date": "2/15/2016",
406
+ "Data 1": "100",
407
+ "Data 2": "110",
408
+ "Data 3": "100",
409
+ "Data 4": "100",
410
+ "Monthly-Goal": "100"
411
+ },
412
+ {
413
+ "Date": "3/15/2016",
414
+ "Data 1": "80",
415
+ "Data 2": "90",
416
+ "Data 3": "100",
417
+ "Data 4": "120",
418
+ "Monthly-Goal": "110"
419
+ },
420
+ {
421
+ "Date": "4/15/2016",
422
+ "Data 1": "80",
423
+ "Data 2": "90",
424
+ "Data 3": "110",
425
+ "Data 4": "120",
426
+ "Monthly-Goal": "110"
427
+ },
428
+ {
429
+ "Date": "5/15/2016",
430
+ "Data 1": "70",
431
+ "Data 2": "90",
432
+ "Data 3": "110",
433
+ "Data 4": "130",
434
+ "Monthly-Goal": "120"
435
+ },
436
+ {
437
+ "Date": "6/15/2016",
438
+ "Data 1": "100",
439
+ "Data 2": "120",
440
+ "Data 3": "120",
441
+ "Data 4": "130",
442
+ "Monthly-Goal": "120"
443
+ },
444
+ {
445
+ "Date": "7/15/2016",
446
+ "Data 1": "110",
447
+ "Data 2": "140",
448
+ "Data 3": "120",
449
+ "Data 4": "130",
450
+ "Monthly-Goal": "130"
451
+ },
452
+ {
453
+ "Date": "8/15/2016",
454
+ "Data 1": "110",
455
+ "Data 2": "130",
456
+ "Data 3": "120",
457
+ "Data 4": "140",
458
+ "Monthly-Goal": "130"
459
+ },
460
+ {
461
+ "Date": "9/15/2016",
462
+ "Data 1": "120",
463
+ "Data 2": "",
464
+ "Data 3": "120",
465
+ "Data 4": "150",
466
+ "Monthly-Goal": "140"
467
+ }
468
+ ],
469
+ "visualizationType": "Bar",
470
+ "filters": [],
471
+ "validated": 4.23,
472
+ "dynamicMarginTop": 0,
473
+ "version": "4.24.4"
474
+ }
@@ -14,8 +14,8 @@ import { bisector } from 'd3-array'
14
14
  const AreaChart = props => {
15
15
  const { xScale, yScale, yMax, xMax, handleTooltipMouseOver, handleTooltipMouseOff, isDebug, children } = props
16
16
  // import data from context
17
- let { transformedData, config, handleLineType, parseDate, formatDate, formatNumber, seriesHighlight, colorScale, rawData } = useContext(ConfigContext)
18
- const data = config.brush.active && config.brush.data?.length ? config.brush.data : transformedData
17
+ let { transformedData, config, handleLineType, parseDate, formatDate, formatNumber, seriesHighlight, colorScale, rawData, brushConfig } = useContext(ConfigContext)
18
+ const data = config.brush.active && brushConfig.data?.length ? brushConfig.data : transformedData
19
19
 
20
20
  if (!data) return
21
21