@cdc/chart 4.24.1 → 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.
- package/dist/cdcchart.js +30014 -29757
- package/examples/feature/line/line-chart-preliminary.json +84 -37
- package/examples/feature/regions/index.json +9 -5
- package/index.html +4 -2
- package/package.json +2 -2
- package/src/CdcChart.tsx +41 -24
- package/src/_stories/ChartEditor.stories.tsx +1 -1
- package/src/_stories/_mock/pie_config.json +4 -3
- package/src/components/AreaChart/components/AreaChart.jsx +1 -25
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +7 -5
- package/src/components/BarChart/components/BarChart.Vertical.tsx +12 -13
- package/src/components/BoxPlot/BoxPlot.jsx +9 -8
- package/src/components/EditorPanel/EditorPanel.tsx +1563 -1959
- package/src/components/EditorPanel/EditorPanelContext.ts +40 -0
- package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +148 -0
- package/src/components/EditorPanel/components/{Panel.ForestPlotSettings.tsx → Panels/Panel.ForestPlotSettings.tsx} +16 -7
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +160 -0
- package/src/components/EditorPanel/components/{Panel.Regions.tsx → Panels/Panel.Regions.tsx} +5 -5
- package/src/components/EditorPanel/components/{Panel.Series.tsx → Panels/Panel.Series.tsx} +4 -4
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +297 -0
- package/src/components/EditorPanel/components/Panels/index.tsx +17 -0
- package/src/components/EditorPanel/editor-panel.scss +1 -13
- package/src/components/EditorPanel/useEditorPermissions.js +5 -0
- package/src/components/Legend/Legend.Component.tsx +199 -0
- package/src/components/Legend/Legend.tsx +5 -324
- package/src/components/Legend/helpers/createFormatLabels.tsx +140 -0
- package/src/components/LineChart/LineChartProps.ts +1 -1
- package/src/components/LineChart/components/LineChart.Circle.tsx +85 -52
- package/src/components/LineChart/helpers.ts +2 -2
- package/src/components/LineChart/index.tsx +97 -21
- package/src/components/LinearChart.jsx +3 -3
- package/src/components/PairedBarChart.jsx +4 -2
- package/src/components/PieChart/PieChart.tsx +78 -25
- package/src/components/Regions/components/Regions.tsx +14 -5
- package/src/data/initial-state.js +5 -2
- package/src/helpers/computeMarginBottom.ts +2 -2
- package/src/hooks/useHighlightedBars.js +1 -1
- package/src/hooks/useMinMax.ts +3 -3
- package/src/hooks/useScales.ts +18 -5
- package/src/hooks/useTooltip.tsx +11 -7
- package/src/scss/main.scss +0 -67
- package/src/types/ChartConfig.ts +17 -8
- package/src/types/ChartContext.ts +10 -4
- package/src/types/Label.ts +7 -0
- package/examples/private/chart-t.json +0 -3740
- package/examples/private/combo.json +0 -369
- package/examples/private/epi-data.csv +0 -13
- package/examples/private/epi-data.json +0 -62
- package/examples/private/epi.json +0 -403
- package/examples/private/occupancy.json +0 -109283
- package/examples/private/prod-line-config.json +0 -401
- package/examples/private/region-data.json +0 -822
- package/examples/private/region-testing.json +0 -312
- package/examples/private/scaling.json +0 -45325
- package/examples/private/testing-data.json +0 -1739
- package/examples/private/testing.json +0 -816
- package/src/components/EditorPanel/components/Panel.DateHighlighting.tsx +0 -109
- package/src/components/EditorPanel/components/Panels.tsx +0 -13
package/src/scss/main.scss
CHANGED
|
@@ -1,73 +1,6 @@
|
|
|
1
1
|
@import '@cdc/core/styles/base';
|
|
2
2
|
@import '@cdc/core/styles/heading-colors';
|
|
3
3
|
@import '@cdc/core/styles/v2/themes/color-definitions';
|
|
4
|
-
.dash-container {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
flex-direction: row;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.legend-dash-left {
|
|
11
|
-
margin-left: 8px !important;
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dash-inner {
|
|
17
|
-
width: 20px;
|
|
18
|
-
margin-left: 0px !important;
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.dashes {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
|
|
27
|
-
&.open-circles {
|
|
28
|
-
width: 12px;
|
|
29
|
-
height: 12px;
|
|
30
|
-
border: 2px solid currentColor;
|
|
31
|
-
border-radius: 50%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&.dashed-small {
|
|
35
|
-
margin: 0 0px;
|
|
36
|
-
font-size: 20px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.dashed-medium,
|
|
40
|
-
&.dashed-large {
|
|
41
|
-
span {
|
|
42
|
-
display: inline-block;
|
|
43
|
-
position: relative;
|
|
44
|
-
margin-right: 12px;
|
|
45
|
-
margin-left: 0 !important;
|
|
46
|
-
|
|
47
|
-
&::before {
|
|
48
|
-
content: '';
|
|
49
|
-
display: block;
|
|
50
|
-
height: 2px;
|
|
51
|
-
background-color: currentColor;
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 50%;
|
|
54
|
-
transform: translateY(-20%);
|
|
55
|
-
width: 10px;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.dashed-large {
|
|
61
|
-
span {
|
|
62
|
-
margin-right: 12px;
|
|
63
|
-
margin-left: 0 !important;
|
|
64
|
-
|
|
65
|
-
&::before {
|
|
66
|
-
width: 13px;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
4
|
|
|
72
5
|
.form-container {
|
|
73
6
|
overflow-y: auto;
|
package/src/types/ChartConfig.ts
CHANGED
|
@@ -5,23 +5,22 @@ import { type Series } from '@cdc/core/types/Series'
|
|
|
5
5
|
import { Runtime } from '@cdc/core/types/Runtime'
|
|
6
6
|
import { FilterBehavior } from '@cdc/core/types/FilterBehavior'
|
|
7
7
|
import { Table } from '@cdc/core/types/Table'
|
|
8
|
+
import { BoxPlot } from '@cdc/core/types/BoxPlot'
|
|
9
|
+
import { General } from '@cdc/core/types/General'
|
|
8
10
|
|
|
9
11
|
export type ChartColumns = Record<string, Column>
|
|
10
12
|
|
|
11
13
|
type Region = {
|
|
12
14
|
from: string
|
|
13
15
|
to: string
|
|
16
|
+
fromType: 'Previous Days' | 'Fixed Date'
|
|
17
|
+
toType: 'Last Date' | 'Fised Date'
|
|
14
18
|
label: string
|
|
15
19
|
color: string
|
|
16
20
|
background: string
|
|
17
21
|
range: 'Custom' | string
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
type BoxPlot = {
|
|
21
|
-
firstQuartilePercentage: number
|
|
22
|
-
[key: string]: any
|
|
23
|
-
}
|
|
24
|
-
|
|
25
24
|
type DataFormat = {
|
|
26
25
|
abbreviated: boolean
|
|
27
26
|
bottomAbbreviated: boolean
|
|
@@ -47,6 +46,7 @@ type Exclusions = {
|
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
type Filter = {
|
|
49
|
+
active: string
|
|
50
50
|
type: 'url'
|
|
51
51
|
columnName: string
|
|
52
52
|
showDropdown: boolean
|
|
@@ -54,6 +54,7 @@ type Filter = {
|
|
|
54
54
|
label: string
|
|
55
55
|
order: 'asc' | 'desc' | 'cust'
|
|
56
56
|
values: string[]
|
|
57
|
+
queryParameter: string
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export type Legend = {
|
|
@@ -86,9 +87,7 @@ type Visual = {
|
|
|
86
87
|
|
|
87
88
|
type AllChartsConfig = {
|
|
88
89
|
animate: boolean
|
|
89
|
-
general:
|
|
90
|
-
boxplot: BoxPlot
|
|
91
|
-
}
|
|
90
|
+
general: General
|
|
92
91
|
barHasBorder: 'true' | 'false'
|
|
93
92
|
barHeight: number
|
|
94
93
|
barSpace: number
|
|
@@ -100,11 +99,15 @@ type AllChartsConfig = {
|
|
|
100
99
|
height: number
|
|
101
100
|
}
|
|
102
101
|
chartMessage: { noData?: string }
|
|
102
|
+
color: string
|
|
103
103
|
colorMatchLineSeriesLabels: boolean
|
|
104
104
|
columns: ChartColumns
|
|
105
105
|
confidenceKeys: Record<string, any>
|
|
106
|
+
customColors: string[]
|
|
106
107
|
data: Object[]
|
|
108
|
+
dataUrl: string
|
|
107
109
|
dataCutoff: number
|
|
110
|
+
dataDescription: string
|
|
108
111
|
dataFormat: DataFormat
|
|
109
112
|
dataKey: string
|
|
110
113
|
description: string
|
|
@@ -115,6 +118,7 @@ type AllChartsConfig = {
|
|
|
115
118
|
fontSize: 'small' | 'medium' | 'large'
|
|
116
119
|
footnotes: string
|
|
117
120
|
forestPlot: ForestPlotConfigSettings
|
|
121
|
+
formattedData: Object[] & { urlFiltered: boolean }
|
|
118
122
|
heights: {
|
|
119
123
|
vertical: number
|
|
120
124
|
}
|
|
@@ -135,11 +139,15 @@ type AllChartsConfig = {
|
|
|
135
139
|
orientation: 'vertical' | 'horizontal'
|
|
136
140
|
palette: string
|
|
137
141
|
pieType?: string
|
|
142
|
+
primary?: DataFormat
|
|
138
143
|
roundingStyle: string
|
|
139
144
|
runtime: Runtime
|
|
145
|
+
runtimeDataUrl: string
|
|
140
146
|
series: Series
|
|
141
147
|
showLineSeriesLabels: boolean
|
|
148
|
+
showSidebar: boolean
|
|
142
149
|
showTitle: boolean
|
|
150
|
+
sortData: 'ascending' | 'descending'
|
|
143
151
|
stackedAreaChartLineType: string
|
|
144
152
|
suppressedData?: { label: string; icon: string; value: string }[]
|
|
145
153
|
superTitle: string
|
|
@@ -150,6 +158,7 @@ type AllChartsConfig = {
|
|
|
150
158
|
tooltips: {
|
|
151
159
|
singleSeries: boolean
|
|
152
160
|
opacity: number
|
|
161
|
+
dateDisplayFormat: string
|
|
153
162
|
}
|
|
154
163
|
topAxis: { hasLine: boolean }
|
|
155
164
|
twoColor: { palette: string }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ChartConfig } from './ChartConfig'
|
|
2
2
|
import { PickD3Scale } from '@visx/scale'
|
|
3
3
|
|
|
4
|
-
type ColorScale = PickD3Scale<'ordinal', any, any>
|
|
4
|
+
export type ColorScale = PickD3Scale<'ordinal', any, any>
|
|
5
5
|
|
|
6
|
-
type TransformedData = {
|
|
6
|
+
export type TransformedData = {
|
|
7
7
|
dataKey?: string
|
|
8
8
|
[key: string]: any
|
|
9
9
|
}
|
|
@@ -20,17 +20,20 @@ type SharedChartContext = {
|
|
|
20
20
|
type LineChartContext = SharedChartContext & {
|
|
21
21
|
dimensions: [screenWidth: number, screenHeight: number]
|
|
22
22
|
formatDate: Function
|
|
23
|
+
formatTooltipsDate: Function
|
|
23
24
|
formatNumber: Function
|
|
24
25
|
handleLineType: Function
|
|
25
26
|
isNumber: unknown
|
|
26
27
|
isDebug?: boolean
|
|
27
28
|
parseDate: Function
|
|
28
29
|
rawData: Object[]
|
|
29
|
-
seriesHighlight:
|
|
30
|
+
seriesHighlight: string[]
|
|
30
31
|
tableData: Object[]
|
|
31
32
|
transformedData: TransformedData[]
|
|
32
33
|
updateConfig: Function
|
|
33
34
|
visualizationType: 'Line'
|
|
35
|
+
colorPalettes: Record<string, string[]>
|
|
36
|
+
twoColorPalette: Record<string, string[]>
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
export type ChartContext =
|
|
@@ -38,6 +41,7 @@ export type ChartContext =
|
|
|
38
41
|
| (SharedChartContext & {
|
|
39
42
|
dimensions: [screenWidth: number, screenHeight: number]
|
|
40
43
|
formatDate?: Function
|
|
44
|
+
formatTooltipsDate: Function
|
|
41
45
|
formatNumber?: Function
|
|
42
46
|
handleLineType?: Function
|
|
43
47
|
isNumber?: boolean
|
|
@@ -45,10 +49,12 @@ export type ChartContext =
|
|
|
45
49
|
isDebug?: boolean
|
|
46
50
|
parseDate?: Function
|
|
47
51
|
rawData?: Object[]
|
|
48
|
-
seriesHighlight?:
|
|
52
|
+
seriesHighlight?: string[]
|
|
49
53
|
tableData?: Object[]
|
|
50
54
|
transformedData?: TransformedData[]
|
|
51
55
|
setSharedFilter?: Function
|
|
52
56
|
sharedFilterValue?: string
|
|
53
57
|
updateConfig?: Function
|
|
58
|
+
colorPalettes: any
|
|
59
|
+
twoColorPalette: any
|
|
54
60
|
})
|