@cdc/chart 4.23.1 → 4.23.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 +54532 -696
- package/examples/Barchart_with_negative.json +34 -0
- package/examples/box-plot.json +2 -2
- package/examples/dynamic-legends.json +1 -1
- package/examples/example-bar-chart-nonnumeric.json +36 -0
- package/examples/example-bar-chart.json +33 -0
- package/examples/example-combo-bar-nonnumeric.json +105 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +1 -1
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +2 -2
- package/examples/gallery/paired-bar/paired-bar-chart.json +65 -13
- package/examples/line-chart-nonnumeric.json +32 -0
- package/examples/line-chart.json +21 -63
- package/examples/newdata.json +1 -1
- package/examples/planet-combo-example-config.json +143 -20
- package/examples/planet-example-data-nonnumeric.json +56 -0
- package/examples/planet-example-data.json +2 -2
- package/examples/planet-pie-example-config-nonnumeric.json +30 -0
- package/examples/scatterplot-continuous.csv +17 -0
- package/examples/scatterplot.json +136 -0
- package/examples/sparkline-chart-nonnumeric.json +76 -0
- package/examples/stacked-vertical-bar-example-negative.json +154 -0
- package/examples/stacked-vertical-bar-example-nonnumerics.json +154 -0
- package/index.html +74 -0
- package/package.json +29 -23
- package/src/{CdcChart.tsx → CdcChart.jsx} +74 -56
- package/src/components/{BarChart.tsx → BarChart.jsx} +99 -91
- package/src/components/BoxPlot.jsx +88 -0
- package/src/components/{DataTable.tsx → DataTable.jsx} +102 -25
- package/src/components/{EditorPanel.js → EditorPanel.jsx} +228 -14
- package/src/components/{Filters.js → Filters.jsx} +6 -12
- package/src/components/{Legend.js → Legend.jsx} +120 -108
- package/src/components/{LineChart.tsx → LineChart.jsx} +26 -12
- package/src/components/{LinearChart.tsx → LinearChart.jsx} +67 -47
- package/src/components/{PairedBarChart.tsx → PairedBarChart.jsx} +45 -78
- package/src/components/{PieChart.tsx → PieChart.jsx} +17 -32
- package/src/components/ScatterPlot.jsx +48 -0
- package/src/components/{SparkLine.js → SparkLine.jsx} +49 -18
- package/src/components/{useIntersectionObserver.tsx → useIntersectionObserver.jsx} +1 -1
- package/src/data/initial-state.js +33 -3
- package/src/hooks/{useColorPalette.ts → useColorPalette.js} +10 -28
- package/src/hooks/{useReduceData.ts → useReduceData.js} +25 -14
- package/src/hooks/useRightAxis.js +3 -1
- package/src/index.jsx +16 -0
- package/src/scss/DataTable.scss +22 -0
- package/src/scss/main.scss +30 -10
- package/vite.config.js +4 -0
- package/dist/495.js +0 -3
- package/dist/703.js +0 -1
- package/src/components/BoxPlot.js +0 -92
- package/src/index.html +0 -67
- package/src/index.tsx +0 -18
- /package/src/{context.tsx → ConfigContext.jsx} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, memo, useContext } from 'react'
|
|
2
|
-
import { DragDropContext, Droppable, Draggable } from '
|
|
2
|
+
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'
|
|
3
3
|
|
|
4
4
|
import { Accordion, AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
|
|
5
5
|
|
|
6
6
|
import { useDebounce } from 'use-debounce'
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import ConfigContext from '../ConfigContext'
|
|
9
9
|
import WarningImage from '../images/warning.svg'
|
|
10
10
|
import AdvancedEditor from '@cdc/core/components/AdvancedEditor'
|
|
11
11
|
|
|
@@ -18,9 +18,6 @@ import Icon from '@cdc/core/components/ui/Icon'
|
|
|
18
18
|
import useReduceData from '../hooks/useReduceData'
|
|
19
19
|
import useRightAxis from '../hooks/useRightAxis'
|
|
20
20
|
|
|
21
|
-
// TODO: Remove unused imports
|
|
22
|
-
// TDOO: Move inline styles to a scss file
|
|
23
|
-
|
|
24
21
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
25
22
|
|
|
26
23
|
const TextField = memo(({ label, tooltip, section = null, subsection = null, fieldName, updateField, value: stateValue, type = 'input', i = null, min = null, ...attributes }) => {
|
|
@@ -209,7 +206,7 @@ const Regions = memo(({ config, updateConfig }) => {
|
|
|
209
206
|
const headerColors = ['theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber']
|
|
210
207
|
|
|
211
208
|
const EditorPanel = () => {
|
|
212
|
-
const { config, updateConfig, transformedData: data, loading, colorPalettes, unfilteredData, excludedData, isDashboard, setParentConfig, missingRequiredSections } = useContext(
|
|
209
|
+
const { config, updateConfig, transformedData: data, loading, colorPalettes, unfilteredData, excludedData, isDashboard, setParentConfig, missingRequiredSections } = useContext(ConfigContext)
|
|
213
210
|
|
|
214
211
|
const { minValue, maxValue, existPositiveValue, isAllLine } = useReduceData(config, unfilteredData)
|
|
215
212
|
const { paletteName, isPaletteReversed, filteredPallets, filteredQualitative, dispatch } = useColorPalette(colorPalettes, config)
|
|
@@ -290,12 +287,38 @@ const EditorPanel = () => {
|
|
|
290
287
|
}
|
|
291
288
|
|
|
292
289
|
const updateField = (section, subsection, fieldName, newValue) => {
|
|
293
|
-
|
|
290
|
+
|
|
291
|
+
if (section === 'boxplot' && subsection === 'legend') {
|
|
292
|
+
updateConfig({
|
|
293
|
+
...config,
|
|
294
|
+
[section]: {
|
|
295
|
+
...config[section],
|
|
296
|
+
[subsection]: {
|
|
297
|
+
...config.boxplot[subsection],
|
|
298
|
+
[fieldName]: newValue
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (section === 'boxplot' && subsection === 'labels') {
|
|
306
|
+
updateConfig({
|
|
307
|
+
...config,
|
|
308
|
+
[section]: {
|
|
309
|
+
...config[section],
|
|
310
|
+
[subsection]: {
|
|
311
|
+
...config.boxplot[subsection],
|
|
312
|
+
[fieldName]: newValue
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
|
|
294
319
|
if (null === section && null === subsection) {
|
|
295
320
|
let updatedConfig = { ...config, [fieldName]: newValue }
|
|
296
|
-
|
|
297
321
|
enforceRestrictions(updatedConfig)
|
|
298
|
-
|
|
299
322
|
updateConfig(updatedConfig)
|
|
300
323
|
return
|
|
301
324
|
}
|
|
@@ -304,6 +327,8 @@ const EditorPanel = () => {
|
|
|
304
327
|
|
|
305
328
|
let sectionValue = isArray ? [...config[section], newValue] : { ...config[section], [fieldName]: newValue }
|
|
306
329
|
|
|
330
|
+
console.log('section value', sectionValue)
|
|
331
|
+
|
|
307
332
|
if (null !== subsection) {
|
|
308
333
|
if (isArray) {
|
|
309
334
|
sectionValue = [...config[section]]
|
|
@@ -689,6 +714,7 @@ const EditorPanel = () => {
|
|
|
689
714
|
</AccordionItemHeading>
|
|
690
715
|
<AccordionItemPanel>
|
|
691
716
|
<Select value={config.visualizationType} fieldName='visualizationType' label='Chart Type' updateField={updateField} options={['Pie', 'Line', 'Bar', 'Combo', 'Paired Bar', 'Spark Line']} />
|
|
717
|
+
|
|
692
718
|
{(config.visualizationType === 'Bar' || config.visualizationType === 'Combo') && <Select value={config.visualizationSubType || 'Regular'} fieldName='visualizationSubType' label='Chart Subtype' updateField={updateField} options={['regular', 'stacked']} />}
|
|
693
719
|
{config.visualizationType === 'Bar' && <Select value={config.orientation || 'vertical'} fieldName='orientation' label='Orientation' updateField={updateField} options={['vertical', 'horizontal']} />}
|
|
694
720
|
{config.visualizationType === 'Bar' && <Select value={config.isLollipopChart ? 'lollipop' : config.barStyle || 'flat'} fieldName='barStyle' label='bar style' updateField={updateField} options={showBarStyleOptions()} />}
|
|
@@ -917,6 +943,181 @@ const EditorPanel = () => {
|
|
|
917
943
|
</AccordionItem>
|
|
918
944
|
)}
|
|
919
945
|
|
|
946
|
+
{config.visualizationType === 'Box Plot' && (
|
|
947
|
+
<AccordionItem>
|
|
948
|
+
<AccordionItemHeading>
|
|
949
|
+
<AccordionItemButton>Measures</AccordionItemButton>
|
|
950
|
+
</AccordionItemHeading>
|
|
951
|
+
<AccordionItemPanel>
|
|
952
|
+
<h4>Labels for 5-Number Summary</h4>
|
|
953
|
+
|
|
954
|
+
{/* prettier-ignore */}
|
|
955
|
+
{/* max */}
|
|
956
|
+
<TextField
|
|
957
|
+
type='text'
|
|
958
|
+
value={config.boxplot.labels.maximum}
|
|
959
|
+
fieldName='maximum'
|
|
960
|
+
section='boxplot'
|
|
961
|
+
subsection='labels'
|
|
962
|
+
label='Maximum'
|
|
963
|
+
updateField={updateField}
|
|
964
|
+
tooltip={
|
|
965
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
966
|
+
<Tooltip.Target>
|
|
967
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
968
|
+
</Tooltip.Target>
|
|
969
|
+
<Tooltip.Content>
|
|
970
|
+
<p>Highest value, excluding outliers</p>
|
|
971
|
+
</Tooltip.Content>
|
|
972
|
+
</Tooltip>
|
|
973
|
+
}
|
|
974
|
+
/>
|
|
975
|
+
|
|
976
|
+
{/* prettier-ignore */}
|
|
977
|
+
{/* Q3 */}
|
|
978
|
+
<TextField
|
|
979
|
+
type='text'
|
|
980
|
+
value={config.boxplot.labels.q3}
|
|
981
|
+
fieldName='q3'
|
|
982
|
+
section='boxplot'
|
|
983
|
+
subsection='labels'
|
|
984
|
+
label='Upper Quartile'
|
|
985
|
+
updateField={updateField}
|
|
986
|
+
tooltip={
|
|
987
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
988
|
+
<Tooltip.Target>
|
|
989
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
990
|
+
</Tooltip.Target>
|
|
991
|
+
<Tooltip.Content>
|
|
992
|
+
<p>Represented by top line of box. 25% of data are higher.</p>
|
|
993
|
+
</Tooltip.Content>
|
|
994
|
+
</Tooltip>
|
|
995
|
+
}
|
|
996
|
+
/>
|
|
997
|
+
|
|
998
|
+
{/* prettier-ignore */}
|
|
999
|
+
{/* median */}
|
|
1000
|
+
<TextField
|
|
1001
|
+
type='text'
|
|
1002
|
+
value={config.boxplot.labels.median}
|
|
1003
|
+
fieldName='median'
|
|
1004
|
+
section='boxplot'
|
|
1005
|
+
subsection='labels'
|
|
1006
|
+
label='Median'
|
|
1007
|
+
updateField={updateField}
|
|
1008
|
+
tooltip={
|
|
1009
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
1010
|
+
<Tooltip.Target>
|
|
1011
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1012
|
+
</Tooltip.Target>
|
|
1013
|
+
<Tooltip.Content>
|
|
1014
|
+
<p>Middle data point. Half of data are higher value.</p>
|
|
1015
|
+
</Tooltip.Content>
|
|
1016
|
+
</Tooltip>
|
|
1017
|
+
}
|
|
1018
|
+
/>
|
|
1019
|
+
|
|
1020
|
+
{/* prettier-ignore */}
|
|
1021
|
+
{/* q1 */}
|
|
1022
|
+
<TextField
|
|
1023
|
+
type='text'
|
|
1024
|
+
value={config.boxplot.labels.q1}
|
|
1025
|
+
fieldName='q1'
|
|
1026
|
+
section='boxplot'
|
|
1027
|
+
subsection='labels'
|
|
1028
|
+
label='Lower Quartile'
|
|
1029
|
+
updateField={updateField}
|
|
1030
|
+
tooltip={
|
|
1031
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
1032
|
+
<Tooltip.Target>
|
|
1033
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1034
|
+
</Tooltip.Target>
|
|
1035
|
+
<Tooltip.Content>
|
|
1036
|
+
<p>Represented by bottom line of box. 25% of data are lower.</p>
|
|
1037
|
+
</Tooltip.Content>
|
|
1038
|
+
</Tooltip>
|
|
1039
|
+
}
|
|
1040
|
+
/>
|
|
1041
|
+
|
|
1042
|
+
{/* prettier-ignore */}
|
|
1043
|
+
{/* minimum */}
|
|
1044
|
+
<TextField
|
|
1045
|
+
type='text'
|
|
1046
|
+
value={config.boxplot.labels.minimum}
|
|
1047
|
+
fieldName='minimum'
|
|
1048
|
+
section='boxplot'
|
|
1049
|
+
subsection='labels'
|
|
1050
|
+
label='Minimum'
|
|
1051
|
+
updateField={updateField}
|
|
1052
|
+
tooltip={
|
|
1053
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
1054
|
+
<Tooltip.Target>
|
|
1055
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1056
|
+
</Tooltip.Target>
|
|
1057
|
+
<Tooltip.Content>
|
|
1058
|
+
<p>Lowest value, excluding outliers</p>
|
|
1059
|
+
</Tooltip.Content>
|
|
1060
|
+
</Tooltip>
|
|
1061
|
+
}
|
|
1062
|
+
/>
|
|
1063
|
+
|
|
1064
|
+
{/* iqr */}
|
|
1065
|
+
<TextField type='text' value={config.boxplot.labels.iqr} fieldName='iqr' section='boxplot' subsection='labels' label='Interquartile Range' updateField={updateField} />
|
|
1066
|
+
|
|
1067
|
+
{/* count */}
|
|
1068
|
+
<TextField type='text' value={config.boxplot.labels.count} fieldName='count' section='boxplot' subsection='labels' label='Count' updateField={updateField} />
|
|
1069
|
+
|
|
1070
|
+
{/* mean */}
|
|
1071
|
+
<TextField type='text' value={config.boxplot.labels.mean} fieldName='mean' section='boxplot' subsection='labels' label='Mean' updateField={updateField} />
|
|
1072
|
+
{/* outliers */}
|
|
1073
|
+
<TextField type='text' value={config.boxplot.labels.outliers} fieldName='outliers' section='boxplot' subsection='labels' label='Outliers' updateField={updateField} />
|
|
1074
|
+
{/* values */}
|
|
1075
|
+
<TextField type='text' value={config.boxplot.labels.values} fieldName='values' section='boxplot' subsection='labels' label='Values' updateField={updateField} />
|
|
1076
|
+
<br />
|
|
1077
|
+
<h4>Percentages for Quartiles</h4>
|
|
1078
|
+
<TextField
|
|
1079
|
+
type='number'
|
|
1080
|
+
value={config.boxplot.firstQuartilePercentage}
|
|
1081
|
+
fieldName='firstQuartilePercentage'
|
|
1082
|
+
section='boxplot'
|
|
1083
|
+
label='Lower Quartile'
|
|
1084
|
+
max={100}
|
|
1085
|
+
updateField={updateField}
|
|
1086
|
+
tooltip={
|
|
1087
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
1088
|
+
<Tooltip.Target>
|
|
1089
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1090
|
+
</Tooltip.Target>
|
|
1091
|
+
<Tooltip.Content>
|
|
1092
|
+
<p>Represented by bottom line of box. 25% of data are lower.</p>
|
|
1093
|
+
</Tooltip.Content>
|
|
1094
|
+
</Tooltip>
|
|
1095
|
+
}
|
|
1096
|
+
/>
|
|
1097
|
+
|
|
1098
|
+
<TextField
|
|
1099
|
+
type='number'
|
|
1100
|
+
value={config.boxplot.thirdQuartilePercentage}
|
|
1101
|
+
fieldName='thirdQuartilePercentage'
|
|
1102
|
+
label='Upper Quartile'
|
|
1103
|
+
section='boxplot'
|
|
1104
|
+
max={100}
|
|
1105
|
+
updateField={updateField}
|
|
1106
|
+
tooltip={
|
|
1107
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
1108
|
+
<Tooltip.Target>
|
|
1109
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
1110
|
+
</Tooltip.Target>
|
|
1111
|
+
<Tooltip.Content>
|
|
1112
|
+
<p>Represented by top line of box. 25% of data are higher.</p>
|
|
1113
|
+
</Tooltip.Content>
|
|
1114
|
+
</Tooltip>
|
|
1115
|
+
}
|
|
1116
|
+
/>
|
|
1117
|
+
</AccordionItemPanel>
|
|
1118
|
+
</AccordionItem>
|
|
1119
|
+
)}
|
|
1120
|
+
|
|
920
1121
|
{hasRightAxis && config.series && config.visualizationType === 'Combo' && (
|
|
921
1122
|
<AccordionItem>
|
|
922
1123
|
<AccordionItemHeading>
|
|
@@ -1016,6 +1217,7 @@ const EditorPanel = () => {
|
|
|
1016
1217
|
<TextField value={config.yAxis.label} section='yAxis' fieldName='label' label='Label' updateField={updateField} />
|
|
1017
1218
|
{config.runtime.seriesKeys && config.runtime.seriesKeys.length === 1 && <CheckBox value={config.isLegendValue} fieldName='isLegendValue' label='Use Legend Value in Hover' updateField={updateField} />}
|
|
1018
1219
|
<TextField value={config.yAxis.numTicks} placeholder='Auto' type='number' section='yAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
|
|
1220
|
+
{config.visualizationType === 'Paired Bar' && <TextField value={config.yAxis.tickRotation || 0} type='number' min='0' section='yAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />}
|
|
1019
1221
|
<TextField
|
|
1020
1222
|
value={config.yAxis.size}
|
|
1021
1223
|
type='number'
|
|
@@ -1035,6 +1237,7 @@ const EditorPanel = () => {
|
|
|
1035
1237
|
</Tooltip>
|
|
1036
1238
|
}
|
|
1037
1239
|
/>
|
|
1240
|
+
<TextField value={config.yAxis.axisPadding} type='number' max={10} min={0} section='yAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} />
|
|
1038
1241
|
{config.orientation === 'horizontal' && <TextField value={config.xAxis.labelOffset} section='xAxis' fieldName='labelOffset' label='Label offset' type='number' className='number-narrow' updateField={updateField} />}
|
|
1039
1242
|
{config.orientation !== 'horizontal' && <CheckBox value={config.yAxis.gridLines} section='yAxis' fieldName='gridLines' label='Display Gridlines' updateField={updateField} />}
|
|
1040
1243
|
</>
|
|
@@ -1193,7 +1396,7 @@ const EditorPanel = () => {
|
|
|
1193
1396
|
<AccordionItemPanel>
|
|
1194
1397
|
{config.visualizationType !== 'Pie' && (
|
|
1195
1398
|
<>
|
|
1196
|
-
<Select value={config.xAxis.type} section='xAxis' fieldName='type' label='Data Type' updateField={updateField} options={['categorical', 'date']} />
|
|
1399
|
+
<Select value={config.xAxis.type} section='xAxis' fieldName='type' label='Data Type' updateField={updateField} options={config.visualizationType !== 'Scatter Plot' ? ['categorical', 'date'] : ['categorical', 'date', 'continuous']} />
|
|
1197
1400
|
<Select
|
|
1198
1401
|
value={config.xAxis.dataKey || ''}
|
|
1199
1402
|
section='xAxis'
|
|
@@ -1315,6 +1518,7 @@ const EditorPanel = () => {
|
|
|
1315
1518
|
<TextField value={config.xAxis.numTicks} placeholder='Auto' type='number' min='1' section='xAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
|
|
1316
1519
|
|
|
1317
1520
|
<TextField value={config.xAxis.size} type='number' min='0' section='xAxis' fieldName='size' label={config.orientation === 'horizontal' ? 'Size (Width)' : 'Size (Height)'} className='number-narrow' updateField={updateField} />
|
|
1521
|
+
<TextField value={config.xAxis.axisPadding} type='number' max={10} min={0} section='xAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} />
|
|
1318
1522
|
|
|
1319
1523
|
{config.yAxis.labelPlacement !== 'Below Bar' && <TextField value={config.xAxis.tickRotation} type='number' min='0' section='xAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />}
|
|
1320
1524
|
{config.orientation === 'horizontal' ? (
|
|
@@ -1561,9 +1765,19 @@ const EditorPanel = () => {
|
|
|
1561
1765
|
</>
|
|
1562
1766
|
)}
|
|
1563
1767
|
|
|
1564
|
-
|
|
1768
|
+
{config.visualizationType === 'Box Plot' &&
|
|
1769
|
+
<fieldset fieldset className='fieldset fieldset--boxplot'>
|
|
1770
|
+
<legend className=''>Box Plot Settings</legend>
|
|
1771
|
+
{config.visualizationType === 'Box Plot' && <Select value={config.boxplot.borders} fieldName='borders' section='boxplot' label='Box Plot Borders' updateField={updateField} options={['true', 'false']} />}
|
|
1772
|
+
{config.visualizationType === 'Box Plot' && <CheckBox value={config.boxplot.plotOutlierValues} fieldName='plotOutlierValues' section='boxplot' label='Plot Outliers' updateField={updateField} />}
|
|
1773
|
+
{config.visualizationType === 'Box Plot' && <CheckBox value={config.boxplot.plotNonOutlierValues} fieldName='plotNonOutlierValues' section='boxplot' label='Plot non-outlier values' updateField={updateField} />}
|
|
1774
|
+
{config.visualizationType === 'Box Plot' && <CheckBox value={config.boxplot.legend.displayHowToReadText} fieldName='displayHowToReadText' section='boxplot' subsection='legend' label='Display How To Read Text' updateField={updateField} />}
|
|
1775
|
+
<TextField type='textarea' value={config.boxplot.legend.howToReadText} updateField={updateField} fieldName='howToReadText' section='boxplot' subsection='legend' label='How to read text' />
|
|
1776
|
+
</fieldset>
|
|
1777
|
+
}
|
|
1565
1778
|
|
|
1566
|
-
|
|
1779
|
+
<Select value={config.fontSize} fieldName='fontSize' label='Font Size' updateField={updateField} options={['small', 'medium', 'large']} />
|
|
1780
|
+
{config.visualizationType !== 'Box Plot' && config.series?.some(series => series.type === 'Bar' || series.type === 'Paired Bar') && <Select value={config.barHasBorder} fieldName='barHasBorder' label='Bar Borders' updateField={updateField} options={['true', 'false']} />}
|
|
1567
1781
|
|
|
1568
1782
|
<CheckBox value={config.animate} fieldName='animate' label='Animate Visualization' updateField={updateField} />
|
|
1569
1783
|
|
|
@@ -1685,7 +1899,7 @@ const EditorPanel = () => {
|
|
|
1685
1899
|
)}
|
|
1686
1900
|
{config.orientation === 'horizontal' && !config.isLollipopChart && config.yAxis.labelPlacement !== 'On Bar' && <TextField type='number' value={config.barHeight || '25'} fieldName='barHeight' label=' Bar Thickness' updateField={updateField} min='15' />}
|
|
1687
1901
|
{((config.visualizationType === 'Bar' && config.orientation !== 'horizontal') || config.visualizationType === 'Combo') && <TextField value={config.barThickness} type='number' fieldName='barThickness' label='Bar Thickness' updateField={updateField} />}
|
|
1688
|
-
{config.orientation === 'horizontal' && <TextField type='number' value={config.barSpace || '
|
|
1902
|
+
{(config.orientation === 'horizontal' || config.visualizationType === 'Paired Bar') && <TextField type='number' value={config.barSpace || '15'} fieldName='barSpace' label='Bar Space' updateField={updateField} min='0' />}
|
|
1689
1903
|
{(config.visualizationType === 'Bar' || config.visualizationType === 'Line' || config.visualizationType === 'Combo') && <CheckBox value={config.topAxis.hasLine} section='topAxis' fieldName='hasLine' label='Add Top Axis Line' updateField={updateField} />}
|
|
1690
1904
|
|
|
1691
1905
|
{config.visualizationType === 'Spark Line' && (
|
|
@@ -1762,7 +1976,7 @@ const EditorPanel = () => {
|
|
|
1762
1976
|
{config.type !== 'Spark Line' && <AdvancedEditor loadConfig={updateConfig} state={config} convertStateToConfig={convertStateToConfig} />}
|
|
1763
1977
|
</section>
|
|
1764
1978
|
</section>
|
|
1765
|
-
</ErrorBoundary>
|
|
1979
|
+
</ErrorBoundary >
|
|
1766
1980
|
)
|
|
1767
1981
|
}
|
|
1768
1982
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
1
|
+
import React, { useState, useContext } from 'react'
|
|
2
|
+
import ConfigContext from './../ConfigContext'
|
|
3
3
|
import Button from '@cdc/core/components/elements/Button'
|
|
4
4
|
|
|
5
5
|
const useFilters = () => {
|
|
6
|
-
const { config, setConfig, filteredData, setFilteredData, excludedData, filterData, runtimeFilters } = useContext(
|
|
6
|
+
const { config, setConfig, filteredData, setFilteredData, excludedData, filterData, runtimeFilters } = useContext(ConfigContext)
|
|
7
7
|
const [showApplyButton, setShowApplyButton] = useState(false)
|
|
8
8
|
|
|
9
9
|
const sortAsc = (a, b) => {
|
|
@@ -14,7 +14,7 @@ const useFilters = () => {
|
|
|
14
14
|
return b.toString().localeCompare(a.toString(), 'en', { numeric: true })
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const announceChange = text => {}
|
|
17
|
+
const announceChange = text => { }
|
|
18
18
|
|
|
19
19
|
const changeFilterActive = (index, value) => {
|
|
20
20
|
let newFilters = config.filters
|
|
@@ -48,7 +48,7 @@ const useFilters = () => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const Filters = () => {
|
|
51
|
-
const { config } = useContext(
|
|
51
|
+
const { config } = useContext(ConfigContext)
|
|
52
52
|
const { handleApplyButton, changeFilterActive, announceChange, sortAsc, sortDesc, showApplyButton, handleReset } = useFilters()
|
|
53
53
|
const { filters } = config
|
|
54
54
|
const buttonText = 'Apply Filters'
|
|
@@ -105,13 +105,7 @@ const Filters = () => {
|
|
|
105
105
|
|
|
106
106
|
return (
|
|
107
107
|
<section className={`filters-section`} style={{ display: 'block', width: '100%' }}>
|
|
108
|
-
|
|
109
|
-
<>
|
|
110
|
-
<h3 className='filters-section__title'>Filters</h3>
|
|
111
|
-
<hr />
|
|
112
|
-
</>
|
|
113
|
-
)}
|
|
114
|
-
<div className='filters-section__wrapper' style={{ flexWrap: 'wrap', display: 'flex', gap: '7px 15px' }}>
|
|
108
|
+
<div className='filters-section__wrapper' style={{ flexWrap: 'wrap', display: 'flex', gap: '7px 15px', marginTop: '15px' }}>
|
|
115
109
|
<FilterList />
|
|
116
110
|
{config.filters.length > 0 && (
|
|
117
111
|
<div className='filter-section__buttons' style={{ width: '100%' }}>
|