@cdc/chart 4.23.10 → 4.24.1

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 (125) hide show
  1. package/dist/cdcchart.js +34606 -32218
  2. package/examples/feature/bar/additional-column-tooltip.json +446 -0
  3. package/examples/feature/bar/example-bar-chart.json +1 -46
  4. package/examples/feature/bar/lollipop.json +156 -0
  5. package/examples/feature/bar/tall-data.json +98 -0
  6. package/examples/feature/combo/planet-combo-example-config.json +99 -9
  7. package/examples/feature/dev-4261.json +399 -0
  8. package/examples/feature/forest-plot/forest-plot.json +63 -19
  9. package/examples/feature/forest-plot/{broken.json → linear.json} +77 -23
  10. package/examples/feature/forest-plot/log.json +26 -0
  11. package/examples/feature/forest-plot/logarithmic.json +271 -0
  12. package/examples/feature/line/line-chart-preliminary.json +346 -0
  13. package/examples/feature/line/line-points.json +340 -0
  14. package/examples/feature/regions/index.json +462 -0
  15. package/examples/feature/scatterplot/scatterplot.json +272 -33
  16. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +181 -48
  17. package/examples/private/chart-t.json +3740 -0
  18. package/examples/private/combo.json +369 -0
  19. package/examples/private/epi-data.csv +13 -0
  20. package/examples/private/epi-data.json +62 -0
  21. package/examples/private/epi.json +403 -0
  22. package/examples/private/occupancy.json +109283 -0
  23. package/examples/private/prod-line-config.json +401 -0
  24. package/examples/private/region-data.json +822 -0
  25. package/examples/private/region-testing.json +312 -0
  26. package/examples/private/scaling.json +45325 -0
  27. package/examples/private/testing-data.json +1739 -0
  28. package/examples/private/testing.json +816 -0
  29. package/examples/sparkline-multilple.json +846 -0
  30. package/index.html +12 -8
  31. package/package.json +3 -3
  32. package/src/CdcChart.tsx +42 -211
  33. package/src/ConfigContext.tsx +6 -0
  34. package/src/_stories/Chart.stories.tsx +188 -0
  35. package/src/_stories/Chart.tooltip.stories.tsx +305 -0
  36. package/src/_stories/ChartBrush.stories.tsx +19 -0
  37. package/src/_stories/ChartEditor.stories.tsx +22 -0
  38. package/src/_stories/ChartLine.preliminary.tsx +19 -0
  39. package/src/_stories/ChartSuppress.stories.tsx +19 -0
  40. package/src/_stories/_mock/brush_mock.json +393 -0
  41. package/src/_stories/_mock/pie_config.json +191 -0
  42. package/src/_stories/_mock/pie_data.json +218 -0
  43. package/src/_stories/_mock/preliminary_mock.json +346 -0
  44. package/src/_stories/_mock/suppress_mock.json +911 -0
  45. package/src/components/{AreaChart.Stacked.jsx → AreaChart/components/AreaChart.Stacked.jsx} +6 -7
  46. package/src/components/{AreaChart.jsx → AreaChart/components/AreaChart.jsx} +7 -36
  47. package/src/components/AreaChart/index.tsx +4 -0
  48. package/src/components/{BarChart.Horizontal.jsx → BarChart/components/BarChart.Horizontal.tsx} +111 -34
  49. package/src/components/{BarChart.StackedHorizontal.jsx → BarChart/components/BarChart.StackedHorizontal.tsx} +55 -20
  50. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +106 -0
  51. package/src/components/{BarChart.Vertical.jsx → BarChart/components/BarChart.Vertical.tsx} +162 -34
  52. package/src/components/BarChart/components/BarChart.jsx +39 -0
  53. package/src/components/{BarChartType.jsx → BarChart/components/BarChartType.jsx} +0 -2
  54. package/src/components/BarChart/components/context.tsx +13 -0
  55. package/src/components/BarChart/index.tsx +3 -0
  56. package/src/components/{BoxPlot.jsx → BoxPlot/BoxPlot.jsx} +1 -1
  57. package/src/components/BoxPlot/index.tsx +3 -0
  58. package/src/components/DeviationBar.jsx +4 -3
  59. package/src/components/{EditorPanel.jsx → EditorPanel/EditorPanel.tsx} +807 -865
  60. package/src/components/EditorPanel/components/Panel.DateHighlighting.tsx +109 -0
  61. package/src/components/{ForestPlotSettings.jsx → EditorPanel/components/Panel.ForestPlotSettings.tsx} +190 -220
  62. package/src/components/EditorPanel/components/Panel.Regions.tsx +168 -0
  63. package/src/components/{Series.jsx → EditorPanel/components/Panel.Series.tsx} +23 -4
  64. package/src/components/EditorPanel/components/PanelProps.ts +3 -0
  65. package/src/components/EditorPanel/components/Panels.tsx +13 -0
  66. package/src/components/EditorPanel/components/panels.scss +72 -0
  67. package/src/components/EditorPanel/editor-panel.scss +751 -0
  68. package/src/components/EditorPanel/index.tsx +3 -0
  69. package/src/{hooks → components/EditorPanel}/useEditorPermissions.js +50 -5
  70. package/src/components/{Forecasting.jsx → Forecasting/Forecasting.jsx} +1 -1
  71. package/src/components/Forecasting/index.tsx +3 -0
  72. package/src/components/ForestPlot/ForestPlot.tsx +254 -0
  73. package/src/components/ForestPlot/ForestPlotProps.ts +18 -0
  74. package/src/components/ForestPlot/index.scss +1 -0
  75. package/src/components/ForestPlot/index.tsx +3 -0
  76. package/src/components/Legend/Legend.tsx +347 -0
  77. package/src/components/Legend/index.tsx +3 -0
  78. package/src/components/LineChart/LineChartProps.ts +46 -0
  79. package/src/components/{LineChart.Circle.tsx → LineChart/components/LineChart.Circle.tsx} +36 -30
  80. package/src/components/LineChart/helpers.ts +45 -0
  81. package/src/components/LineChart/index.scss +1 -0
  82. package/src/components/{LineChart.tsx → LineChart/index.tsx} +83 -42
  83. package/src/components/LinearChart.jsx +125 -82
  84. package/src/components/PairedBarChart.jsx +2 -2
  85. package/src/components/{PieChart.jsx → PieChart/PieChart.tsx} +16 -7
  86. package/src/components/PieChart/index.tsx +3 -0
  87. package/src/components/Regions/components/Regions.tsx +135 -0
  88. package/src/components/Regions/index.tsx +3 -0
  89. package/src/components/{ScatterPlot.jsx → ScatterPlot/ScatterPlot.jsx} +3 -3
  90. package/src/components/ScatterPlot/index.tsx +3 -0
  91. package/src/components/{SparkLine.jsx → Sparkline/SparkLine.jsx} +2 -2
  92. package/src/components/Sparkline/index.tsx +3 -0
  93. package/src/components/ZoomBrush.tsx +168 -0
  94. package/src/data/initial-state.js +30 -16
  95. package/src/helpers/abbreviateNumber.ts +17 -0
  96. package/src/helpers/computeMarginBottom.ts +55 -0
  97. package/src/helpers/filterData.ts +18 -0
  98. package/src/helpers/generateColorsArray.ts +8 -0
  99. package/src/helpers/getQuartiles.ts +30 -0
  100. package/src/helpers/handleChartAriaLabels.ts +19 -0
  101. package/src/helpers/handleLineType.ts +18 -0
  102. package/src/helpers/lineOptions.ts +18 -0
  103. package/src/helpers/sort.ts +7 -0
  104. package/src/helpers/tests/computeMarginBottom.test.ts +20 -0
  105. package/src/hooks/useBarChart.js +72 -7
  106. package/src/hooks/useColorScale.ts +50 -0
  107. package/src/hooks/{useMinMax.js → useMinMax.ts} +75 -23
  108. package/src/hooks/{useRightAxis.js → useRightAxis.ts} +10 -2
  109. package/src/hooks/{useScales.js → useScales.ts} +64 -17
  110. package/src/hooks/{useTooltip.jsx → useTooltip.tsx} +84 -55
  111. package/src/scss/main.scss +70 -38
  112. package/src/types/ChartConfig.ts +178 -0
  113. package/src/types/ChartContext.ts +54 -0
  114. package/src/types/ForestPlot.ts +53 -0
  115. package/examples/feature/scatterplot/scatterplot-continuous.csv +0 -17
  116. package/src/ConfigContext.jsx +0 -5
  117. package/src/components/BarChart.StackedVertical.jsx +0 -95
  118. package/src/components/BarChart.jsx +0 -30
  119. package/src/components/ForestPlot.jsx +0 -191
  120. package/src/components/Legend.jsx +0 -277
  121. package/src/scss/LinearChart.scss +0 -0
  122. package/src/scss/editor-panel.scss +0 -745
  123. package/src/scss/legend.scss +0 -206
  124. package/src/scss/mixins.scss +0 -0
  125. package/src/scss/variables.scss +0 -1
@@ -1,206 +0,0 @@
1
- // Notes - copied in from map > sidebar.scss
2
- // should be placed in a more global area eventually.
3
- // Had to remove/edit some styles to make the legend look proper.
4
- aside {
5
- background-color: #fff;
6
- z-index: 6;
7
- border-top: $lightGray 1px solid;
8
- @include breakpointClass(md) {
9
- &.bottom {
10
- border: $lightGray 1px solid;
11
- }
12
- &.side {
13
- z-index: 1;
14
- box-sizing: content-box;
15
- max-width: 450px;
16
- margin-top: 2em;
17
- margin-bottom: 2em;
18
- align-self: flex-start;
19
- z-index: 4;
20
- right: 1em;
21
- border: $lightGray 1px solid;
22
- width: 50%;
23
- top: 2em;
24
- right: 1em;
25
-
26
- ul.vertical-sorted {
27
- @include breakpoint(md) {
28
- column-count: 2;
29
- column-fill: balance;
30
- }
31
- }
32
-
33
- ul:not(.vertical-sorted) {
34
- @include breakpoint(md) {
35
- column-count: initial;
36
- column-fill: initial;
37
- }
38
- display: flex;
39
- flex-direction: row;
40
- flex-wrap: wrap;
41
- }
42
- }
43
-
44
- &.bottom {
45
- ul.legend-container__ul.vertical-sorted {
46
- display: block;
47
- @include breakpoint(md) {
48
- column-count: 2;
49
- column-fill: balance;
50
- }
51
- }
52
-
53
- ul.legend-container__ul {
54
- display: flex;
55
- flex-direction: row;
56
- flex-wrap: wrap;
57
-
58
- li {
59
- width: 50%;
60
- }
61
- }
62
-
63
- ul.single-row {
64
- display: block;
65
- column-count: initial;
66
- column-fill: auto;
67
- }
68
- }
69
- }
70
-
71
- &.legend-container {
72
- padding: 1em;
73
- position: relative;
74
- .legend-container__title {
75
- font-size: 1.3em;
76
- padding-bottom: 0;
77
- display: inline-block;
78
- }
79
- .legend-container__title + p,
80
- .legend-container__title + ul,
81
- p + ul,
82
- p + p {
83
- padding-top: 1em;
84
- }
85
- .legend-container__reset-button {
86
- font-size: 0.75em;
87
- color: rgba(0, 0, 0, 0.6);
88
- position: absolute;
89
- right: 1em;
90
- top: 1em;
91
- background: rgba(0, 0, 0, 0.1);
92
- text-transform: uppercase;
93
- transition: 0.2s all;
94
- padding: 0.2em 0.5em;
95
- border: rgba(0, 0, 0, 0.2) 1px solid;
96
- color: rgba(0, 0, 0, 0.6) !important;
97
- &:hover {
98
- text-decoration: none;
99
- background: rgba(0, 0, 0, 0.15);
100
- transition: 0.2s all;
101
- }
102
- }
103
- p {
104
- line-height: 1.4em;
105
- }
106
- .legend-container__ul {
107
- list-style: none;
108
- padding-top: 1em;
109
-
110
- &.vertical-sorted {
111
- flex-direction: column;
112
- }
113
- .legend-container__li {
114
- flex-shrink: 0;
115
- display: inline-block;
116
- padding-right: 1em;
117
- padding-bottom: 1em;
118
- vertical-align: middle;
119
- transition: 0.1s opacity;
120
- display: flex;
121
- cursor: pointer;
122
- flex-grow: 1;
123
-
124
- &.legend-container__li--disabled {
125
- opacity: 0.4;
126
- }
127
- }
128
- }
129
- }
130
-
131
- &.side .legend-container .legend-container__ul--single-column {
132
- @include breakpointClass(md) {
133
- width: 25%;
134
- min-width: 200px;
135
- .legend-section ul {
136
- flex-direction: column;
137
- li {
138
- width: 100%;
139
- &:nth-last-of-type(-n + 2) {
140
- padding-bottom: 1em;
141
- }
142
- &:last-child {
143
- padding-bottom: 0;
144
- }
145
- }
146
- }
147
- }
148
- li {
149
- width: 100%;
150
- }
151
- }
152
-
153
- &.bottom.single-row {
154
- width: 100%;
155
- .legend-container ul {
156
- flex-direction: row;
157
- align-items: baseline;
158
- justify-content: flex-start;
159
- flex-wrap: wrap;
160
- li {
161
- justify-items: center;
162
- line-break: loose;
163
- align-items: center;
164
- width: auto;
165
- padding-right: 1em;
166
- padding-bottom: 1em;
167
- display: inline-block;
168
- & > span {
169
- margin: 0 !important;
170
- }
171
- }
172
- }
173
- }
174
-
175
- @include breakpointClass(sm) {
176
- .legend-container ul {
177
- align-items: flex-start;
178
- justify-content: space-between;
179
- li {
180
- flex-grow: 1;
181
- padding-right: 0.5em;
182
- }
183
- }
184
- }
185
-
186
- .filters-section {
187
- padding: 0 1em 1em;
188
- .heading-3 {
189
- font-weight: bold;
190
- margin-bottom: 0.5em;
191
- }
192
- form {
193
- margin-top: 0.5em;
194
- line-height: 2em;
195
- display: flex;
196
- align-items: flex-end;
197
- section + section {
198
- margin-left: 0.75em;
199
- }
200
- select {
201
- display: block;
202
- font-size: 1em;
203
- }
204
- }
205
- }
206
- }
File without changes
@@ -1 +0,0 @@
1
- $editorWidth: 350px;