@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
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
|
|
3
|
-
import { type PanelProps } from './PanelProps'
|
|
4
|
-
|
|
5
|
-
const days = [
|
|
6
|
-
{ day: 'Sunday', abbr: 'S', status: 'inactive' },
|
|
7
|
-
{ day: 'Monday', abbr: 'M', status: 'inactive' },
|
|
8
|
-
{ day: 'Tuesday', abbr: 'T', status: 'inactive' },
|
|
9
|
-
{ day: 'Wednesday', abbr: 'W', status: 'inactive' },
|
|
10
|
-
{ day: 'Thursday', abbr: 'T', status: 'inactive' },
|
|
11
|
-
{ day: 'Friday', abbr: 'F', status: 'inactive' },
|
|
12
|
-
{ day: 'Saturday', abbr: 'S', status: 'inactive' }
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
const DateHighlighting = ({ name }: PanelProps) => {
|
|
16
|
-
const [interval, setInterval] = useState(0)
|
|
17
|
-
const [isPlural, setIsPlural] = useState(false)
|
|
18
|
-
const [recurrance, setRecurrance] = useState('Days')
|
|
19
|
-
const [firstRecurranceUpdate, setFirstRecurranceUpdate] = useState(false)
|
|
20
|
-
const [daySelections, setDaySelections] = useState(days)
|
|
21
|
-
|
|
22
|
-
const handleDaySelections = e => {
|
|
23
|
-
const incomingDay = e.target.value
|
|
24
|
-
const prev = [...daySelections]
|
|
25
|
-
|
|
26
|
-
const updatedDays = prev.map(day => {
|
|
27
|
-
if (day.day === incomingDay) {
|
|
28
|
-
return { ...day, status: day.status === 'active' ? 'inactive' : 'active' }
|
|
29
|
-
}
|
|
30
|
-
return day
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
setDaySelections(updatedDays)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (interval > 7 && !firstRecurranceUpdate) {
|
|
38
|
-
setRecurrance('Weeks')
|
|
39
|
-
}
|
|
40
|
-
}, [interval])
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (interval > 1) {
|
|
44
|
-
setIsPlural(true)
|
|
45
|
-
} else {
|
|
46
|
-
setIsPlural(false)
|
|
47
|
-
}
|
|
48
|
-
}, [interval])
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<AccordionItem>
|
|
52
|
-
<AccordionItemHeading>
|
|
53
|
-
<AccordionItemButton>{name}</AccordionItemButton>
|
|
54
|
-
</AccordionItemHeading>
|
|
55
|
-
<AccordionItemPanel>
|
|
56
|
-
<ul className='date-highlight'>
|
|
57
|
-
<div className='date-highlight__occurance'>
|
|
58
|
-
<label htmlFor=''>Repeat Every</label>
|
|
59
|
-
<input type='number' value={interval} onChange={e => setInterval(Number(e.target.value))} />
|
|
60
|
-
<select value={recurrance} onChange={e => setRecurrance(e.target.value)}>
|
|
61
|
-
<option value='Day'>{isPlural ? 'Days' : 'Day'}</option>
|
|
62
|
-
<option value='Week'>{isPlural ? 'Weeks' : 'Week'}</option>
|
|
63
|
-
<option value='Month'>{isPlural ? 'Months' : 'Month'}</option>
|
|
64
|
-
<option value='Year'>{isPlural ? 'Years' : 'Year'}</option>
|
|
65
|
-
</select>
|
|
66
|
-
</div>
|
|
67
|
-
{recurrance !== 'Days' && (
|
|
68
|
-
<div className='date-highlight__day-selection'>
|
|
69
|
-
<label htmlFor='' style={{ display: 'block', width: '100%' }}>
|
|
70
|
-
Repeat On
|
|
71
|
-
</label>
|
|
72
|
-
{daySelections.map(d => (
|
|
73
|
-
<button className={`week-button week-button--${d.status} ${d.day}`} value={d.day} onClick={handleDaySelections}>
|
|
74
|
-
{d.abbr}
|
|
75
|
-
</button>
|
|
76
|
-
))}
|
|
77
|
-
</div>
|
|
78
|
-
)}
|
|
79
|
-
<div className='date-highlight__end-date'>
|
|
80
|
-
<label htmlFor=''>Ends</label>
|
|
81
|
-
<div className='radio-group'>
|
|
82
|
-
<div className='group'>
|
|
83
|
-
<input type='radio' name='ending' value='Never' id='Never' />
|
|
84
|
-
<label for='Never'>Never</label>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div className='radio-group'>
|
|
88
|
-
<div className='group'>
|
|
89
|
-
<input type='radio' name='ending' value='After' id='After' />
|
|
90
|
-
<label for='After'>After</label>
|
|
91
|
-
</div>
|
|
92
|
-
<input type='number' className='date-highlight__end-date--on' />
|
|
93
|
-
<p>occurances</p>
|
|
94
|
-
</div>
|
|
95
|
-
<div className='radio-group'>
|
|
96
|
-
<div className='group'>
|
|
97
|
-
<input type='radio' name='ending' value='On' id='On' />
|
|
98
|
-
<label for='On'>On</label>
|
|
99
|
-
</div>
|
|
100
|
-
<input type='date' className='date-highlight__end-date--after' />
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</ul>
|
|
104
|
-
</AccordionItemPanel>
|
|
105
|
-
</AccordionItem>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export default DateHighlighting
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import ForestPlotSettings from './Panel.ForestPlotSettings'
|
|
2
|
-
import Series from './Panel.Series.jsx'
|
|
3
|
-
import DateHighlighting from './Panel.DateHighlighting'
|
|
4
|
-
import Regions from './Panel.Regions'
|
|
5
|
-
|
|
6
|
-
const Panels = {
|
|
7
|
-
ForestPlot: ForestPlotSettings,
|
|
8
|
-
Series: Series,
|
|
9
|
-
DateHighlighting,
|
|
10
|
-
Regions
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Panels
|