@cdc/chart 4.23.10 → 4.23.11

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 (56) hide show
  1. package/dist/cdcchart.js +30989 -29057
  2. package/examples/feature/bar/example-bar-chart.json +1 -46
  3. package/examples/feature/bar/lollipop.json +156 -0
  4. package/examples/feature/combo/planet-combo-example-config.json +99 -9
  5. package/examples/feature/dev-4261.json +399 -0
  6. package/examples/feature/forest-plot/{broken.json → linear.json} +55 -50
  7. package/examples/feature/forest-plot/logarithmic.json +306 -0
  8. package/examples/feature/line/line-points.json +340 -0
  9. package/examples/feature/regions/index.json +462 -0
  10. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +181 -48
  11. package/examples/sparkline-multilple.json +846 -0
  12. package/index.html +10 -6
  13. package/package.json +3 -3
  14. package/src/CdcChart.tsx +75 -63
  15. package/src/_stories/Chart.stories.tsx +188 -0
  16. package/src/_stories/Chart.tooltip.stories.tsx +305 -0
  17. package/src/_stories/ChartBrush.stories.tsx +19 -0
  18. package/src/_stories/ChartSuppress.stories.tsx +19 -0
  19. package/src/_stories/_mock/brush_mock.json +393 -0
  20. package/src/_stories/_mock/suppress_mock.json +911 -0
  21. package/src/components/AreaChart.Stacked.jsx +4 -5
  22. package/src/components/AreaChart.jsx +6 -35
  23. package/src/components/{BarChart.Horizontal.jsx → BarChart.Horizontal.tsx} +106 -29
  24. package/src/components/{BarChart.StackedHorizontal.jsx → BarChart.StackedHorizontal.tsx} +22 -17
  25. package/src/components/{BarChart.StackedVertical.jsx → BarChart.StackedVertical.tsx} +22 -26
  26. package/src/components/{BarChart.Vertical.jsx → BarChart.Vertical.tsx} +175 -31
  27. package/src/components/BarChart.jsx +1 -1
  28. package/src/components/DeviationBar.jsx +4 -3
  29. package/src/components/EditorPanel.jsx +176 -50
  30. package/src/components/ForestPlot/ForestPlotProps.ts +11 -0
  31. package/src/components/ForestPlot/Readme.md +0 -0
  32. package/src/components/ForestPlot/index.scss +1 -0
  33. package/src/components/{ForestPlot.jsx → ForestPlot/index.tsx} +51 -31
  34. package/src/components/ForestPlotSettings.jsx +162 -113
  35. package/src/components/Legend.jsx +36 -3
  36. package/src/components/{LineChart.Circle.tsx → LineChart/LineChart.Circle.tsx} +26 -29
  37. package/src/components/LineChart/LineChartProps.ts +17 -0
  38. package/src/components/LineChart/index.scss +1 -0
  39. package/src/components/{LineChart.tsx → LineChart/index.tsx} +64 -35
  40. package/src/components/LinearChart.jsx +120 -60
  41. package/src/components/PairedBarChart.jsx +2 -2
  42. package/src/components/Series.jsx +22 -3
  43. package/src/components/ZoomBrush.tsx +168 -0
  44. package/src/data/initial-state.js +27 -12
  45. package/src/hooks/useBarChart.js +71 -7
  46. package/src/hooks/useColorScale.ts +50 -0
  47. package/src/hooks/useEditorPermissions.js +22 -4
  48. package/src/hooks/{useMinMax.js → useMinMax.ts} +75 -23
  49. package/src/hooks/{useRightAxis.js → useRightAxis.ts} +10 -2
  50. package/src/hooks/{useScales.js → useScales.ts} +64 -17
  51. package/src/hooks/useTooltip.jsx +68 -41
  52. package/src/scss/main.scss +3 -35
  53. package/src/types/ChartConfig.ts +43 -0
  54. package/src/types/ChartContext.ts +38 -0
  55. package/src/types/ChartProps.ts +7 -0
  56. package/src/types/ForestPlot.ts +60 -0
@@ -0,0 +1,305 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import Chart from '../CdcChart'
4
+
5
+ const meta: Meta<typeof Chart> = {
6
+ title: 'Components/Templates/Chart/Tooltip',
7
+ component: Chart
8
+ }
9
+
10
+ type Story = StoryObj<typeof Chart>
11
+
12
+ export const Additional_Tooltip: Story = {
13
+ args: {
14
+ config: {
15
+ type: 'chart',
16
+ debugSvg: false,
17
+ chartMessage: {
18
+ noData: 'No Data Available'
19
+ },
20
+ title: 'Example Stacked Bar Chart with Additional tolltip column',
21
+ showTitle: true,
22
+ showDownloadMediaButton: false,
23
+ theme: 'theme-orange',
24
+ animate: false,
25
+ fontSize: 'medium',
26
+ lineDatapointStyle: 'hover',
27
+ barHasBorder: 'false',
28
+ isLollipopChart: false,
29
+ lollipopShape: 'circle',
30
+ lollipopColorStyle: 'two-tone',
31
+ visualizationSubType: 'stacked',
32
+ barStyle: '',
33
+ roundingStyle: 'standard',
34
+ tipRounding: 'top',
35
+ isResponsiveTicks: false,
36
+ general: {
37
+ showDownloadButton: false
38
+ },
39
+ padding: {
40
+ left: 5,
41
+ right: 5
42
+ },
43
+ yAxis: {
44
+ hideAxis: false,
45
+ displayNumbersOnBar: false,
46
+ hideLabel: false,
47
+ hideTicks: false,
48
+ size: '64',
49
+ gridLines: false,
50
+ enablePadding: false,
51
+ min: '',
52
+ max: '',
53
+ labelColor: '#333',
54
+ tickLabelColor: '#333',
55
+ tickColor: '#333',
56
+ rightHideAxis: true,
57
+ rightAxisSize: 0,
58
+ rightLabel: '',
59
+ rightLabelOffsetSize: 0,
60
+ rightAxisLabelColor: '#333',
61
+ rightAxisTickLabelColor: '#333',
62
+ rightAxisTickColor: '#333',
63
+ numTicks: '',
64
+ axisPadding: 0,
65
+ tickRotation: 0,
66
+ anchors: [],
67
+ label: 'Y-Axis Label Example'
68
+ },
69
+ boxplot: {
70
+ plots: [],
71
+ borders: 'true',
72
+ firstQuartilePercentage: 25,
73
+ thirdQuartilePercentage: 75,
74
+ boxWidthPercentage: 40,
75
+ plotOutlierValues: false,
76
+ plotNonOutlierValues: true,
77
+ legend: {
78
+ showHowToReadText: false,
79
+ howToReadText: ''
80
+ },
81
+ labels: {
82
+ q1: 'Lower Quartile',
83
+ q2: 'q2',
84
+ q3: 'Upper Quartile',
85
+ q4: 'q4',
86
+ minimum: 'Minimum',
87
+ maximum: 'Maximum',
88
+ mean: 'Mean',
89
+ median: 'Median',
90
+ sd: 'Standard Deviation',
91
+ iqr: 'Interquartile Range',
92
+ total: 'Total',
93
+ outliers: 'Outliers',
94
+ values: 'Values',
95
+ lowerBounds: 'Lower Bounds',
96
+ upperBounds: 'Upper Bounds'
97
+ }
98
+ },
99
+ topAxis: {
100
+ hasLine: false
101
+ },
102
+ isLegendValue: false,
103
+ barThickness: 0.35,
104
+ barHeight: 25,
105
+ barSpace: 15,
106
+ heights: {
107
+ vertical: 300,
108
+ horizontal: 750
109
+ },
110
+ xAxis: {
111
+ sortDates: false,
112
+ anchors: [],
113
+ type: 'categorical',
114
+ showTargetLabel: true,
115
+ targetLabel: 'Target',
116
+ hideAxis: false,
117
+ hideLabel: false,
118
+ hideTicks: false,
119
+ size: '67',
120
+ tickRotation: '25',
121
+ min: '',
122
+ max: '',
123
+ labelColor: '#333',
124
+ tickLabelColor: '#333',
125
+ tickColor: '#333',
126
+ numTicks: '',
127
+ labelOffset: 65,
128
+ axisPadding: 0,
129
+ target: 0,
130
+ maxTickRotation: 0,
131
+ dataKey: 'Year',
132
+ label: 'X-Axis Label Example',
133
+ tickWidthMax: 41
134
+ },
135
+ table: {
136
+ label: 'Data Table',
137
+ expanded: true,
138
+ limitHeight: false,
139
+ height: '',
140
+ caption: '',
141
+ showDownloadUrl: false,
142
+ showDataTableLink: true,
143
+ indexLabel: '',
144
+ download: true,
145
+ showVertical: false,
146
+ show: true
147
+ },
148
+ orientation: 'vertical',
149
+ color: 'pinkpurple',
150
+ columns: {
151
+ additionalColumn1: {
152
+ label: 'New Column',
153
+ dataTable: false,
154
+ tooltips: true,
155
+ prefix: '',
156
+ suffix: '',
157
+ forestPlot: false,
158
+ startingPoint: '0',
159
+ forestPlotAlignRight: false,
160
+ name: 'Data 1'
161
+ }
162
+ },
163
+ legend: {
164
+ hide: false,
165
+ behavior: 'isolate',
166
+ singleRow: false,
167
+ colorCode: '',
168
+ reverseLabelOrder: false,
169
+ description: '',
170
+ dynamicLegend: false,
171
+ dynamicLegendDefaultText: 'Show All',
172
+ dynamicLegendItemLimit: 5,
173
+ dynamicLegendItemLimitMessage: 'Dynamic Legend Item Limit Hit.',
174
+ dynamicLegendChartMessage: 'Select Options from the Legend',
175
+ lineMode: false,
176
+ verticalSorted: false,
177
+ position: 'right',
178
+ label: 'Data Type'
179
+ },
180
+ brush: {
181
+ height: 25,
182
+ data: [],
183
+ active: false
184
+ },
185
+ exclusions: {
186
+ active: false,
187
+ keys: []
188
+ },
189
+ palette: 'qualitative-bold',
190
+ isPaletteReversed: false,
191
+ twoColor: {
192
+ palette: 'monochrome-1',
193
+ isPaletteReversed: false
194
+ },
195
+ labels: false,
196
+ dataFormat: {
197
+ commas: false,
198
+ prefix: '',
199
+ suffix: '%',
200
+ abbreviated: false,
201
+ bottomSuffix: '',
202
+ bottomPrefix: '',
203
+ bottomAbbreviated: false
204
+ },
205
+ confidenceKeys: {},
206
+ visual: {
207
+ border: true,
208
+ accent: true,
209
+ background: true,
210
+ verticalHoverLine: false,
211
+ horizontalHoverLine: false
212
+ },
213
+ useLogScale: false,
214
+ filterBehavior: 'Filter Change',
215
+ highlightedBarValues: [],
216
+ series: [
217
+ {
218
+ dataKey: 'Data 2',
219
+ type: 'Bar',
220
+ tooltip: true
221
+ },
222
+ {
223
+ dataKey: 'Data 3',
224
+ type: 'Bar',
225
+ tooltip: true
226
+ }
227
+ ],
228
+ tooltips: {
229
+ opacity: 90
230
+ },
231
+ forestPlot: {
232
+ startAt: 0,
233
+ width: 'auto',
234
+ colors: {
235
+ line: '',
236
+ shape: ''
237
+ },
238
+ estimateField: '',
239
+ estimateRadius: '',
240
+ lowerCiField: '',
241
+ upperCiField: '',
242
+ shape: '',
243
+ rowHeight: 20,
244
+ showZeroLine: false,
245
+ description: {
246
+ show: true,
247
+ text: 'description',
248
+ location: 0
249
+ },
250
+ result: {
251
+ show: true,
252
+ text: 'result',
253
+ location: 100
254
+ },
255
+ radius: {
256
+ min: 1,
257
+ max: 8,
258
+ scalingColumn: ''
259
+ },
260
+ regression: {
261
+ lower: 0,
262
+ upper: 0,
263
+ estimateField: 0
264
+ },
265
+ leftWidthOffset: 0,
266
+ rightWidthOffset: 0
267
+ },
268
+ area: {
269
+ isStacked: false
270
+ },
271
+ height: '375',
272
+ data: [
273
+ {
274
+ Year: '2015',
275
+ 'Data 1': '25',
276
+ 'Data 2': '20',
277
+ 'Data 3': '55'
278
+ },
279
+ {
280
+ Year: '2016',
281
+ 'Data 1': '35',
282
+ 'Data 2': '30',
283
+ 'Data 3': '35'
284
+ },
285
+ {
286
+ Year: '2017',
287
+ 'Data 1': '22',
288
+ 'Data 2': '38',
289
+ 'Data 3': '40'
290
+ },
291
+ {
292
+ Year: '2018',
293
+ 'Data 1': '40',
294
+ 'Data 2': '40',
295
+ 'Data 3': '20'
296
+ }
297
+ ],
298
+ visualizationType: 'Bar',
299
+ validated: 4.23,
300
+ dynamicMarginTop: 0
301
+ }
302
+ }
303
+ }
304
+
305
+ export default meta
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import chartBrushConfig from './_mock/brush_mock.json'
3
+
4
+ import Chart from '../CdcChart'
5
+
6
+ const meta: Meta<typeof Chart> = {
7
+ title: 'Components/Templates/Chart/Brush',
8
+ component: Chart
9
+ }
10
+
11
+ type Story = StoryObj<typeof Chart>
12
+
13
+ export const Area_Brush: Story = {
14
+ args: {
15
+ config: chartBrushConfig
16
+ }
17
+ }
18
+
19
+ export default meta
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import suppressMock from './_mock/suppress_mock.json'
3
+
4
+ import Chart from '../CdcChart'
5
+
6
+ const meta: Meta<typeof Chart> = {
7
+ title: 'Components/Templates/Chart/Suppress',
8
+ component: Chart
9
+ }
10
+
11
+ type Story = StoryObj<typeof Chart>
12
+
13
+ export const Horizontal_Chart: Story = {
14
+ args: {
15
+ config: suppressMock
16
+ }
17
+ }
18
+
19
+ export default meta