@cdc/chart 4.23.11 → 4.24.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 (104) hide show
  1. package/dist/cdcchart.js +35740 -35027
  2. package/examples/feature/bar/additional-column-tooltip.json +446 -0
  3. package/examples/feature/bar/tall-data.json +98 -0
  4. package/examples/feature/forest-plot/forest-plot.json +63 -19
  5. package/examples/feature/forest-plot/linear.json +52 -3
  6. package/examples/feature/forest-plot/log.json +26 -0
  7. package/examples/feature/forest-plot/logarithmic.json +0 -35
  8. package/examples/feature/line/line-chart-preliminary.json +393 -0
  9. package/examples/feature/regions/index.json +9 -5
  10. package/examples/feature/scatterplot/scatterplot.json +272 -33
  11. package/index.html +10 -8
  12. package/package.json +2 -2
  13. package/src/CdcChart.tsx +70 -234
  14. package/src/ConfigContext.tsx +6 -0
  15. package/src/_stories/ChartEditor.stories.tsx +22 -0
  16. package/src/_stories/ChartLine.preliminary.tsx +19 -0
  17. package/src/_stories/_mock/pie_config.json +192 -0
  18. package/src/_stories/_mock/pie_data.json +218 -0
  19. package/src/_stories/_mock/preliminary_mock.json +346 -0
  20. package/src/components/{AreaChart.Stacked.jsx → AreaChart/components/AreaChart.Stacked.jsx} +2 -2
  21. package/src/components/{AreaChart.jsx → AreaChart/components/AreaChart.jsx} +2 -26
  22. package/src/components/AreaChart/index.tsx +4 -0
  23. package/src/components/{BarChart.Horizontal.tsx → BarChart/components/BarChart.Horizontal.tsx} +8 -8
  24. package/src/components/{BarChart.StackedHorizontal.tsx → BarChart/components/BarChart.StackedHorizontal.tsx} +37 -7
  25. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +108 -0
  26. package/src/components/{BarChart.Vertical.tsx → BarChart/components/BarChart.Vertical.tsx} +53 -70
  27. package/src/components/BarChart/components/BarChart.jsx +39 -0
  28. package/src/components/{BarChartType.jsx → BarChart/components/BarChartType.jsx} +0 -2
  29. package/src/components/BarChart/components/context.tsx +13 -0
  30. package/src/components/BarChart/index.tsx +3 -0
  31. package/src/components/{BoxPlot.jsx → BoxPlot/BoxPlot.jsx} +10 -9
  32. package/src/components/BoxPlot/index.tsx +3 -0
  33. package/src/components/EditorPanel/EditorPanel.tsx +2776 -0
  34. package/src/components/EditorPanel/EditorPanelContext.ts +40 -0
  35. package/src/components/EditorPanel/components/PanelProps.ts +3 -0
  36. package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +148 -0
  37. package/src/components/{ForestPlotSettings.jsx → EditorPanel/components/Panels/Panel.ForestPlotSettings.tsx} +97 -167
  38. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +160 -0
  39. package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +168 -0
  40. package/src/components/{Series.jsx → EditorPanel/components/Panels/Panel.Series.tsx} +4 -4
  41. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +297 -0
  42. package/src/components/EditorPanel/components/Panels/index.tsx +17 -0
  43. package/src/components/EditorPanel/components/panels.scss +72 -0
  44. package/src/components/EditorPanel/editor-panel.scss +739 -0
  45. package/src/components/EditorPanel/index.tsx +3 -0
  46. package/src/{hooks → components/EditorPanel}/useEditorPermissions.js +34 -2
  47. package/src/components/{Forecasting.jsx → Forecasting/Forecasting.jsx} +1 -1
  48. package/src/components/Forecasting/index.tsx +3 -0
  49. package/src/components/ForestPlot/ForestPlot.tsx +254 -0
  50. package/src/components/ForestPlot/ForestPlotProps.ts +7 -0
  51. package/src/components/ForestPlot/index.tsx +1 -209
  52. package/src/components/Legend/Legend.Component.tsx +199 -0
  53. package/src/components/Legend/Legend.tsx +28 -0
  54. package/src/components/Legend/helpers/createFormatLabels.tsx +140 -0
  55. package/src/components/Legend/index.tsx +3 -0
  56. package/src/components/LineChart/LineChartProps.ts +29 -0
  57. package/src/components/LineChart/components/LineChart.Circle.tsx +147 -0
  58. package/src/components/LineChart/helpers.ts +45 -0
  59. package/src/components/LineChart/index.tsx +111 -23
  60. package/src/components/LinearChart.jsx +55 -72
  61. package/src/components/PairedBarChart.jsx +4 -2
  62. package/src/components/{PieChart.jsx → PieChart/PieChart.tsx} +93 -31
  63. package/src/components/PieChart/index.tsx +3 -0
  64. package/src/components/Regions/components/Regions.tsx +144 -0
  65. package/src/components/Regions/index.tsx +3 -0
  66. package/src/components/{ScatterPlot.jsx → ScatterPlot/ScatterPlot.jsx} +3 -3
  67. package/src/components/ScatterPlot/index.tsx +3 -0
  68. package/src/components/{SparkLine.jsx → Sparkline/SparkLine.jsx} +2 -2
  69. package/src/components/Sparkline/index.tsx +3 -0
  70. package/src/data/initial-state.js +10 -8
  71. package/src/helpers/abbreviateNumber.ts +17 -0
  72. package/src/helpers/computeMarginBottom.ts +55 -0
  73. package/src/helpers/filterData.ts +18 -0
  74. package/src/helpers/generateColorsArray.ts +8 -0
  75. package/src/helpers/getQuartiles.ts +30 -0
  76. package/src/helpers/handleChartAriaLabels.ts +19 -0
  77. package/src/helpers/handleLineType.ts +18 -0
  78. package/src/helpers/lineOptions.ts +18 -0
  79. package/src/helpers/sort.ts +7 -0
  80. package/src/helpers/tests/computeMarginBottom.test.ts +20 -0
  81. package/src/hooks/useBarChart.js +7 -6
  82. package/src/hooks/useHighlightedBars.js +1 -1
  83. package/src/hooks/useMinMax.ts +3 -3
  84. package/src/hooks/useScales.ts +19 -6
  85. package/src/hooks/{useTooltip.jsx → useTooltip.tsx} +31 -25
  86. package/src/scss/main.scss +0 -3
  87. package/src/types/ChartConfig.ts +167 -23
  88. package/src/types/ChartContext.ts +34 -12
  89. package/src/types/ForestPlot.ts +7 -14
  90. package/src/types/Label.ts +7 -0
  91. package/examples/feature/scatterplot/scatterplot-continuous.csv +0 -17
  92. package/src/ConfigContext.jsx +0 -5
  93. package/src/components/BarChart.StackedVertical.tsx +0 -91
  94. package/src/components/BarChart.jsx +0 -30
  95. package/src/components/EditorPanel.jsx +0 -3356
  96. package/src/components/ForestPlot/Readme.md +0 -0
  97. package/src/components/Legend.jsx +0 -310
  98. package/src/components/LineChart/LineChart.Circle.tsx +0 -105
  99. package/src/scss/LinearChart.scss +0 -0
  100. package/src/scss/editor-panel.scss +0 -745
  101. package/src/scss/legend.scss +0 -206
  102. package/src/scss/mixins.scss +0 -0
  103. package/src/scss/variables.scss +0 -1
  104. package/src/types/ChartProps.ts +0 -7
@@ -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;
@@ -1,7 +0,0 @@
1
- export type BarChartProps = {
2
- seriesScale: Function
3
- xMax: number
4
- xScale: Function
5
- yMax: number
6
- yScale: Function
7
- }