@cdc/chart 4.25.5-1 → 4.25.6-2

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 (63) hide show
  1. package/LICENSE +201 -0
  2. package/dist/cdcchart.js +31118 -27459
  3. package/examples/private/0527.json +1 -0
  4. package/examples/private/DEV-8850-2.json +493 -0
  5. package/examples/private/DEV-9822.json +574 -0
  6. package/examples/private/DEV-9840.json +553 -0
  7. package/examples/private/DEV-9850-3.json +461 -0
  8. package/examples/private/chart.json +1084 -0
  9. package/examples/private/ci_formatted.json +202 -0
  10. package/examples/private/ci_issue.json +3016 -0
  11. package/examples/private/completed.json +634 -0
  12. package/examples/private/dem-data-long.csv +20 -0
  13. package/examples/private/dem-data-long.json +36 -0
  14. package/examples/private/demographic_data.csv +157 -0
  15. package/examples/private/demographic_data.json +2654 -0
  16. package/examples/private/demographic_dynamic.json +443 -0
  17. package/examples/private/demographic_standard.json +560 -0
  18. package/examples/private/ehdi.json +29939 -0
  19. package/examples/private/line-issue.json +497 -0
  20. package/examples/private/not-loading.json +360 -0
  21. package/examples/private/test.json +493 -0
  22. package/examples/private/testing-pie.json +436 -0
  23. package/index.html +130 -130
  24. package/package.json +2 -2
  25. package/src/CdcChartComponent.tsx +66 -26
  26. package/src/_stories/Chart.stories.tsx +99 -93
  27. package/src/_stories/ChartPrefixSuffix.stories.tsx +29 -32
  28. package/src/_stories/_mock/pie_calculated_area.json +417 -0
  29. package/src/components/BarChart/components/BarChart.Horizontal.tsx +4 -13
  30. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +3 -14
  31. package/src/components/BarChart/components/BarChart.Vertical.tsx +2 -8
  32. package/src/components/Brush/BrushChart.tsx +73 -0
  33. package/src/components/Brush/BrushController..tsx +39 -0
  34. package/src/components/DeviationBar.jsx +0 -1
  35. package/src/components/EditorPanel/EditorPanel.tsx +246 -156
  36. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +2 -2
  37. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +3 -2
  38. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +2 -1
  39. package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +8 -0
  40. package/src/components/EditorPanel/useEditorPermissions.ts +7 -4
  41. package/src/components/HoverLine/HoverLine.tsx +74 -0
  42. package/src/components/Legend/Legend.Suppression.tsx +47 -3
  43. package/src/components/Legend/helpers/index.ts +1 -1
  44. package/src/components/LineChart/helpers.ts +7 -7
  45. package/src/components/LineChart/index.tsx +3 -6
  46. package/src/components/LinearChart.tsx +108 -72
  47. package/src/components/PieChart/PieChart.tsx +58 -13
  48. package/src/data/initial-state.js +8 -5
  49. package/src/helpers/countNumOfTicks.ts +4 -19
  50. package/src/helpers/getNewRuntime.ts +35 -0
  51. package/src/helpers/getPiePercent.ts +22 -0
  52. package/src/helpers/getTransformedData.ts +22 -0
  53. package/src/helpers/tests/getNewRuntime.test.ts +82 -0
  54. package/src/helpers/tests/getPiePercent.test.ts +38 -0
  55. package/src/hooks/useRightAxis.ts +1 -1
  56. package/src/hooks/useScales.ts +8 -3
  57. package/src/hooks/useTooltip.tsx +24 -10
  58. package/src/scss/main.scss +8 -4
  59. package/src/store/chart.actions.ts +2 -6
  60. package/src/store/chart.reducer.ts +23 -23
  61. package/src/types/ChartConfig.ts +7 -4
  62. package/src/types/ChartContext.ts +0 -2
  63. package/src/components/ZoomBrush.tsx +0 -251
@@ -1,93 +1,99 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import Chart from '../CdcChart'
4
- import lineChartTwoPointsRegressionTest from './_mock/line_chart_two_points_regression_test.json'
5
- import lineChartTwoPointsNewChart from './_mock/line_chart_two_points_new_chart.json'
6
- import lollipop from './_mock/lollipop.json'
7
- import forestPlot from '../../examples/feature/forest-plot/forest-plot.json'
8
- import pairedBar from './_mock/paired-bar.json'
9
- import horizontalBarConfig from './_mock/horizontal_bar.json'
10
- import barChartLabels from './_mock/barchart_labels.mock.json'
11
- import pieConfig from './_mock/pie_with_data.json'
12
- import boxPlotConfig from './_mock/boxplot_multiseries.json'
13
- import areaChartStacked from './_mock/area_chart_stacked.json'
14
- import multipleLines from './_mock/short_dates.json'
15
- import { editConfigKeys } from '../helpers/configHelpers'
16
-
17
- const meta: Meta<typeof Chart> = {
18
- title: 'Components/Templates/Chart',
19
- component: Chart
20
- }
21
-
22
- type Story = StoryObj<typeof Chart>
23
-
24
- export const line_Chart_Two_Points_Regression_Test: Story = {
25
- args: {
26
- config: lineChartTwoPointsRegressionTest,
27
- isEditor: false
28
- }
29
- }
30
- export const line_Chart_Two_Points_New_Chart: Story = {
31
- args: {
32
- config: lineChartTwoPointsNewChart,
33
- isEditor: false
34
- }
35
- }
36
-
37
- export const multiple_lines: Story = {
38
- args: {
39
- config: editConfigKeys(multipleLines, [{ path: ['tooltips', 'dateDisplayFormat'], value: '%b. %d %Y' }])
40
- }
41
- }
42
-
43
- export const Lollipop: Story = {
44
- args: {
45
- config: lollipop,
46
- isEditor: false
47
- }
48
- }
49
-
50
- export const Forest_Plot: Story = {
51
- args: {
52
- config: forestPlot
53
- }
54
- }
55
-
56
- export const Horizontal_Bar: Story = {
57
- args: {
58
- config: horizontalBarConfig
59
- }
60
- }
61
-
62
- export const BarChart_Labels: Story = {
63
- args: {
64
- config: barChartLabels
65
- }
66
- }
67
-
68
- export const Pie: Story = {
69
- args: {
70
- config: pieConfig
71
- }
72
- }
73
-
74
- export const Paired_Bar: Story = {
75
- args: {
76
- config: pairedBar
77
- }
78
- }
79
- export const BoxPlot_Multiseries: Story = {
80
- args: {
81
- config: boxPlotConfig,
82
- isEditor: false
83
- }
84
- }
85
-
86
- export const Area_Chart_stacked: Story = {
87
- args: {
88
- config: areaChartStacked,
89
- isEditor: false
90
- }
91
- }
92
-
93
- export default meta
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import Chart from '../CdcChart'
4
+ import lineChartTwoPointsRegressionTest from './_mock/line_chart_two_points_regression_test.json'
5
+ import lineChartTwoPointsNewChart from './_mock/line_chart_two_points_new_chart.json'
6
+ import lollipop from './_mock/lollipop.json'
7
+ import forestPlot from '../../examples/feature/forest-plot/forest-plot.json'
8
+ import pairedBar from './_mock/paired-bar.json'
9
+ import horizontalBarConfig from './_mock/horizontal_bar.json'
10
+ import barChartLabels from './_mock/barchart_labels.mock.json'
11
+ import pieConfig from './_mock/pie_with_data.json'
12
+ import pieCalculatedArea from './_mock/pie_calculated_area.json'
13
+ import boxPlotConfig from './_mock/boxplot_multiseries.json'
14
+ import areaChartStacked from './_mock/area_chart_stacked.json'
15
+ import multipleLines from './_mock/short_dates.json'
16
+ import { editConfigKeys } from '../helpers/configHelpers'
17
+
18
+ const meta: Meta<typeof Chart> = {
19
+ title: 'Components/Templates/Chart',
20
+ component: Chart
21
+ }
22
+
23
+ type Story = StoryObj<typeof Chart>
24
+
25
+ export const line_Chart_Two_Points_Regression_Test: Story = {
26
+ args: {
27
+ config: lineChartTwoPointsRegressionTest,
28
+ isEditor: false
29
+ }
30
+ }
31
+ export const line_Chart_Two_Points_New_Chart: Story = {
32
+ args: {
33
+ config: lineChartTwoPointsNewChart,
34
+ isEditor: false
35
+ }
36
+ }
37
+
38
+ export const multiple_lines: Story = {
39
+ args: {
40
+ config: editConfigKeys(multipleLines, [{ path: ['tooltips', 'dateDisplayFormat'], value: '%b. %d %Y' }])
41
+ }
42
+ }
43
+
44
+ export const Lollipop: Story = {
45
+ args: {
46
+ config: lollipop,
47
+ isEditor: false
48
+ }
49
+ }
50
+
51
+ export const Forest_Plot: Story = {
52
+ args: {
53
+ config: forestPlot
54
+ }
55
+ }
56
+
57
+ export const Horizontal_Bar: Story = {
58
+ args: {
59
+ config: horizontalBarConfig
60
+ }
61
+ }
62
+
63
+ export const BarChart_Labels: Story = {
64
+ args: {
65
+ config: barChartLabels
66
+ }
67
+ }
68
+
69
+ export const Pie: Story = {
70
+ args: {
71
+ config: pieConfig
72
+ }
73
+ }
74
+ export const Pie_Calculated_Area: Story = {
75
+ args: {
76
+ config: pieCalculatedArea
77
+ }
78
+ }
79
+
80
+ export const Paired_Bar: Story = {
81
+ args: {
82
+ config: pairedBar
83
+ }
84
+ }
85
+ export const BoxPlot_Multiseries: Story = {
86
+ args: {
87
+ config: boxPlotConfig,
88
+ isEditor: false
89
+ }
90
+ }
91
+
92
+ export const Area_Chart_stacked: Story = {
93
+ args: {
94
+ config: areaChartStacked,
95
+ isEditor: false
96
+ }
97
+ }
98
+
99
+ export default meta
@@ -15,49 +15,55 @@ const meta: Meta<typeof Chart> = {
15
15
 
16
16
  type Story = StoryObj<typeof Chart>
17
17
 
18
- export const Top_Suffix: Story = {
18
+ export const Inline_Label: Story = {
19
19
  args: {
20
20
  config: editConfigKeys(barConfig, [
21
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
22
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
21
+ { path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' },
23
22
  { path: ['yAxis', 'gridLines'], value: true }
24
23
  ])
25
24
  }
26
25
  }
27
-
28
- export const Top_Suffix_Worst_Case: Story = {
26
+ export const Inline_Label_With_Suffix: Story = {
29
27
  args: {
30
- config: editConfigKeys(annotationConfig, [
31
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
32
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' }
28
+ config: editConfigKeys(barConfig, [
29
+ { path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' },
30
+ { path: ['dataFormat', 'suffix'], value: '%' },
31
+ { path: ['yAxis', 'gridLines'], value: true }
33
32
  ])
34
33
  }
35
34
  }
36
35
 
37
- export const Top_Suffix_With_Options: Story = {
36
+ export const Inline_Label_Worst_Case: Story = {
37
+ args: {
38
+ config: editConfigKeys(annotationConfig, [{ path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' }])
39
+ }
40
+ }
41
+
42
+ export const Inline_Label_With_Options: Story = {
38
43
  args: {
39
44
  config: editConfigKeys(annotationConfig, [
40
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
45
+ { path: ['yAxis', 'inlineLabel'], value: ' units' },
46
+ { path: ['dataFormat', 'suffix'], value: '' },
41
47
  { path: ['yAxis', 'tickRotation'], value: 45 },
42
48
  { path: ['yAxis', 'tickLabelColor'], value: 'red' }
43
49
  ])
44
50
  }
45
51
  }
46
52
 
47
- export const Top_Suffix_No_Space: Story = {
53
+ export const Inline_Label_No_Space: Story = {
48
54
  args: {
49
55
  config: editConfigKeys(annotationConfig, [
50
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
51
- { path: ['dataFormat', 'suffix'], value: 'lbs' }
56
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs' },
57
+ { path: ['dataFormat', 'suffix'], value: '' }
52
58
  ])
53
59
  }
54
60
  }
55
61
 
56
- export const Top_Suffix_With_Space: Story = {
62
+ export const Inline_Label_With_Space: Story = {
57
63
  args: {
58
64
  config: editConfigKeys(annotationConfig, [
59
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
60
- { path: ['dataFormat', 'suffix'], value: 'lbs of something' }
65
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
66
+ { path: ['dataFormat', 'suffix'], value: '' }
61
67
  ])
62
68
  }
63
69
  }
@@ -67,15 +73,7 @@ export const Suffix: Story = {
67
73
  config: annotationConfig
68
74
  }
69
75
  }
70
- export const Top_Prefix: Story = {
71
- args: {
72
- config: editConfigKeys(annotationConfig, [
73
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
74
- { path: ['dataFormat', 'prefix'], value: '$' },
75
- { path: ['dataFormat', 'suffix'], value: '' }
76
- ])
77
- }
78
- }
76
+
79
77
  export const Prefix: Story = {
80
78
  args: {
81
79
  config: editConfigKeys(areaPrefix, [
@@ -85,10 +83,10 @@ export const Prefix: Story = {
85
83
  }
86
84
  }
87
85
 
88
- export const Top_Prefix_And_Suffix: Story = {
86
+ export const Prefix_Suffix_And_Inline_Title: Story = {
89
87
  args: {
90
88
  config: editConfigKeys(annotationConfig, [
91
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
89
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
92
90
  { path: ['dataFormat', 'prefix'], value: '$' }
93
91
  ])
94
92
  }
@@ -102,11 +100,11 @@ export const Horizontal_Bar: Story = {
102
100
  }
103
101
  }
104
102
 
105
- export const Top_Suffix_On_Line: Story = {
103
+ export const Inline_Title_On_Line: Story = {
106
104
  args: {
107
105
  config: editConfigKeys(barConfig, [
108
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
109
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
106
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
107
+ { path: ['dataFormat', 'suffix'], value: '' },
110
108
  { path: ['yAxis', 'gridLines'], value: true },
111
109
  { path: ['yAxis', 'labelsAboveGridlines'], value: true },
112
110
  { path: ['yAxis', 'hideAxis'], value: true }
@@ -128,9 +126,8 @@ export const Values_On_Line_All_Suffix: Story = {
128
126
  export const Values_on_Line_Top_Suffix_Only_Area_Worst_Case: Story = {
129
127
  args: {
130
128
  config: editConfigKeys(annotationConfig, [
131
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
129
+ { path: ['yAxis', 'inlineLabel'], value: ' of something' },
132
130
  { path: ['dataFormat', 'prefix'], value: 'pre' },
133
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
134
131
  { path: ['yAxis', 'labelsAboveGridlines'], value: true },
135
132
  { path: ['yAxis', 'gridLines'], value: true }
136
133
  ])