@cdc/chart 4.24.7 → 4.24.9

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 (51) hide show
  1. package/dist/cdcchart.js +40313 -37543
  2. package/examples/cases-year.json +13379 -0
  3. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +76 -15
  4. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +5 -5
  5. package/index.html +17 -8
  6. package/package.json +2 -2
  7. package/src/CdcChart.tsx +383 -133
  8. package/src/_stories/Chart.Legend.Gradient.tsx +19 -0
  9. package/src/_stories/_mock/legend.gradient_mock.json +236 -0
  10. package/src/components/Annotations/components/AnnotationDraggable.tsx +64 -11
  11. package/src/components/Axis/Categorical.Axis.tsx +145 -0
  12. package/src/components/BarChart/components/BarChart.Horizontal.tsx +4 -3
  13. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +1 -1
  14. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +2 -5
  15. package/src/components/BarChart/components/BarChart.Vertical.tsx +17 -8
  16. package/src/components/BarChart/helpers/index.ts +5 -16
  17. package/src/components/BrushChart.tsx +205 -0
  18. package/src/components/EditorPanel/EditorPanel.tsx +1766 -509
  19. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +19 -5
  20. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +190 -37
  21. package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +43 -7
  22. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -4
  23. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -11
  24. package/src/components/EditorPanel/editor-panel.scss +16 -3
  25. package/src/components/EditorPanel/{useEditorPermissions.js → useEditorPermissions.ts} +90 -19
  26. package/src/components/Legend/Legend.Component.tsx +185 -193
  27. package/src/components/Legend/Legend.Suppression.tsx +146 -0
  28. package/src/components/Legend/Legend.tsx +21 -5
  29. package/src/components/Legend/helpers/index.ts +33 -3
  30. package/src/components/LegendWrapper.tsx +26 -0
  31. package/src/components/LineChart/LineChartProps.ts +1 -18
  32. package/src/components/LineChart/components/LineChart.BumpCircle.tsx +103 -0
  33. package/src/components/LineChart/components/LineChart.Circle.tsx +47 -8
  34. package/src/components/LineChart/helpers.ts +55 -11
  35. package/src/components/LineChart/index.tsx +113 -38
  36. package/src/components/LinearChart.tsx +1366 -0
  37. package/src/components/PieChart/PieChart.tsx +74 -17
  38. package/src/components/Sankey/index.tsx +22 -16
  39. package/src/components/Sparkline/components/SparkLine.tsx +2 -2
  40. package/src/data/initial-state.js +13 -3
  41. package/src/hooks/useLegendClasses.ts +52 -15
  42. package/src/hooks/useMinMax.ts +4 -4
  43. package/src/hooks/useScales.ts +34 -24
  44. package/src/hooks/useTooltip.tsx +85 -22
  45. package/src/scss/DataTable.scss +2 -1
  46. package/src/scss/main.scss +107 -14
  47. package/src/types/ChartConfig.ts +34 -8
  48. package/src/types/ChartContext.ts +5 -4
  49. package/examples/feature/line/line-chart.json +0 -449
  50. package/src/components/BrushHandle.jsx +0 -17
  51. package/src/components/LineChart/index.scss +0 -1
@@ -1,4 +1,5 @@
1
1
  {
2
+ "annotations": [],
2
3
  "type": "chart",
3
4
  "debugSvg": false,
4
5
  "chartMessage": {
@@ -11,6 +12,7 @@
11
12
  "animate": false,
12
13
  "fontSize": "medium",
13
14
  "lineDatapointStyle": "hover",
15
+ "lineDatapointColor": "Same as Line",
14
16
  "barHasBorder": "false",
15
17
  "isLollipopChart": false,
16
18
  "lollipopShape": "circle",
@@ -21,13 +23,16 @@
21
23
  "tipRounding": "top",
22
24
  "isResponsiveTicks": false,
23
25
  "general": {
24
- "showDownloadButton": false
26
+ "showDownloadButton": false,
27
+ "showMissingDataLabel": true,
28
+ "showSuppressedSymbol": true,
29
+ "showZeroValueDataLabel": true
25
30
  },
26
31
  "padding": {
27
32
  "left": 5,
28
33
  "right": 5
29
34
  },
30
- "suppressedData": [],
35
+ "preliminaryData": [],
31
36
  "yAxis": {
32
37
  "hideAxis": false,
33
38
  "displayNumbersOnBar": false,
@@ -50,8 +55,11 @@
50
55
  "rightAxisTickColor": "#333",
51
56
  "numTicks": "",
52
57
  "axisPadding": 0,
58
+ "scalePadding": 10,
53
59
  "tickRotation": 0,
54
60
  "anchors": [],
61
+ "shoMissingDataLabel": true,
62
+ "showMissingDataLine": true,
55
63
  "label": "Y-Axis Label Example"
56
64
  },
57
65
  "boxplot": {
@@ -96,7 +104,7 @@
96
104
  "xAxis": {
97
105
  "sortDates": false,
98
106
  "anchors": [],
99
- "type": "date",
107
+ "type": "date-time",
100
108
  "showTargetLabel": true,
101
109
  "targetLabel": "Target",
102
110
  "hideAxis": false,
@@ -116,9 +124,10 @@
116
124
  "maxTickRotation": 0,
117
125
  "dataKey": "Date",
118
126
  "label": "X-Axis Example Label",
119
- "dateParseFormat": "%d/%m/%Y",
120
- "dateDisplayFormat": "%d/%m/%Y",
121
- "tickWidthMax": 91
127
+ "dateParseFormat": "%m/%d/%Y",
128
+ "dateDisplayFormat": "%m/%d/%Y",
129
+ "tickWidthMax": 91,
130
+ "padding": 6
122
131
  },
123
132
  "table": {
124
133
  "label": "Data Table",
@@ -131,6 +140,9 @@
131
140
  "indexLabel": "",
132
141
  "download": true,
133
142
  "showVertical": false,
143
+ "dateDisplayFormat": "",
144
+ "showMissingDataLabel": true,
145
+ "showSuppressedSymbol": true,
134
146
  "show": true
135
147
  },
136
148
  "orientation": "vertical",
@@ -139,6 +151,7 @@
139
151
  "legend": {
140
152
  "hide": false,
141
153
  "behavior": "highlight",
154
+ "axisAlign": true,
142
155
  "singleRow": false,
143
156
  "colorCode": "",
144
157
  "reverseLabelOrder": false,
@@ -150,11 +163,15 @@
150
163
  "dynamicLegendChartMessage": "Select Options from the Legend",
151
164
  "lineMode": false,
152
165
  "verticalSorted": false,
166
+ "highlightOnHover": false,
167
+ "hideSuppressedLabels": false,
168
+ "seriesHighlight": [],
153
169
  "position": "right",
154
170
  "label": "Data Type"
155
171
  },
156
172
  "brush": {
157
173
  "height": 25,
174
+ "active": true,
158
175
  "data": [
159
176
  {
160
177
  "Date": "1/15/2016",
@@ -228,8 +245,7 @@
228
245
  "Data 4": "150",
229
246
  "Monthly-Goal": "140"
230
247
  }
231
- ],
232
- "active": false
248
+ ]
233
249
  },
234
250
  "exclusions": {
235
251
  "active": false,
@@ -265,20 +281,21 @@
265
281
  "series": [
266
282
  {
267
283
  "dataKey": "Monthly-Goal",
268
- "type": "Line",
284
+ "type": "Bar",
269
285
  "axis": "Left",
270
286
  "tooltip": true
271
287
  },
272
288
  {
273
289
  "dataKey": "Data 2",
274
- "type": "Line",
290
+ "type": "Bar",
275
291
  "axis": "Left",
276
292
  "tooltip": true
277
293
  }
278
294
  ],
279
295
  "tooltips": {
280
296
  "opacity": 90,
281
- "singleSeries": false
297
+ "singleSeries": false,
298
+ "dateDisplayFormat": ""
282
299
  },
283
300
  "forestPlot": {
284
301
  "startAt": 0,
@@ -321,13 +338,56 @@
321
338
  "leftWidthOffset": 0,
322
339
  "rightWidthOffset": 0,
323
340
  "showZeroLine": false,
324
- "hideDateCategoryCol": false,
325
341
  "leftLabel": "",
326
- "rightLabel": ""
342
+ "rightLabel": "",
343
+ "hideDateCategoryCol": false
327
344
  },
328
345
  "area": {
329
346
  "isStacked": false
330
347
  },
348
+ "sankey": {
349
+ "title": {
350
+ "defaultColor": "black"
351
+ },
352
+ "iterations": 1,
353
+ "rxValue": 0.9,
354
+ "overallSize": {
355
+ "width": 900,
356
+ "height": 700
357
+ },
358
+ "margin": {
359
+ "margin_y": 25,
360
+ "margin_x": 0
361
+ },
362
+ "nodeSize": {
363
+ "nodeWidth": 26,
364
+ "nodeHeight": 40
365
+ },
366
+ "nodePadding": 55,
367
+ "nodeFontColor": "black",
368
+ "nodeColor": {
369
+ "default": "#ff8500",
370
+ "inactive": "#808080"
371
+ },
372
+ "linkColor": {
373
+ "default": "#ffc900",
374
+ "inactive": "#D3D3D3"
375
+ },
376
+ "opacity": {
377
+ "nodeOpacityDefault": 1,
378
+ "nodeOpacityInactive": 0.1,
379
+ "LinkOpacityDefault": 1,
380
+ "LinkOpacityInactive": 0.1
381
+ },
382
+ "storyNodeFontColor": "#006778",
383
+ "storyNodeText": [],
384
+ "nodeValueStyle": {
385
+ "textBefore": "(",
386
+ "textAfter": ")"
387
+ },
388
+ "data": []
389
+ },
390
+ "suppressedData": [],
331
391
  "height": "332",
332
392
  "data": [
333
393
  {
@@ -403,8 +463,9 @@
403
463
  "Monthly-Goal": "140"
404
464
  }
405
465
  ],
406
- "visualizationType": "Line",
466
+ "visualizationType": "Bar",
407
467
  "filters": [],
408
468
  "validated": 4.23,
409
- "dynamicMarginTop": 0
469
+ "dynamicMarginTop": 0,
470
+ "version": "4.24.4"
410
471
  }
@@ -339,21 +339,21 @@
339
339
  "data": [
340
340
  {
341
341
  "Year": "2015",
342
- "Data 1": "25",
342
+ "Data 1": null,
343
343
  "Data 2": "20",
344
344
  "Data 3": "55"
345
345
  },
346
346
  {
347
347
  "Year": "2016",
348
- "Data 1": "35",
348
+ "Data 1": "NULLL",
349
349
  "Data 2": "30",
350
350
  "Data 3": "35"
351
351
  },
352
352
  {
353
353
  "Year": "2017",
354
- "Data 1": "22",
355
- "Data 2": "38",
356
- "Data 3": "40"
354
+ "Data 1": "ABC",
355
+ "Data 2": "HELLO",
356
+ "Data 3": null
357
357
  },
358
358
  {
359
359
  "Year": "2018",
package/index.html CHANGED
@@ -17,7 +17,10 @@
17
17
  margin-top: 3rem;
18
18
  } */
19
19
  </style>
20
- <link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/contrib/libs/bootstrap/latest/css/bootstrap.min.css?_=39423" />
20
+ <link
21
+ rel="stylesheet prefetch"
22
+ href="https://www.cdc.gov/TemplatePackage/contrib/libs/bootstrap/latest/css/bootstrap.min.css?_=39423"
23
+ />
21
24
  <link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/4.0/assets/css/app.min.css?_=39423" />
22
25
  </head>
23
26
 
@@ -46,8 +49,11 @@
46
49
  -->
47
50
 
48
51
  <!-- GENERIC CHART TYPES -->
52
+ <div class="react-container" data-config="/examples/cases-year.json"></div>
53
+ <!-- <div class="react-container" data-config="/examples/test.json"></div> -->
54
+ <!-- <div class="react-container" data-config="/examples/feature/line/line-chart.json"></div> -->
49
55
  <!-- <div class="react-container" data-config="/examples/dev-8332.json"></div> -->
50
- <div class="react-container" data-config="/examples/feature/annotations/index.json"></div>
56
+ <!-- <div class="react-container" data-config="/examples/feature/annotations/index.json"></div> -->
51
57
  <!-- <div class="react-container" data-config="/examples/feature/filters/url-filter.json"></div> -->
52
58
  <!-- <div class="react-container" data-config="/examples/feature/bar/additional-column-tooltip.json"></div> -->
53
59
  <!-- <div class="react-container" data-config="https://cdc.gov/poxvirus/mpox/modules/data-viz/mpx-trends_1.json"></div> -->
@@ -56,7 +62,7 @@
56
62
  <!-- <div class="react-container" data-config="/examples/feature/forest-plot/linear.json"></div> -->
57
63
  <!-- <div class="react-container" data-config="/examples/feature/forest-plot/logarithmic.json"></div> -->
58
64
  <!-- <div class="react-container" data-config="/examples/feature/forest-plot/forest-plot.json"></div> -->
59
- <!-- <div class="react-container" data-config="/examples/feature/pie/planet-pie-example-config.json"></div> -->
65
+ <div class="react-container" data-config="/examples/feature/pie/planet-pie-example-config.json"></div>
60
66
  <!-- <div class="react-container" data-config=https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Line_Chart_Viz.json></div> -->
61
67
  <!-- <div class="react-container" data-config=/examples/feature/regions/index.json></div> -->
62
68
  <!-- <div class="react-container" data-config=https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Line_Chart_Regions_Viz.json></div> -->
@@ -82,9 +88,6 @@
82
88
  <!-- <div class="react-container" data-config="/examples/feature/bar/horizontal-stacked-bar-chart.json"></div> -->
83
89
  <!-- <div class="react-container" data-config="/examples/feature/bar/planet-chart-horizontal-example-config.json"></div> -->
84
90
 
85
- <!-- SPARKLINE -->
86
- <!-- <div class="react-container" data-config="/examples/feature/dev-4261.json"></div> -->
87
-
88
91
  <!-- TESTS DATA TABLE SORTING -->
89
92
  <!-- Bar Chart with Confidence Intervals (bottom of page) -->
90
93
  <!-- <div class="react-container" data-config="https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Example_Bar_CI.json"></div> -->
@@ -113,10 +116,16 @@
113
116
 
114
117
  <!-- TESTS NONNUMERICS -->
115
118
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/planet-pie-example-config-nonnumeric.json"></div> -->
116
- <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/example-combo-bar-nonnumeric.json"></div> -->
119
+ <div
120
+ class="react-container"
121
+ data-config="/examples/feature/tests-non-numerics/example-combo-bar-nonnumeric.json"
122
+ ></div>
117
123
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/example-bar-chart-nonnumeric.json"></div> -->
118
124
  <!-- <div class="react-container" data-config="/examples/sparkline.json"></div> -->
119
- <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/sparkline-chart-nonnumeric.json"></div> -->
125
+ <!-- <div
126
+ class="react-container"
127
+ data-config="/examples/feature/tests-non-numerics/sparkline-chart-nonnumeric.json"
128
+ ></div> -->
120
129
  <!-- <div class="react-container" data-config="/examples/region-issue.json"></div> -->
121
130
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/stacked-vertical-bar-example-nonnumerics.json"></div> -->
122
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/chart",
3
- "version": "4.24.7",
3
+ "version": "4.24.9",
4
4
  "description": "React component for visualizing tabular data in various types of charts",
5
5
  "moduleName": "CdcChart",
6
6
  "main": "dist/cdcchart",
@@ -61,7 +61,7 @@
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0"
63
63
  },
64
- "gitHead": "7a7372d03778cb977e0e92e3b3bc1a35f8a5bfaf",
64
+ "gitHead": "c4b0402afe6ed209a85b7078711549b9fd7dae7d",
65
65
  "devDependencies": {
66
66
  "@types/d3-sankey": "^0.12.4",
67
67
  "resize-observer-polyfill": "^1.5.1"