@cdc/chart 4.24.1 → 4.24.3

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 (82) hide show
  1. package/dist/cdcchart.js +48948 -37923
  2. package/examples/{private/combo.json → chart-regression-1.json} +40 -31
  3. package/examples/chart-regression-2.json +2360 -0
  4. package/examples/feature/filters/url-filter.json +1076 -0
  5. package/examples/feature/line/line-chart-preliminary.json +84 -37
  6. package/examples/feature/line/line-chart.json +2 -1
  7. package/examples/feature/regions/index.json +55 -5
  8. package/examples/feature/sankey/sankey-example-data.json +1364 -0
  9. package/examples/feature/sankey/sankey_chart_data.csv +20 -0
  10. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +306 -19
  11. package/examples/sparkline.json +868 -0
  12. package/index.html +128 -121
  13. package/package.json +4 -2
  14. package/src/CdcChart.tsx +73 -38
  15. package/src/_stories/ChartEditor.stories.tsx +15 -4
  16. package/src/_stories/_mock/pie_config.json +4 -3
  17. package/src/_stories/_mock/url_filter.json +1076 -0
  18. package/src/components/AreaChart/components/AreaChart.Stacked.jsx +2 -1
  19. package/src/components/AreaChart/components/AreaChart.jsx +2 -25
  20. package/src/components/BarChart/components/BarChart.Horizontal.tsx +39 -49
  21. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +36 -56
  22. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +36 -41
  23. package/src/components/BarChart/components/BarChart.Vertical.tsx +48 -64
  24. package/src/components/BoxPlot/BoxPlot.jsx +11 -9
  25. package/src/components/DeviationBar.jsx +3 -3
  26. package/src/components/EditorPanel/EditorPanel.tsx +1717 -1961
  27. package/src/components/EditorPanel/EditorPanelContext.ts +40 -0
  28. package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +148 -0
  29. package/src/components/EditorPanel/components/{Panel.ForestPlotSettings.tsx → Panels/Panel.ForestPlotSettings.tsx} +16 -7
  30. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +160 -0
  31. package/src/components/EditorPanel/components/{Panel.Regions.tsx → Panels/Panel.Regions.tsx} +6 -6
  32. package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +108 -0
  33. package/src/components/EditorPanel/components/{Panel.Series.tsx → Panels/Panel.Series.tsx} +50 -6
  34. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +338 -0
  35. package/src/components/EditorPanel/components/Panels/index.tsx +19 -0
  36. package/src/components/EditorPanel/components/panels.scss +11 -0
  37. package/src/components/EditorPanel/editor-panel.scss +1 -13
  38. package/src/components/EditorPanel/useEditorPermissions.js +44 -13
  39. package/src/components/Legend/Legend.Component.tsx +207 -0
  40. package/src/components/Legend/Legend.tsx +8 -327
  41. package/src/components/Legend/helpers/createFormatLabels.tsx +140 -0
  42. package/src/components/LineChart/LineChartProps.ts +2 -1
  43. package/src/components/LineChart/components/LineChart.Circle.tsx +85 -52
  44. package/src/components/LineChart/helpers.ts +3 -3
  45. package/src/components/LineChart/index.tsx +99 -23
  46. package/src/components/LinearChart.jsx +12 -33
  47. package/src/components/PairedBarChart.jsx +10 -12
  48. package/src/components/PieChart/PieChart.tsx +80 -27
  49. package/src/components/Regions/components/Regions.tsx +120 -69
  50. package/src/components/Sankey/index.tsx +434 -0
  51. package/src/components/Sankey/sankey.scss +153 -0
  52. package/src/components/Sankey/types/index.ts +16 -0
  53. package/src/components/ScatterPlot/ScatterPlot.jsx +1 -0
  54. package/src/components/Sparkline/{SparkLine.jsx → components/SparkLine.tsx} +14 -30
  55. package/src/components/Sparkline/index.scss +3 -0
  56. package/src/components/Sparkline/index.tsx +1 -1
  57. package/src/components/ZoomBrush.tsx +2 -1
  58. package/src/data/initial-state.js +51 -4
  59. package/src/helpers/computeMarginBottom.ts +4 -3
  60. package/src/helpers/tests/computeMarginBottom.test.ts +2 -1
  61. package/src/hooks/useBarChart.js +5 -2
  62. package/src/hooks/useHighlightedBars.js +1 -1
  63. package/src/hooks/useMinMax.ts +3 -3
  64. package/src/hooks/useScales.ts +28 -18
  65. package/src/hooks/useTooltip.tsx +19 -14
  66. package/src/scss/main.scss +8 -96
  67. package/src/types/ChartConfig.ts +47 -20
  68. package/src/types/ChartContext.ts +17 -4
  69. package/src/types/Label.ts +7 -0
  70. package/examples/private/chart-t.json +0 -3740
  71. package/examples/private/epi-data.csv +0 -13
  72. package/examples/private/epi-data.json +0 -62
  73. package/examples/private/epi.json +0 -403
  74. package/examples/private/occupancy.json +0 -109283
  75. package/examples/private/prod-line-config.json +0 -401
  76. package/examples/private/region-data.json +0 -822
  77. package/examples/private/region-testing.json +0 -312
  78. package/examples/private/scaling.json +0 -45325
  79. package/examples/private/testing-data.json +0 -1739
  80. package/examples/private/testing.json +0 -816
  81. package/src/components/EditorPanel/components/Panel.DateHighlighting.tsx +0 -109
  82. package/src/components/EditorPanel/components/Panels.tsx +0 -13
@@ -1,10 +1,9 @@
1
1
  import { useState, useEffect, useCallback, memo, useContext } from 'react'
2
2
  import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'
3
-
3
+ import { isDateScale } from '@cdc/core/helpers/cove/date'
4
4
  import { Accordion, AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
5
5
 
6
6
  // @cdc/core
7
- import { approvedCurveTypes } from '@cdc/core/helpers/lineChartHelpers'
8
7
  import AdvancedEditor from '@cdc/core/components/AdvancedEditor'
9
8
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
10
9
  import Icon from '@cdc/core/components/ui/Icon'
@@ -33,6 +32,7 @@ import { type ChartContext } from '../../types/ChartContext'
33
32
  import './editor-panel.scss'
34
33
  import { Anchor } from '@cdc/core/types/Axis'
35
34
  import DataTableEditor from '@cdc/core/components/EditorPanel/DataTableEditor'
35
+ import EditorPanelContext from './EditorPanelContext'
36
36
 
37
37
  const DataSuppression = memo(({ config, updateConfig, data }: any) => {
38
38
  const getColumnOptions = () => {
@@ -129,7 +129,7 @@ const PreliminaryData = memo(({ config, updateConfig, data }) => {
129
129
 
130
130
  const getStyleOptions = () => {
131
131
  if (config.visualizationType === 'Line' || config.visualizationType === 'Combo') {
132
- return ['Open Circles']
132
+ return ['Dashed Small', 'Dashed Medium', 'Dashed Large', 'Open Circles']
133
133
  }
134
134
  if (config.visualizationType === 'Bar') {
135
135
  return ['star']
@@ -182,7 +182,7 @@ const PreliminaryData = memo(({ config, updateConfig, data }) => {
182
182
  Remove
183
183
  </button>
184
184
  <Select value={type} initial='Select' fieldName='type' label='Type' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} options={getTypeOptions()} />
185
- <Select value={seriesKey} initial='Select' fieldName='seriesKey' label='ASSOCIATE TO SERIES' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} options={config.runtime?.seriesKeys} />
185
+ <Select value={seriesKey} initial='Select' fieldName='seriesKey' label='ASSOCIATE TO SERIES' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} options={config.runtime.lineSeriesKeys ?? config.runtime?.seriesKeys} />
186
186
  <Select value={column} initial='Select' fieldName='column' label='COLUMN WITH CONFIGURATION VALUE' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} options={getColumnOptions()} />
187
187
  <TextField value={value} fieldName='value' label='VALUE TO TRIGGER' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} />
188
188
  <Select value={style} initial='Select' fieldName='style' label='Style' updateField={(section, subsection, fieldName, value) => update(fieldName, value, i)} options={getStyleOptions()} />
@@ -193,14 +193,34 @@ const PreliminaryData = memo(({ config, updateConfig, data }) => {
193
193
  })}
194
194
 
195
195
  <button type='button' onClick={addColumn} className='btn full-width'>
196
- {config.visualizationType === 'Line' ? 'Add Special Line' : config.visualizationType === 'Bar' ? ' Add Special Bar' : 'Add Special Line/Bar'}
196
+ {config.visualizationType === 'Line' || config.visualizationType === 'Combo' ? 'Add Special Line' : config.visualizationType === 'Bar' ? ' Add Special Bar' : 'Add Special Line/Bar'}
197
197
  </button>
198
198
  </>
199
199
  )
200
200
  })
201
201
 
202
202
  const EditorPanel = () => {
203
- const { config, updateConfig, transformedData: data, loading, colorPalettes, twoColorPalette, unfilteredData, excludedData, isDashboard, setParentConfig, missingRequiredSections, isDebug, setFilteredData, lineOptions, rawData } = useContext<ChartContext>(ConfigContext)
203
+ const {
204
+ config,
205
+ updateConfig,
206
+ tableData,
207
+ transformedData: data,
208
+ loading,
209
+ colorScale,
210
+ colorPalettes,
211
+ twoColorPalette,
212
+ unfilteredData,
213
+ excludedData,
214
+ isDashboard,
215
+ setParentConfig,
216
+ missingRequiredSections,
217
+ isDebug,
218
+ setFilteredData,
219
+ lineOptions,
220
+ rawData,
221
+ highlight,
222
+ highlightReset
223
+ } = useContext<ChartContext>(ConfigContext)
204
224
 
205
225
  const { minValue, maxValue, existPositiveValue, isAllLine } = useReduceData(config, unfilteredData)
206
226
 
@@ -210,7 +230,6 @@ const EditorPanel = () => {
210
230
  const { leftMax, rightMax } = useMinMax(properties)
211
231
 
212
232
  const {
213
- enabledChartTypes,
214
233
  headerColors,
215
234
  visSupportsTooltipLines,
216
235
  visSupportsNonSequentialPallete,
@@ -221,8 +240,10 @@ const EditorPanel = () => {
221
240
  visHasAnchors,
222
241
  visHasBarBorders,
223
242
  visHasDataCutoff,
243
+ visHasSelectableLegendValues,
224
244
  visCanAnimate,
225
245
  visHasLegend,
246
+ visHasLegendAxisAlign,
226
247
  visHasBrushChart,
227
248
  visSupportsDateCategoryAxis,
228
249
  visSupportsValueAxisMin,
@@ -232,8 +253,10 @@ const EditorPanel = () => {
232
253
  visSupportsDateCategoryAxisTicks,
233
254
  visSupportsDateCategoryTickRotation,
234
255
  visSupportsDateCategoryNumTicks,
256
+ visSupportsDateCategoryAxisPadding,
235
257
  visSupportsRegions,
236
258
  visSupportsFilters,
259
+ visSupportsPreliminaryData,
237
260
  visSupportsValueAxisGridLines,
238
261
  visSupportsValueAxisLine,
239
262
  visSupportsValueAxisTicks,
@@ -329,6 +352,9 @@ const EditorPanel = () => {
329
352
  if (updatedConfig.visualizationType === 'Combo') {
330
353
  updatedConfig.orientation = 'vertical'
331
354
  }
355
+ if (isDateScale(updatedConfig.xAxis) && !updatedConfig.xAxis.padding) {
356
+ updatedConfig.xAxis.padding = 6
357
+ }
332
358
  }
333
359
 
334
360
  const updateField = (section, subsection, fieldName, newValue) => {
@@ -589,14 +615,6 @@ const EditorPanel = () => {
589
615
  return unique ? [...new Set(values)] : values
590
616
  }
591
617
 
592
- const showBarStyleOptions = () => {
593
- if ((config.visualizationType === 'Bar' || config.visualizationType === 'Deviation Bar') && config.visualizationSubType !== 'stacked' && (config.orientation === 'horizontal' || config.orientation === 'vertical')) {
594
- return ['flat', 'rounded', 'lollipop']
595
- } else {
596
- return ['flat', 'rounded']
597
- }
598
- }
599
-
600
618
  const onBackClick = () => {
601
619
  setDisplayPanel(!displayPanel)
602
620
  }
@@ -849,7 +867,7 @@ const EditorPanel = () => {
849
867
  if (isDebug) console.log('### COVE DEBUG: Chart: Setting default datacol=', setdatacol) // eslint-disable-line
850
868
  }
851
869
 
852
- const chartsWithOptions = ['Area Chart', 'Combo', 'Line', 'Bar', 'Forecasting']
870
+ const chartsWithOptions = ['Area Chart', 'Combo', 'Line', 'Bar', 'Forecasting', 'Scatter Plot', 'Paired Bar', 'Deviation Bar']
853
871
 
854
872
  const columnsOptions = [
855
873
  <option value='' key={'Select Option'}>
@@ -1009,416 +1027,177 @@ const EditorPanel = () => {
1009
1027
  })
1010
1028
  }
1011
1029
 
1030
+ const colorCodeByCategory = config.visualizationType === 'Bar' && config.visualizationSubType === 'regular' && config.runtime.seriesKeys.length === 1
1031
+ const getLegendColumns = () => {
1032
+ const colorCodeData = data.map(d => d[config.legend.colorCode])
1033
+ return colorCodeByCategory ? colorCodeData : getColumns(false).filter(d => d !== config.xAxis.dataKey)
1034
+ }
1035
+
1036
+ const updateSeriesIsolateValues = updatedValues => {
1037
+ updateConfig({ ...config, legend: { ...config.legend, seriesHighlight: updatedValues } })
1038
+ }
1039
+
1040
+ const updateBehavior = (section, fieldName, newValue) => {
1041
+ const sectionValue = { ...config[section], [fieldName]: newValue }
1042
+ const updatedConfig = { ...config, [section]: sectionValue }
1043
+
1044
+ if (newValue === 'highlight' && config.legend.seriesHighlight?.length) {
1045
+ updatedConfig.legend.seriesHighlight.length = 0
1046
+ }
1047
+
1048
+ updateConfig(updatedConfig)
1049
+ }
1050
+
1051
+ const editorContextValues = {
1052
+ addNewExclusion,
1053
+ data,
1054
+ editColumn,
1055
+ getColumns,
1056
+ getDataValueOptions,
1057
+ getDataValues,
1058
+ getItemStyle,
1059
+ handleSeriesChange,
1060
+ handleAddNewHighlightedBar,
1061
+ setCategoryAxis,
1062
+ sortSeries,
1063
+ updateField,
1064
+ warningMsg,
1065
+ highlightedBarValues,
1066
+ handleHighlightedBarLegendLabel,
1067
+ handleUpdateHighlightedBar,
1068
+ handleRemoveHighlightedBar,
1069
+ isPaletteReversed: config.isPaletteReversed,
1070
+ highlightedSeriesValues,
1071
+ handleUpdateHighlightedBorderWidth,
1072
+ handleUpdateHighlightedBarColor,
1073
+ setLollipopShape
1074
+ }
1075
+
1012
1076
  return (
1013
- <ErrorBoundary component='EditorPanel'>
1014
- {config.newViz && <Confirm />}
1015
- {undefined === config.newViz && config.runtime && config.runtime.editorErrorMessage && <Error />}
1016
- <button className={displayPanel ? `editor-toggle` : `editor-toggle collapsed`} title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick}></button>
1017
- <section className={`${displayPanel ? 'editor-panel cove' : 'hidden editor-panel cove'}${isDashboard ? ' dashboard' : ''}`}>
1018
- <div aria-level={2} role='heading' className='heading-2'>
1019
- Configure Chart
1020
- </div>
1021
- <section className='form-container'>
1022
- <Accordion allowZeroExpanded={true}>
1023
- <AccordionItem>
1024
- {' '}
1025
- {/* General */}
1026
- <AccordionItemHeading>
1027
- <AccordionItemButton>General</AccordionItemButton>
1028
- </AccordionItemHeading>
1029
- <AccordionItemPanel>
1030
- <Select value={config.visualizationType} fieldName='visualizationType' label='Chart Type' updateField={updateField} options={enabledChartTypes} />
1031
- {(config.visualizationType === 'Bar' || config.visualizationType === 'Combo' || config.visualizationType === 'Area Chart') && (
1032
- <Select value={config.visualizationSubType || 'Regular'} fieldName='visualizationSubType' label='Chart Subtype' updateField={updateField} options={['regular', 'stacked']} />
1033
- )}
1034
- {config.visualizationType === 'Area Chart' && config.visualizationSubType === 'stacked' && (
1035
- <Select value={config.stackedAreaChartLineType || 'Linear'} fieldName='stackedAreaChartLineType' label='Stacked Area Chart Line Type' updateField={updateField} options={Object.keys(approvedCurveTypes)} />
1036
- )}
1037
- {config.visualizationType === 'Bar' && <Select value={config.orientation || 'vertical'} fieldName='orientation' label='Orientation' updateField={updateField} options={['vertical', 'horizontal']} />}
1038
- {config.visualizationType === 'Deviation Bar' && <Select label='Orientation' options={['horizontal']} />}
1039
- {(config.visualizationType === 'Bar' || config.visualizationType === 'Deviation Bar') && <Select value={config.isLollipopChart ? 'lollipop' : config.barStyle || 'flat'} fieldName='barStyle' label='bar style' updateField={updateField} options={showBarStyleOptions()} />}
1040
- {(config.visualizationType === 'Bar' || config.visualizationType === 'Deviation Bar') && config.barStyle === 'rounded' && <Select value={config.tipRounding || 'top'} fieldName='tipRounding' label='tip rounding' updateField={updateField} options={['top', 'full']} />}
1041
- {(config.visualizationType === 'Bar' || config.visualizationType === 'Deviation Bar') && config.barStyle === 'rounded' && (
1042
- <Select value={config.roundingStyle || 'standard'} fieldName='roundingStyle' label='rounding style' updateField={updateField} options={['standard', 'shallow', 'finger']} />
1043
- )}
1044
- {config.visualizationType === 'Bar' && config.orientation === 'horizontal' && <Select value={config.yAxis.labelPlacement || 'Below Bar'} section='yAxis' fieldName='labelPlacement' label='Label Placement' updateField={updateField} options={['Below Bar', 'On Date/Category Axis']} />}
1045
- {visHasNumbersOnBars() ? (
1046
- <CheckBox value={config.yAxis.displayNumbersOnBar} section='yAxis' fieldName='displayNumbersOnBar' label={config.isLollipopChart ? 'Display Numbers after Bar' : 'Display Numbers on Bar'} updateField={updateField} />
1047
- ) : (
1048
- visHasLabelOnData() && <CheckBox value={config.labels} fieldName='labels' label='Display label on data' updateField={updateField} />
1049
- )}
1050
- {config.visualizationType === 'Pie' && <Select fieldName='pieType' label='Pie Chart Type' updateField={updateField} options={['Regular', 'Donut']} />}
1051
-
1052
- <TextField
1053
- value={config.title || 'Chart Title'}
1054
- fieldName='title'
1055
- id='title'
1056
- label='Title'
1057
- placeholder='Chart Title'
1058
- //defaultValue='Chart Title'
1059
- updateField={updateField}
1060
- //onChange={handleTitleChange}
1061
- tooltip={
1062
- <Tooltip style={{ textTransform: 'none' }}>
1063
- <Tooltip.Target>
1064
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1065
- </Tooltip.Target>
1066
- <Tooltip.Content>
1067
- <p>Title is required to set the name of the download file but can be hidden using the option below.</p>
1068
- </Tooltip.Content>
1069
- </Tooltip>
1070
- }
1071
- />
1072
- <CheckBox value={config.showTitle} fieldName='showTitle' label='Show Title' updateField={updateField} />
1073
-
1074
- {visSupportsSuperTitle() && (
1075
- <TextField
1076
- value={config.superTitle}
1077
- updateField={updateField}
1078
- fieldName='superTitle'
1079
- label='Super Title'
1080
- placeholder='Super Title'
1081
- tooltip={
1082
- <Tooltip style={{ textTransform: 'none' }}>
1083
- <Tooltip.Target>
1084
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1085
- </Tooltip.Target>
1086
- <Tooltip.Content>
1087
- <p>Super Title</p>
1088
- </Tooltip.Content>
1089
- </Tooltip>
1090
- }
1091
- />
1092
- )}
1093
-
1094
- <TextField
1095
- type='textarea'
1096
- value={config.introText}
1097
- updateField={updateField}
1098
- fieldName='introText'
1099
- label='Message'
1100
- tooltip={
1101
- <Tooltip style={{ textTransform: 'none' }}>
1102
- <Tooltip.Target>
1103
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1104
- </Tooltip.Target>
1105
- <Tooltip.Content>
1106
- <p>Intro Text</p>
1107
- </Tooltip.Content>
1108
- </Tooltip>
1109
- }
1110
- />
1111
-
1112
- <TextField
1113
- type='textarea'
1114
- value={config.description}
1115
- fieldName='description'
1116
- label='Subtext/Citation'
1117
- updateField={updateField}
1118
- tooltip={
1119
- <Tooltip style={{ textTransform: 'none' }}>
1120
- <Tooltip.Target>
1121
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1122
- </Tooltip.Target>
1123
- <Tooltip.Content>
1124
- <p>Enter supporting text to display below the data visualization, if applicable. The following HTML tags are supported: strong, em, sup, and sub.</p>
1125
- </Tooltip.Content>
1126
- </Tooltip>
1127
- }
1128
- />
1129
-
1130
- {visSupportsFootnotes() && (
1131
- <TextField
1132
- type='textarea'
1133
- value={config.footnotes}
1134
- updateField={updateField}
1135
- fieldName='footnotes'
1136
- label='Footnotes'
1137
- tooltip={
1138
- <Tooltip style={{ textTransform: 'none' }}>
1139
- <Tooltip.Target>
1140
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1141
- </Tooltip.Target>
1142
- <Tooltip.Content>
1143
- <p>Footnotes</p>
1144
- </Tooltip.Content>
1145
- </Tooltip>
1146
- }
1147
- />
1148
- )}
1149
-
1150
- {visSupportsChartHeight() && config.orientation === 'vertical' && <TextField type='number' value={config.heights.vertical} section='heights' fieldName='vertical' label='Chart Height' updateField={updateField} />}
1151
- </AccordionItemPanel>
1152
- </AccordionItem>
1153
- {config.visualizationType === 'Forest Plot' && <Panels.ForestPlot name='Forest Plot Settings' editColumn={editColumn} setCategoryAxis={setCategoryAxis} />}
1154
- {config.visualizationType !== 'Pie' && config.visualizationType !== 'Forest Plot' && (
1155
- <AccordionItem>
1156
- <AccordionItemHeading>
1157
- <AccordionItemButton>Data Series {(!config.series || config.series.length === 0 || (config.visualizationType === 'Paired Bar' && config.series.length < 2)) && <WarningImage width='25' className='warning-icon' />}</AccordionItemButton>
1158
- </AccordionItemHeading>
1159
- <AccordionItemPanel>
1160
- {(!config.series || config.series.length === 0) && config.visualizationType !== 'Paired Bar' && <p className='warning'>At least one series is required</p>}
1161
- {(!config.series || config.series.length === 0 || config.series.length < 2) && config.visualizationType === 'Paired Bar' && <p className='warning'>Select two data series for paired bar chart (e.g., Male and Female).</p>}
1162
- <>
1163
- <Select
1164
- fieldName='visualizationType'
1165
- label='Add Data Series'
1166
- initial='Select'
1167
- onChange={e => {
1168
- if (e.target.value !== '' && e.target.value !== 'Select') {
1169
- addNewSeries(e.target.value)
1170
- }
1171
- e.target.value = ''
1172
- }}
1173
- options={getColumns()}
1174
- />
1175
- {config.series && config.series.length !== 0 && (
1176
- <Panels.Series.Wrapper getColumns={getColumns}>
1177
- <fieldset>
1178
- <legend className='edit-label float-left'>Displaying</legend>
1179
- <Tooltip style={{ textTransform: 'none' }}>
1180
- <Tooltip.Target>
1181
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1182
- </Tooltip.Target>
1183
- <Tooltip.Content>
1184
- <p>A data series is a set of related data points plotted in a chart and typically represented in the chart legend.</p>
1185
- </Tooltip.Content>
1186
- </Tooltip>
1187
- </fieldset>
1188
-
1189
- <DragDropContext onDragEnd={({ source, destination }) => handleSeriesChange(source.index, destination.index)}>
1190
- <Droppable droppableId='filter_order'>
1191
- {/* prettier-ignore */}
1192
- {provided => {
1193
- return (
1194
- <ul {...provided.droppableProps} className='series-list' ref={provided.innerRef}>
1195
- <Panels.Series.List series={config.series} getItemStyle={getItemStyle} sortableItemStyles={sortableItemStyles} chartsWithOptions={chartsWithOptions} />
1196
- {provided.placeholder}
1197
- </ul>
1198
- )
1199
- }}
1200
- </Droppable>
1201
- </DragDropContext>
1202
- </Panels.Series.Wrapper>
1203
- )}
1204
- </>
1205
- {config.series && config.series.length <= 1 && config.visualizationType === 'Bar' && (
1206
- <>
1207
- <span className='divider-heading'>Confidence Keys</span>
1208
- <Select value={config.confidenceKeys.upper || ''} section='confidenceKeys' fieldName='upper' label='Upper' updateField={updateField} initial='Select' options={getColumns()} />
1209
- <Select value={config.confidenceKeys.lower || ''} section='confidenceKeys' fieldName='lower' label='Lower' updateField={updateField} initial='Select' options={getColumns()} />
1210
- </>
1211
- )}
1212
- {visSupportsRankByValue() && config.series && config.series.length === 1 && <Select fieldName='visualizationType' label='Rank by Value' initial='Select' onChange={e => sortSeries(e.target.value)} options={['asc', 'desc']} />}
1213
- {/* {visHasDataSuppression() && <DataSuppression config={config} updateConfig={updateConfig} data={data} />} */}
1214
- {config.visualizationType === 'Line' && <PreliminaryData config={config} updateConfig={updateConfig} data={data} />}
1215
- </AccordionItemPanel>
1216
- </AccordionItem>
1217
- )}
1218
- {config.visualizationType === 'Box Plot' && (
1219
- <AccordionItem>
1220
- <AccordionItemHeading>
1221
- <AccordionItemButton>Measures</AccordionItemButton>
1222
- </AccordionItemHeading>
1223
- <AccordionItemPanel>
1224
- <h4 style={{ fontSize: '18px' }}>Labels for 5-Number Summary</h4>
1225
-
1226
- {/* prettier-ignore */}
1227
- {/* max */}
1228
- <TextField
1229
- type='text'
1230
- value={config.boxplot.labels.maximum}
1231
- fieldName='maximum'
1232
- section='boxplot'
1233
- subsection='labels'
1234
- label='Maximum'
1235
- updateField={updateField}
1236
- tooltip={
1237
- <Tooltip style={{ textTransform: 'none' }}>
1238
- <Tooltip.Target>
1239
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1240
- </Tooltip.Target>
1241
- <Tooltip.Content>
1242
- <p>Highest value, excluding outliers</p>
1243
- </Tooltip.Content>
1244
- </Tooltip>
1245
- }
1246
- />
1247
-
1248
- {/* prettier-ignore */}
1249
- {/* Q3 */}
1250
- <TextField
1251
- type='text'
1252
- value={config.boxplot.labels.q3}
1253
- fieldName='q3'
1254
- section='boxplot'
1255
- subsection='labels'
1256
- label='Upper Quartile'
1257
- updateField={updateField}
1258
- tooltip={
1259
- <Tooltip style={{ textTransform: 'none' }}>
1260
- <Tooltip.Target>
1261
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1262
- </Tooltip.Target>
1263
- <Tooltip.Content>
1264
- <p>Represented by top line of box. 25% of data are higher.</p>
1265
- </Tooltip.Content>
1266
- </Tooltip>
1267
- }
1268
- />
1269
-
1270
- {/* prettier-ignore */}
1271
- {/* median */}
1272
- <TextField
1273
- type='text'
1274
- value={config.boxplot.labels.median}
1275
- fieldName='median'
1276
- section='boxplot'
1277
- subsection='labels'
1278
- label='Median'
1279
- updateField={updateField}
1280
- tooltip={
1281
- <Tooltip style={{ textTransform: 'none' }}>
1282
- <Tooltip.Target>
1283
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1284
- </Tooltip.Target>
1285
- <Tooltip.Content>
1286
- <p>Middle data point. Half of data are higher value.</p>
1287
- </Tooltip.Content>
1288
- </Tooltip>
1289
- }
1290
- />
1291
-
1292
- {/* prettier-ignore */}
1293
- {/* q1 */}
1294
- <TextField
1295
- type='text'
1296
- value={config.boxplot.labels.q1}
1297
- fieldName='q1'
1298
- section='boxplot'
1299
- subsection='labels'
1300
- label='Lower Quartile'
1301
- updateField={updateField}
1302
- tooltip={
1303
- <Tooltip style={{ textTransform: 'none' }}>
1304
- <Tooltip.Target>
1305
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1306
- </Tooltip.Target>
1307
- <Tooltip.Content>
1308
- <p>Represented by bottom line of box. 25% of data are lower.</p>
1309
- </Tooltip.Content>
1310
- </Tooltip>
1311
- }
1312
- />
1313
-
1314
- {/* prettier-ignore */}
1315
- {/* minimum */}
1316
- <TextField
1317
- type='text'
1318
- value={config.boxplot.labels.minimum}
1319
- fieldName='minimum'
1320
- section='boxplot'
1321
- subsection='labels'
1322
- label='Minimum'
1323
- updateField={updateField}
1324
- tooltip={
1325
- <Tooltip style={{ textTransform: 'none' }}>
1326
- <Tooltip.Target>
1327
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1328
- </Tooltip.Target>
1329
- <Tooltip.Content>
1330
- <p>Lowest value, excluding outliers</p>
1331
- </Tooltip.Content>
1332
- </Tooltip>
1333
- }
1334
- />
1335
- <br />
1336
- <h4 style={{ fontSize: '18px' }}>Labels for Additional Measures</h4>
1337
-
1338
- {/* iqr */}
1339
- <TextField type='text' value={config.boxplot.labels.iqr} fieldName='iqr' section='boxplot' subsection='labels' label='Interquartile Range' updateField={updateField} />
1340
-
1341
- {/* count */}
1342
- <TextField type='text' value={config.boxplot.labels.total} fieldName='total' section='boxplot' subsection='labels' label='Total' updateField={updateField} />
1343
-
1344
- {/* mean */}
1345
- <TextField type='text' value={config.boxplot.labels.mean} fieldName='mean' section='boxplot' subsection='labels' label='Mean' updateField={updateField} />
1346
- {/* outliers */}
1347
- <TextField type='text' value={config.boxplot.labels.outliers} fieldName='outliers' section='boxplot' subsection='labels' label='Outliers' updateField={updateField} />
1348
- {/* values */}
1349
- <TextField type='text' value={config.boxplot.labels.values} fieldName='values' section='boxplot' subsection='labels' label='Values' updateField={updateField} />
1350
- </AccordionItemPanel>
1351
- </AccordionItem>
1352
- )}
1353
- {/* Left Value Axis */}
1354
- {visSupportsLeftValueAxis() && (
1355
- <AccordionItem>
1356
- <AccordionItemHeading>
1357
- <AccordionItemButton>
1358
- {config.visualizationType === 'Pie' ? 'Data Format' : config.orientation === 'vertical' ? 'Left Value Axis' : 'Value Axis'}
1359
- {config.visualizationType === 'Pie' && !config.yAxis.dataKey && <WarningImage width='25' className='warning-icon' />}
1360
- </AccordionItemButton>
1361
- </AccordionItemHeading>
1362
- <AccordionItemPanel>
1363
- {config.visualizationType === 'Pie' && (
1364
- <Select
1365
- value={config.yAxis.dataKey || ''}
1366
- section='yAxis'
1367
- fieldName='dataKey'
1368
- label='Data Column'
1369
- initial='Select'
1370
- required={true}
1371
- updateField={updateField}
1372
- options={getColumns(false)}
1373
- tooltip={
1374
- <Tooltip style={{ textTransform: 'none' }}>
1375
- <Tooltip.Target>
1376
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1377
- </Tooltip.Target>
1378
- <Tooltip.Content>
1379
- <p>Select the source data to be visually represented.</p>
1380
- </Tooltip.Content>
1381
- </Tooltip>
1382
- }
1383
- />
1384
- )}
1385
- {config.visualizationType !== 'Pie' && (
1077
+ <EditorPanelContext.Provider value={editorContextValues}>
1078
+ <ErrorBoundary component='EditorPanel'>
1079
+ {config.newViz && <Confirm />}
1080
+ {undefined === config.newViz && config.runtime && config.runtime?.editorErrorMessage && <Error />}
1081
+ <button className={displayPanel ? `editor-toggle` : `editor-toggle collapsed`} title={displayPanel ? `Collapse Editor` : `Expand Editor`} onClick={onBackClick}></button>
1082
+ <section className={`${displayPanel ? 'editor-panel cove' : 'hidden editor-panel cove'}${isDashboard ? ' dashboard' : ''}`}>
1083
+ <div aria-level={2} role='heading' className='heading-2'>
1084
+ Configure Chart
1085
+ </div>
1086
+ <section className='form-container'>
1087
+ <Accordion allowZeroExpanded={true}>
1088
+ <Panels.General name='General' />
1089
+ <Panels.ForestPlot name='Forest Plot Settings' />
1090
+ <Panels.Sankey name='Sankey' />
1091
+ {config.visualizationType !== 'Pie' && config.visualizationType !== 'Forest Plot' && config.visualizationType !== 'Sankey' && (
1092
+ <AccordionItem>
1093
+ <AccordionItemHeading>
1094
+ <AccordionItemButton>Data Series {(!config.series || config.series.length === 0 || (config.visualizationType === 'Paired Bar' && config.series.length < 2)) && <WarningImage width='25' className='warning-icon' />}</AccordionItemButton>
1095
+ </AccordionItemHeading>
1096
+ <AccordionItemPanel>
1097
+ {(!config.series || config.series.length === 0) && config.visualizationType !== 'Paired Bar' && <p className='warning'>At least one series is required</p>}
1098
+ {(!config.series || config.series.length === 0 || config.series.length < 2) && config.visualizationType === 'Paired Bar' && <p className='warning'>Select two data series for paired bar chart (e.g., Male and Female).</p>}
1386
1099
  <>
1387
- <TextField value={config.yAxis.label} section='yAxis' fieldName='label' label='Label' updateField={updateField} />
1388
- {config.runtime.seriesKeys && config.runtime.seriesKeys.length === 1 && !['Box Plot', 'Deviation Bar', 'Forest Plot'].includes(config.visualizationType) && (
1389
- <CheckBox value={config.isLegendValue} fieldName='isLegendValue' label='Use Legend Value in Hover' updateField={updateField} />
1100
+ <Select
1101
+ fieldName='visualizationType'
1102
+ label='Add Data Series'
1103
+ initial='Select'
1104
+ onChange={e => {
1105
+ if (e.target.value !== '' && e.target.value !== 'Select') {
1106
+ addNewSeries(e.target.value)
1107
+ }
1108
+ e.target.value = ''
1109
+ }}
1110
+ options={getColumns()}
1111
+ />
1112
+ {config.series && config.series.length !== 0 && (
1113
+ <Panels.Series.Wrapper getColumns={getColumns}>
1114
+ <fieldset>
1115
+ <legend className='edit-label float-left'>Displaying</legend>
1116
+ <Tooltip style={{ textTransform: 'none' }}>
1117
+ <Tooltip.Target>
1118
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1119
+ </Tooltip.Target>
1120
+ <Tooltip.Content>
1121
+ <p>A data series is a set of related data points plotted in a chart and typically represented in the chart legend.</p>
1122
+ </Tooltip.Content>
1123
+ </Tooltip>
1124
+ </fieldset>
1125
+
1126
+ <DragDropContext onDragEnd={({ source, destination }) => handleSeriesChange(source.index, destination.index)}>
1127
+ <Droppable droppableId='filter_order'>
1128
+ {/* prettier-ignore */}
1129
+ {provided => {
1130
+ return (
1131
+ <ul {...provided.droppableProps} className='series-list' ref={provided.innerRef}>
1132
+ <Panels.Series.List series={config.series} getItemStyle={getItemStyle} sortableItemStyles={sortableItemStyles} chartsWithOptions={chartsWithOptions} />
1133
+ {provided.placeholder}
1134
+ </ul>
1135
+ )
1136
+ }}
1137
+ </Droppable>
1138
+ </DragDropContext>
1139
+ </Panels.Series.Wrapper>
1390
1140
  )}
1391
- <TextField value={config.yAxis.numTicks} placeholder='Auto' type='number' section='yAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
1392
- {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} />}
1393
- <TextField
1394
- value={config.yAxis.size}
1395
- type='number'
1141
+ </>
1142
+ {config.series && config.series.length <= 1 && config.visualizationType === 'Bar' && (
1143
+ <>
1144
+ <span className='divider-heading'>Confidence Keys</span>
1145
+ <Select value={config.confidenceKeys.upper || ''} section='confidenceKeys' fieldName='upper' label='Upper' updateField={updateField} initial='Select' options={getColumns()} />
1146
+ <Select value={config.confidenceKeys.lower || ''} section='confidenceKeys' fieldName='lower' label='Lower' updateField={updateField} initial='Select' options={getColumns()} />
1147
+ </>
1148
+ )}
1149
+ {visSupportsRankByValue() && config.series && config.series.length === 1 && <Select fieldName='visualizationType' label='Rank by Value' initial='Select' onChange={e => sortSeries(e.target.value)} options={['asc', 'desc']} />}
1150
+ {/* {visHasDataSuppression() && <DataSuppression config={config} updateConfig={updateConfig} data={data} />} */}
1151
+ {visSupportsPreliminaryData() && <PreliminaryData config={config} updateConfig={updateConfig} data={data} />}
1152
+ </AccordionItemPanel>
1153
+ </AccordionItem>
1154
+ )}
1155
+ <Panels.BoxPlot name='Measures' />
1156
+ {/* Left Value Axis */}
1157
+ {visSupportsLeftValueAxis() && (
1158
+ <AccordionItem>
1159
+ <AccordionItemHeading>
1160
+ <AccordionItemButton>
1161
+ {config.visualizationType === 'Pie' ? 'Data Format' : config.orientation === 'vertical' ? 'Left Value Axis' : 'Value Axis'}
1162
+ {config.visualizationType === 'Pie' && !config.yAxis.dataKey && <WarningImage width='25' className='warning-icon' />}
1163
+ </AccordionItemButton>
1164
+ </AccordionItemHeading>
1165
+ <AccordionItemPanel>
1166
+ {config.visualizationType === 'Pie' && (
1167
+ <Select
1168
+ value={config.yAxis.dataKey || ''}
1396
1169
  section='yAxis'
1397
- fieldName='size'
1398
- label={config.orientation === 'horizontal' ? 'Size (Height)' : 'Size (Width)'}
1399
- className='number-narrow'
1170
+ fieldName='dataKey'
1171
+ label='Data Column'
1172
+ initial='Select'
1173
+ required={true}
1400
1174
  updateField={updateField}
1175
+ options={getColumns(false)}
1401
1176
  tooltip={
1402
1177
  <Tooltip style={{ textTransform: 'none' }}>
1403
1178
  <Tooltip.Target>
1404
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1179
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1405
1180
  </Tooltip.Target>
1406
1181
  <Tooltip.Content>
1407
- <p>{`Increase the size if elements in the ${config.orientation} axis are being crowded or hidden behind other elements. Decrease if less space is required for the value axis.`}</p>
1182
+ <p>Select the source data to be visually represented.</p>
1408
1183
  </Tooltip.Content>
1409
1184
  </Tooltip>
1410
1185
  }
1411
1186
  />
1412
- {config.orientation === 'horizontal' && config.visualizationType !== 'Paired Bar' && <CheckBox value={config.isResponsiveTicks} fieldName='isResponsiveTicks' label='Use Responsive Ticks' updateField={updateField} />}
1413
- {(config.orientation === 'vertical' || !config.isResponsiveTicks) && <TextField value={config.yAxis.tickRotation} type='number' min={0} section='yAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />}
1414
- {config.isResponsiveTicks && config.orientation === 'horizontal' && config.visualizationType !== 'Paired Bar' && (
1187
+ )}
1188
+ {config.visualizationType !== 'Pie' && (
1189
+ <>
1190
+ <TextField value={config.yAxis.label} section='yAxis' fieldName='label' label='Label ' updateField={updateField} />
1191
+ {config.runtime.seriesKeys && config.runtime.seriesKeys.length === 1 && !['Box Plot', 'Deviation Bar', 'Forest Plot'].includes(config.visualizationType) && (
1192
+ <CheckBox value={config.isLegendValue} fieldName='isLegendValue' label='Use Legend Value in Hover' updateField={updateField} />
1193
+ )}
1194
+ <TextField value={config.yAxis.numTicks} placeholder='Auto' type='number' section='yAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
1415
1195
  <TextField
1416
- value={config.xAxis.maxTickRotation}
1196
+ value={config.yAxis.size}
1417
1197
  type='number'
1418
- min={0}
1419
- section='xAxis'
1420
- fieldName='maxTickRotation'
1421
- label='Max Tick Rotation'
1198
+ section='yAxis'
1199
+ fieldName='size'
1200
+ label={config.orientation === 'horizontal' ? 'Size (Height)' : 'Size (Width)'}
1422
1201
  className='number-narrow'
1423
1202
  updateField={updateField}
1424
1203
  tooltip={
@@ -1427,1257 +1206,1417 @@ const EditorPanel = () => {
1427
1206
  <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1428
1207
  </Tooltip.Target>
1429
1208
  <Tooltip.Content>
1430
- <p>Degrees ticks will be rotated if values overlap, especially in smaller viewports.</p>
1209
+ <p>{`Increase the size if elements in the ${config.orientation} axis are being crowded or hidden behind other elements. Decrease if less space is required for the value axis.`}</p>
1431
1210
  </Tooltip.Content>
1432
1211
  </Tooltip>
1433
1212
  }
1434
1213
  />
1435
- )}
1436
-
1437
- {/* Hiding this for now, not interested in moving the axis lines away from chart comp. right now. */}
1438
- {/* <TextField value={config.yAxis.axisPadding} type='number' max={10} min={0} section='yAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} /> */}
1439
- {config.orientation === 'horizontal' && <TextField value={config.xAxis.labelOffset} section='xAxis' fieldName='labelOffset' label='Label offset' type='number' className='number-narrow' updateField={updateField} />}
1440
- {visSupportsValueAxisGridLines() && <CheckBox value={config.yAxis.gridLines} section='yAxis' fieldName='gridLines' label='Show Gridlines' updateField={updateField} />}
1441
- <CheckBox value={config.yAxis.enablePadding} section='yAxis' fieldName='enablePadding' label='Add Padding to Value Axis Scale' updateField={updateField} />
1442
- {config.visualizationSubType === 'regular' && config.visualizationType !== 'Forest Plot' && <CheckBox value={config.useLogScale} fieldName='useLogScale' label='use logarithmic scale' updateField={updateField} />}
1443
- </>
1444
- )}
1445
- <span className='divider-heading'>Number Formatting</span>
1446
- <CheckBox value={config.dataFormat.commas} section='dataFormat' fieldName='commas' label='Add commas' updateField={updateField} />
1447
- <CheckBox
1448
- value={config.dataFormat.abbreviated}
1449
- section='dataFormat'
1450
- fieldName='abbreviated'
1451
- label='Abbreviate Axis Values'
1452
- updateField={updateField}
1453
- tooltip={
1454
- <Tooltip style={{ textTransform: 'none' }}>
1455
- <Tooltip.Target>
1456
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1457
- </Tooltip.Target>
1458
- <Tooltip.Content>
1459
- <p>{`This option abbreviates very large or very small numbers on the value axis`}</p>
1460
- </Tooltip.Content>
1461
- </Tooltip>
1462
- }
1463
- />
1464
- <TextField value={config.dataFormat.roundTo ? config.dataFormat.roundTo : 0} type='number' section='dataFormat' fieldName='roundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
1465
- <div className='two-col-inputs'>
1466
- <TextField
1467
- value={config.dataFormat.prefix}
1468
- section='dataFormat'
1469
- fieldName='prefix'
1470
- label='Prefix'
1471
- updateField={updateField}
1472
- tooltip={
1473
- <Tooltip style={{ textTransform: 'none' }}>
1474
- <Tooltip.Target>
1475
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1476
- </Tooltip.Target>
1477
- <Tooltip.Content>
1478
- {config.visualizationType === 'Pie' && <p>Enter a data prefix to display in the data table and chart tooltips, if applicable.</p>}
1479
- {config.visualizationType !== 'Pie' && <p>Enter a data prefix (such as "$"), if applicable.</p>}
1480
- </Tooltip.Content>
1481
- </Tooltip>
1482
- }
1483
- />
1484
- <TextField
1485
- value={config.dataFormat.suffix}
1214
+ {config.orientation === 'horizontal' && config.visualizationType !== 'Paired Bar' && <CheckBox value={config.isResponsiveTicks} fieldName='isResponsiveTicks' label='Use Responsive Ticks' updateField={updateField} />}
1215
+ {(config.orientation === 'vertical' || !config.isResponsiveTicks) && <TextField value={config.yAxis.tickRotation || 0} type='number' min={0} section='yAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />}
1216
+ {config.isResponsiveTicks && config.orientation === 'horizontal' && config.visualizationType !== 'Paired Bar' && (
1217
+ <TextField
1218
+ value={config.xAxis.maxTickRotation}
1219
+ type='number'
1220
+ min={0}
1221
+ section='xAxis'
1222
+ fieldName='maxTickRotation'
1223
+ label='Max Tick Rotation'
1224
+ className='number-narrow'
1225
+ updateField={updateField}
1226
+ tooltip={
1227
+ <Tooltip style={{ textTransform: 'none' }}>
1228
+ <Tooltip.Target>
1229
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1230
+ </Tooltip.Target>
1231
+ <Tooltip.Content>
1232
+ <p>Degrees ticks will be rotated if values overlap, especially in smaller viewports.</p>
1233
+ </Tooltip.Content>
1234
+ </Tooltip>
1235
+ }
1236
+ />
1237
+ )}
1238
+
1239
+ {/* Hiding this for now, not interested in moving the axis lines away from chart comp. right now. */}
1240
+ {/* <TextField value={config.yAxis.axisPadding} type='number' max={10} min={0} section='yAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} /> */}
1241
+ {config.orientation === 'horizontal' && <TextField value={config.xAxis.labelOffset} section='xAxis' fieldName='labelOffset' label='Label offset' type='number' className='number-narrow' updateField={updateField} />}
1242
+ {visSupportsValueAxisGridLines() && <CheckBox value={config.yAxis.gridLines} section='yAxis' fieldName='gridLines' label='Show Gridlines' updateField={updateField} />}
1243
+ <CheckBox value={config.yAxis.enablePadding} section='yAxis' fieldName='enablePadding' label='Add Padding to Value Axis Scale' updateField={updateField} />
1244
+ {config.yAxis.enablePadding && <TextField type='number' section='yAxis' fieldName='scalePadding' label='Padding Percentage' className='number-narrow' updateField={updateField} value={config.yAxis.scalePadding} />}
1245
+ {config.visualizationSubType === 'regular' && config.visualizationType !== 'Forest Plot' && <CheckBox value={config.useLogScale} fieldName='useLogScale' label='use logarithmic scale' updateField={updateField} />}
1246
+ </>
1247
+ )}
1248
+ <span className='divider-heading'>Number Formatting</span>
1249
+ <CheckBox value={config.dataFormat.commas} section='dataFormat' fieldName='commas' label='Add commas' updateField={updateField} />
1250
+ <CheckBox
1251
+ value={config.dataFormat.abbreviated}
1486
1252
  section='dataFormat'
1487
- fieldName='suffix'
1488
- label='Suffix'
1253
+ fieldName='abbreviated'
1254
+ label='Abbreviate Axis Values'
1489
1255
  updateField={updateField}
1490
1256
  tooltip={
1491
1257
  <Tooltip style={{ textTransform: 'none' }}>
1492
1258
  <Tooltip.Target>
1493
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1259
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1494
1260
  </Tooltip.Target>
1495
1261
  <Tooltip.Content>
1496
- {config.visualizationType === 'Pie' && <p>Enter a data suffix to display in the data table and tooltips, if applicable.</p>}
1497
- {config.visualizationType !== 'Pie' && <p>Enter a data suffix (such as "%"), if applicable.</p>}
1262
+ <p>{`This option abbreviates very large or very small numbers on the value axis`}</p>
1498
1263
  </Tooltip.Content>
1499
1264
  </Tooltip>
1500
1265
  }
1501
1266
  />
1502
- </div>
1267
+ <TextField value={config.dataFormat.roundTo ? config.dataFormat.roundTo : 0} type='number' section='dataFormat' fieldName='roundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
1268
+ <div className='two-col-inputs'>
1269
+ <TextField
1270
+ value={config.dataFormat.prefix}
1271
+ section='dataFormat'
1272
+ fieldName='prefix'
1273
+ label='Prefix'
1274
+ updateField={updateField}
1275
+ tooltip={
1276
+ <Tooltip style={{ textTransform: 'none' }}>
1277
+ <Tooltip.Target>
1278
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1279
+ </Tooltip.Target>
1280
+ <Tooltip.Content>
1281
+ {config.visualizationType === 'Pie' && <p>Enter a data prefix to display in the data table and chart tooltips, if applicable.</p>}
1282
+ {config.visualizationType !== 'Pie' && <p>Enter a data prefix (such as "$"), if applicable.</p>}
1283
+ </Tooltip.Content>
1284
+ </Tooltip>
1285
+ }
1286
+ />
1287
+ <TextField
1288
+ value={config.dataFormat.suffix}
1289
+ section='dataFormat'
1290
+ fieldName='suffix'
1291
+ label='Suffix'
1292
+ updateField={updateField}
1293
+ tooltip={
1294
+ <Tooltip style={{ textTransform: 'none' }}>
1295
+ <Tooltip.Target>
1296
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1297
+ </Tooltip.Target>
1298
+ <Tooltip.Content>
1299
+ {config.visualizationType === 'Pie' && <p>Enter a data suffix to display in the data table and tooltips, if applicable.</p>}
1300
+ {config.visualizationType !== 'Pie' && <p>Enter a data suffix (such as "%"), if applicable.</p>}
1301
+ </Tooltip.Content>
1302
+ </Tooltip>
1303
+ }
1304
+ />
1305
+ </div>
1503
1306
 
1504
- {config.orientation === 'horizontal' ? ( // horizontal - x is vertical y is horizontal
1505
- <>
1506
- {visSupportsValueAxisLine() && <CheckBox value={config.xAxis.hideAxis} section='xAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
1507
- {visSupportsValueAxisLabels() && <CheckBox value={config.xAxis.hideLabel} section='xAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
1508
- {visSupportsValueAxisTicks() && <CheckBox value={config.xAxis.hideTicks} section='xAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />}
1509
- {visSupportsValueAxisMax() && <TextField value={config.xAxis.max} section='xAxis' fieldName='max' label='max value' type='number' placeholder='Auto' updateField={updateField} />}
1510
- <span style={{ color: 'red', display: 'block' }}>{warningMsg.maxMsg}</span>
1511
- {visSupportsValueAxisMin() && <TextField value={config.xAxis.min} section='xAxis' fieldName='min' type='number' label='min value' placeholder='Auto' updateField={updateField} />}
1512
- <span style={{ color: 'red', display: 'block' }}>{warningMsg.minMsg}</span>
1513
- {config.visualizationType === 'Deviation Bar' && (
1514
- <>
1515
- <TextField value={config.xAxis.target} section='xAxis' fieldName='target' type='number' label='Deviation point' placeholder='Auto' updateField={updateField} />
1516
- <TextField value={config.xAxis.targetLabel || 'Target'} section='xAxis' fieldName='targetLabel' type='text' label='Deviation point Label' updateField={updateField} />
1517
- <CheckBox value={config.xAxis.showTargetLabel} section='xAxis' fieldName='showTargetLabel' label='Show Deviation point label' updateField={updateField} />
1518
- </>
1519
- )}
1520
- </>
1521
- ) : (
1522
- config.visualizationType !== 'Pie' && (
1307
+ {config.orientation === 'horizontal' ? ( // horizontal - x is vertical y is horizontal
1523
1308
  <>
1524
- <CheckBox value={config.yAxis.hideAxis} section='yAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />
1525
- <CheckBox value={config.yAxis.hideLabel} section='yAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />
1526
- <CheckBox value={config.yAxis.hideTicks} section='yAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />
1527
-
1528
- <TextField value={config.yAxis.max} section='yAxis' fieldName='max' type='number' label='left axis max value' placeholder='Auto' updateField={updateField} />
1309
+ {visSupportsValueAxisLine() && <CheckBox value={config.xAxis.hideAxis} section='xAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
1310
+ {visSupportsValueAxisLabels() && <CheckBox value={config.xAxis.hideLabel} section='xAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
1311
+ {visSupportsValueAxisTicks() && <CheckBox value={config.xAxis.hideTicks} section='xAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />}
1312
+ {visSupportsValueAxisMax() && <TextField value={config.xAxis.max} section='xAxis' fieldName='max' label='max value' type='number' placeholder='Auto' updateField={updateField} />}
1529
1313
  <span style={{ color: 'red', display: 'block' }}>{warningMsg.maxMsg}</span>
1530
- <TextField value={config.yAxis.min} section='yAxis' fieldName='min' type='number' label='left axis min value' placeholder='Auto' updateField={updateField} />
1314
+ {visSupportsValueAxisMin() && <TextField value={config.xAxis.min} section='xAxis' fieldName='min' type='number' label='min value' placeholder='Auto' updateField={updateField} />}
1531
1315
  <span style={{ color: 'red', display: 'block' }}>{warningMsg.minMsg}</span>
1316
+ {config.visualizationType === 'Deviation Bar' && (
1317
+ <>
1318
+ <TextField value={config.xAxis.target} section='xAxis' fieldName='target' type='number' label='Deviation point' placeholder='Auto' updateField={updateField} />
1319
+ <TextField value={config.xAxis.targetLabel || 'Target'} section='xAxis' fieldName='targetLabel' type='text' label='Deviation point Label' updateField={updateField} />
1320
+ <CheckBox value={config.xAxis.showTargetLabel} section='xAxis' fieldName='showTargetLabel' label='Show Deviation point label' updateField={updateField} />
1321
+ </>
1322
+ )}
1532
1323
  </>
1533
- )
1534
- )}
1535
-
1536
- {/* start: anchors */}
1537
- {visHasAnchors() && config.orientation !== 'horizontal' && (
1538
- <div className='edit-block'>
1539
- <span className='edit-label column-heading'>Anchors</span>
1540
- <Accordion allowZeroExpanded>
1541
- {config.yAxis?.anchors?.map((anchor, index) => (
1542
- <AccordionItem className='series-item series-item--chart' key={`yaxis-anchors-2-${index}`}>
1543
- <AccordionItemHeading className='series-item__title'>
1544
- <>
1545
- <AccordionItemButton className={'accordion__button accordion__button'}>
1546
- Anchor {index + 1}
1547
- <button
1548
- className='series-list__remove'
1549
- onClick={e => {
1324
+ ) : (
1325
+ config.visualizationType !== 'Pie' && (
1326
+ <>
1327
+ <CheckBox value={config.yAxis.hideAxis} section='yAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />
1328
+ <CheckBox value={config.yAxis.hideLabel} section='yAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />
1329
+ <CheckBox value={config.yAxis.hideTicks} section='yAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />
1330
+
1331
+ <TextField value={config.yAxis.max} section='yAxis' fieldName='max' type='number' label='left axis max value' placeholder='Auto' updateField={updateField} />
1332
+ <span style={{ color: 'red', display: 'block' }}>{warningMsg.maxMsg}</span>
1333
+ <TextField value={config.yAxis.min} section='yAxis' fieldName='min' type='number' label='left axis min value' placeholder='Auto' updateField={updateField} />
1334
+ <span style={{ color: 'red', display: 'block' }}>{warningMsg.minMsg}</span>
1335
+ </>
1336
+ )
1337
+ )}
1338
+
1339
+ {/* start: anchors */}
1340
+ {visHasAnchors() && config.orientation !== 'horizontal' && (
1341
+ <div className='edit-block'>
1342
+ <span className='edit-label column-heading'>Anchors</span>
1343
+ <Accordion allowZeroExpanded>
1344
+ {config.yAxis?.anchors?.map((anchor, index) => (
1345
+ <AccordionItem className='series-item series-item--chart' key={`yaxis-anchors-2-${index}`}>
1346
+ <AccordionItemHeading className='series-item__title'>
1347
+ <>
1348
+ <AccordionItemButton className={'accordion__button accordion__button'}>
1349
+ Anchor {index + 1}
1350
+ <button
1351
+ className='series-list__remove'
1352
+ onClick={e => {
1353
+ e.preventDefault()
1354
+ const copiedAnchorGroups = [...config.yAxis.anchors]
1355
+ copiedAnchorGroups.splice(index, 1)
1356
+ updateConfig({
1357
+ ...config,
1358
+ yAxis: {
1359
+ ...config.yAxis,
1360
+ anchors: copiedAnchorGroups
1361
+ }
1362
+ })
1363
+ }}
1364
+ >
1365
+ Remove
1366
+ </button>
1367
+ </AccordionItemButton>
1368
+ </>
1369
+ </AccordionItemHeading>
1370
+ <AccordionItemPanel>
1371
+ <label>
1372
+ <span>Anchor Value</span>
1373
+ <Tooltip style={{ textTransform: 'none' }}>
1374
+ <Tooltip.Target>
1375
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1376
+ </Tooltip.Target>
1377
+ <Tooltip.Content>
1378
+ <p>Enter the value as its shown in the data column</p>
1379
+ </Tooltip.Content>
1380
+ </Tooltip>
1381
+ <input
1382
+ type='text'
1383
+ value={config.yAxis.anchors[index].value ? config.yAxis.anchors[index].value : ''}
1384
+ onChange={e => {
1550
1385
  e.preventDefault()
1551
- const copiedAnchorGroups = [...config.yAxis.anchors]
1552
- copiedAnchorGroups.splice(index, 1)
1386
+ const copiedAnchors = [...config.yAxis.anchors]
1387
+ copiedAnchors[index].value = e.target.value
1553
1388
  updateConfig({
1554
1389
  ...config,
1555
1390
  yAxis: {
1556
1391
  ...config.yAxis,
1557
- anchors: copiedAnchorGroups
1392
+ anchors: copiedAnchors
1558
1393
  }
1559
1394
  })
1560
1395
  }}
1561
- >
1562
- Remove
1563
- </button>
1564
- </AccordionItemButton>
1565
- </>
1566
- </AccordionItemHeading>
1567
- <AccordionItemPanel>
1568
- <label>
1569
- <span>Anchor Value</span>
1570
- <Tooltip style={{ textTransform: 'none' }}>
1571
- <Tooltip.Target>
1572
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1573
- </Tooltip.Target>
1574
- <Tooltip.Content>
1575
- <p>Enter the value as its shown in the data column</p>
1576
- </Tooltip.Content>
1577
- </Tooltip>
1578
- <input
1579
- type='text'
1580
- value={config.yAxis.anchors[index].value ? config.yAxis.anchors[index].value : ''}
1581
- onChange={e => {
1582
- e.preventDefault()
1583
- const copiedAnchors = [...config.yAxis.anchors]
1584
- copiedAnchors[index].value = e.target.value
1585
- updateConfig({
1586
- ...config,
1587
- yAxis: {
1588
- ...config.yAxis,
1589
- anchors: copiedAnchors
1590
- }
1591
- })
1592
- }}
1593
- />
1594
- </label>
1396
+ />
1397
+ </label>
1595
1398
 
1596
- <label>
1597
- <span>Anchor Color</span>
1598
- <input
1599
- type='text'
1600
- value={config.yAxis.anchors[index].color ? config.yAxis.anchors[index].color : ''}
1601
- onChange={e => {
1602
- e.preventDefault()
1603
- const copiedAnchors = [...config.yAxis.anchors]
1604
- copiedAnchors[index].color = e.target.value
1605
- updateConfig({
1606
- ...config,
1607
- yAxis: {
1608
- ...config.yAxis,
1609
- anchors: copiedAnchors
1610
- }
1611
- })
1612
- }}
1613
- />
1614
- </label>
1399
+ <label>
1400
+ <span>Anchor Color</span>
1401
+ <input
1402
+ type='text'
1403
+ value={config.yAxis.anchors[index].color ? config.yAxis.anchors[index].color : ''}
1404
+ onChange={e => {
1405
+ e.preventDefault()
1406
+ const copiedAnchors = [...config.yAxis.anchors]
1407
+ copiedAnchors[index].color = e.target.value
1408
+ updateConfig({
1409
+ ...config,
1410
+ yAxis: {
1411
+ ...config.yAxis,
1412
+ anchors: copiedAnchors
1413
+ }
1414
+ })
1415
+ }}
1416
+ />
1417
+ </label>
1615
1418
 
1616
- <label>
1617
- Anchor Line Style
1618
- <select
1619
- value={config.yAxis.anchors[index].lineStyle || ''}
1620
- onChange={e => {
1621
- const copiedAnchors = [...config.yAxis.anchors]
1622
- copiedAnchors[index].lineStyle = e.target.value
1623
- updateConfig({
1624
- ...config,
1625
- yAxis: {
1626
- ...config.yAxis,
1627
- anchors: copiedAnchors
1628
- }
1629
- })
1630
- }}
1631
- >
1632
- <option>Select</option>
1633
- {lineOptions.map(line => (
1634
- <option key={line.key}>{line.value}</option>
1635
- ))}
1636
- </select>
1637
- </label>
1638
- </AccordionItemPanel>
1639
- </AccordionItem>
1640
- ))}
1641
- </Accordion>
1642
-
1643
- <button
1644
- className='btn full-width'
1645
- onClick={e => {
1646
- e.preventDefault()
1647
- const anchors = [...config.yAxis.anchors]
1648
- anchors.push({} as Anchor)
1649
- updateConfig({
1650
- ...config,
1651
- yAxis: {
1652
- ...config.yAxis,
1653
- anchors
1654
- }
1655
- })
1656
- }}
1657
- >
1658
- Add Anchor
1659
- </button>
1660
- </div>
1661
- )}
1662
-
1663
- {visHasAnchors() && config.orientation === 'horizontal' && (
1664
- <div className='edit-block'>
1665
- <span className='edit-label column-heading'>Anchors</span>
1666
- <Accordion allowZeroExpanded>
1667
- {config.xAxis?.anchors?.map((anchor, index) => (
1668
- <AccordionItem className='series-item series-item--chart' key={`xaxis-anchors-${index}`}>
1669
- <AccordionItemHeading className='series-item__title'>
1670
- <>
1671
- <AccordionItemButton className={'accordion__button accordion__button'}>
1672
- Anchor {index + 1}
1673
- <button
1674
- className='series-list__remove'
1675
- onClick={e => {
1419
+ <label>
1420
+ Anchor Line Style
1421
+ <select
1422
+ value={config.yAxis.anchors[index].lineStyle || ''}
1423
+ onChange={e => {
1424
+ const copiedAnchors = [...config.yAxis.anchors]
1425
+ copiedAnchors[index].lineStyle = e.target.value
1426
+ updateConfig({
1427
+ ...config,
1428
+ yAxis: {
1429
+ ...config.yAxis,
1430
+ anchors: copiedAnchors
1431
+ }
1432
+ })
1433
+ }}
1434
+ >
1435
+ <option>Select</option>
1436
+ {lineOptions.map(line => (
1437
+ <option key={line.key}>{line.value}</option>
1438
+ ))}
1439
+ </select>
1440
+ </label>
1441
+ </AccordionItemPanel>
1442
+ </AccordionItem>
1443
+ ))}
1444
+ </Accordion>
1445
+
1446
+ <button
1447
+ className='btn full-width'
1448
+ onClick={e => {
1449
+ e.preventDefault()
1450
+ const anchors = [...config.yAxis.anchors]
1451
+ anchors.push({} as Anchor)
1452
+ updateConfig({
1453
+ ...config,
1454
+ yAxis: {
1455
+ ...config.yAxis,
1456
+ anchors
1457
+ }
1458
+ })
1459
+ }}
1460
+ >
1461
+ Add Anchor
1462
+ </button>
1463
+ </div>
1464
+ )}
1465
+
1466
+ {visHasAnchors() && config.orientation === 'horizontal' && (
1467
+ <div className='edit-block'>
1468
+ <span className='edit-label column-heading'>Anchors</span>
1469
+ <Accordion allowZeroExpanded>
1470
+ {config.xAxis?.anchors?.map((anchor, index) => (
1471
+ <AccordionItem className='series-item series-item--chart' key={`xaxis-anchors-${index}`}>
1472
+ <AccordionItemHeading className='series-item__title'>
1473
+ <>
1474
+ <AccordionItemButton className={'accordion__button accordion__button'}>
1475
+ Anchor {index + 1}
1476
+ <button
1477
+ className='series-list__remove'
1478
+ onClick={e => {
1479
+ e.preventDefault()
1480
+ const copiedAnchorGroups = [...config.xAxis.anchors]
1481
+ copiedAnchorGroups.splice(index, 1)
1482
+ updateConfig({
1483
+ ...config,
1484
+ xAxis: {
1485
+ ...config.xAxis,
1486
+ anchors: copiedAnchorGroups
1487
+ }
1488
+ })
1489
+ }}
1490
+ >
1491
+ Remove
1492
+ </button>
1493
+ </AccordionItemButton>
1494
+ </>
1495
+ </AccordionItemHeading>
1496
+ <AccordionItemPanel>
1497
+ <label>
1498
+ <span>Anchor Value</span>
1499
+ <Tooltip style={{ textTransform: 'none' }}>
1500
+ <Tooltip.Target>
1501
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1502
+ </Tooltip.Target>
1503
+ <Tooltip.Content>
1504
+ <p>Enter the value as its shown in the data column</p>
1505
+ </Tooltip.Content>
1506
+ </Tooltip>
1507
+ <input
1508
+ type='text'
1509
+ value={config.xAxis.anchors[index].value ? config.xAxis.anchors[index].value : ''}
1510
+ onChange={e => {
1676
1511
  e.preventDefault()
1677
- const copiedAnchorGroups = [...config.xAxis.anchors]
1678
- copiedAnchorGroups.splice(index, 1)
1512
+ const copiedAnchors = [...config.xAxis.anchors]
1513
+ copiedAnchors[index].value = e.target.value
1679
1514
  updateConfig({
1680
1515
  ...config,
1681
1516
  xAxis: {
1682
1517
  ...config.xAxis,
1683
- anchors: copiedAnchorGroups
1518
+ anchors: copiedAnchors
1684
1519
  }
1685
1520
  })
1686
1521
  }}
1687
- >
1688
- Remove
1689
- </button>
1690
- </AccordionItemButton>
1691
- </>
1692
- </AccordionItemHeading>
1693
- <AccordionItemPanel>
1694
- <label>
1695
- <span>Anchor Value</span>
1696
- <Tooltip style={{ textTransform: 'none' }}>
1697
- <Tooltip.Target>
1698
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1699
- </Tooltip.Target>
1700
- <Tooltip.Content>
1701
- <p>Enter the value as its shown in the data column</p>
1702
- </Tooltip.Content>
1703
- </Tooltip>
1704
- <input
1705
- type='text'
1706
- value={config.xAxis.anchors[index].value ? config.xAxis.anchors[index].value : ''}
1707
- onChange={e => {
1708
- e.preventDefault()
1709
- const copiedAnchors = [...config.xAxis.anchors]
1710
- copiedAnchors[index].value = e.target.value
1711
- updateConfig({
1712
- ...config,
1713
- xAxis: {
1714
- ...config.xAxis,
1715
- anchors: copiedAnchors
1716
- }
1717
- })
1718
- }}
1719
- />
1720
- </label>
1522
+ />
1523
+ </label>
1721
1524
 
1722
- <label>
1723
- <span>Anchor Color</span>
1724
- <input
1725
- type='text'
1726
- value={config.xAxis.anchors[index].color ? config.xAxis.anchors[index].color : ''}
1727
- onChange={e => {
1728
- e.preventDefault()
1729
- const copiedAnchors = [...config.xAxis.anchors]
1730
- copiedAnchors[index].color = e.target.value
1731
- updateConfig({
1732
- ...config,
1733
- xAxis: {
1734
- ...config.xAxis,
1735
- anchors: copiedAnchors
1736
- }
1737
- })
1738
- }}
1739
- />
1740
- </label>
1525
+ <label>
1526
+ <span>Anchor Color</span>
1527
+ <input
1528
+ type='text'
1529
+ value={config.xAxis.anchors[index].color ? config.xAxis.anchors[index].color : ''}
1530
+ onChange={e => {
1531
+ e.preventDefault()
1532
+ const copiedAnchors = [...config.xAxis.anchors]
1533
+ copiedAnchors[index].color = e.target.value
1534
+ updateConfig({
1535
+ ...config,
1536
+ xAxis: {
1537
+ ...config.xAxis,
1538
+ anchors: copiedAnchors
1539
+ }
1540
+ })
1541
+ }}
1542
+ />
1543
+ </label>
1741
1544
 
1742
- <label>
1743
- Anchor Line Style
1744
- <select
1745
- value={config.xAxis.anchors[index].lineStyle || ''}
1746
- onChange={e => {
1747
- const copiedAnchors = [...config.xAxis.anchors]
1748
- copiedAnchors[index].lineStyle = e.target.value
1749
- updateConfig({
1750
- ...config,
1751
- xAxis: {
1752
- ...config.xAxis,
1753
- anchors: copiedAnchors
1754
- }
1755
- })
1756
- }}
1757
- >
1758
- <option>Select</option>
1759
- {lineOptions.map(line => (
1760
- <option key={line.key}>{line.value}</option>
1761
- ))}
1762
- </select>
1763
- </label>
1764
- </AccordionItemPanel>
1765
- </AccordionItem>
1766
- ))}
1767
- </Accordion>
1768
-
1769
- <button
1770
- className='btn full-width'
1771
- onClick={e => {
1772
- e.preventDefault()
1773
- const anchors = [...config.xAxis.anchors]
1774
- anchors.push({} as Anchor)
1775
- updateConfig({
1776
- ...config,
1777
- xAxis: {
1778
- ...config.xAxis,
1779
- anchors
1780
- }
1781
- })
1782
- }}
1783
- >
1784
- Add Anchor
1785
- </button>
1786
- </div>
1787
- )}
1788
- {/* end: anchors */}
1789
- </AccordionItemPanel>
1790
- </AccordionItem>
1791
- )}
1792
- {/* Right Value Axis Settings */}
1793
- {hasRightAxis && (
1794
- <AccordionItem>
1795
- <AccordionItemHeading>
1796
- <AccordionItemButton>Right Value Axis</AccordionItemButton>
1797
- </AccordionItemHeading>
1798
- <AccordionItemPanel>
1799
- <TextField value={config.yAxis.rightLabel} section='yAxis' fieldName='rightLabel' label='Label' updateField={updateField} />
1800
- <TextField value={config.yAxis.rightNumTicks} placeholder='Auto' type='number' section='yAxis' fieldName='rightNumTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
1801
- <TextField value={config.yAxis.rightAxisSize} type='number' section='yAxis' fieldName='rightAxisSize' label='Size (Width)' className='number-narrow' updateField={updateField} />
1802
- <TextField value={config.yAxis.rightLabelOffsetSize} type='number' section='yAxis' fieldName='rightLabelOffsetSize' label='Label Offset' className='number-narrow' updateField={updateField} />
1803
-
1804
- <span className='divider-heading'>Number Formatting</span>
1805
- <CheckBox value={config.dataFormat.rightCommas} section='dataFormat' fieldName='rightCommas' label='Add commas' updateField={updateField} />
1806
- <TextField value={config.dataFormat.rightRoundTo} type='number' section='dataFormat' fieldName='rightRoundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
1807
- <div className='two-col-inputs'>
1808
- <TextField
1809
- value={config.dataFormat.rightPrefix}
1810
- section='dataFormat'
1811
- fieldName='rightPrefix'
1812
- label='Prefix'
1813
- updateField={updateField}
1814
- tooltip={
1815
- <Tooltip style={{ textTransform: 'none' }}>
1816
- <Tooltip.Target>
1817
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1818
- </Tooltip.Target>
1819
- <Tooltip.Content>
1820
- {config.visualizationType === 'Pie' && <p>Enter a data prefix to display in the data table and chart tooltips, if applicable.</p>}
1821
- {config.visualizationType !== 'Pie' && <p>Enter a data prefix (such as "$"), if applicable.</p>}
1822
- </Tooltip.Content>
1823
- </Tooltip>
1824
- }
1825
- />
1826
- <TextField
1827
- value={config.dataFormat.rightSuffix}
1828
- section='dataFormat'
1829
- fieldName='rightSuffix'
1830
- label='Suffix'
1831
- updateField={updateField}
1832
- tooltip={
1833
- <Tooltip style={{ textTransform: 'none' }}>
1834
- <Tooltip.Target>
1835
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1836
- </Tooltip.Target>
1837
- <Tooltip.Content>
1838
- {config.visualizationType === 'Pie' && <p>Enter a data suffix to display in the data table and tooltips, if applicable.</p>}
1839
- {config.visualizationType !== 'Pie' && <p>Enter a data suffix (such as "%"), if applicable.</p>}
1840
- </Tooltip.Content>
1841
- </Tooltip>
1842
- }
1843
- />
1844
- </div>
1845
-
1846
- <CheckBox value={config.yAxis.rightHideAxis} section='yAxis' fieldName='rightHideAxis' label='Hide Axis' updateField={updateField} />
1847
- <CheckBox value={config.yAxis.rightHideLabel} section='yAxis' fieldName='rightHideLabel' label='Hide Label' updateField={updateField} />
1848
- <CheckBox value={config.yAxis.rightHideTicks} section='yAxis' fieldName='rightHideTicks' label='Hide Ticks' updateField={updateField} />
1849
-
1850
- <TextField value={config.yAxis.max} section='yAxis' fieldName='rightMax' type='number' label='right axis max value' placeholder='Auto' updateField={updateField} />
1851
- <span style={{ color: 'red', display: 'block' }}>{warningMsg.rightMaxMessage}</span>
1852
- <TextField value={config.yAxis.min} section='yAxis' fieldName='rightMin' type='number' label='right axis min value' placeholder='Auto' updateField={updateField} />
1853
- <span style={{ color: 'red', display: 'block' }}>{warningMsg.minMsg}</span>
1854
- </AccordionItemPanel>
1855
- </AccordionItem>
1856
- )}
1857
- {visSupportsDateCategoryAxis() && (
1858
- <AccordionItem>
1859
- <AccordionItemHeading>
1860
- <AccordionItemButton>
1861
- {config.visualizationType === 'Pie' ? 'Segments' : 'Date/Category Axis'}
1862
- {!config.xAxis.dataKey && <WarningImage width='25' className='warning-icon' />}
1863
- </AccordionItemButton>
1864
- </AccordionItemHeading>
1865
- <AccordionItemPanel>
1866
- {config.visualizationType !== 'Pie' && (
1867
- <>
1868
- {config.visualizationType !== 'Forest Plot' && (
1869
- <>
1870
- <Select value={config.xAxis.type} section='xAxis' fieldName='type' label='Data Type' updateField={updateField} options={config.visualizationType !== 'Scatter Plot' ? ['categorical', 'date'] : ['categorical', 'continuous', 'date']} />
1871
- <CheckBox value={config.xAxis.sortDates} section='xAxis' fieldName='sortDates' label='Force Date Scale (Sort Dates)' updateField={updateField} />{' '}
1872
- </>
1873
- )}
1874
- <Select
1875
- value={config.xAxis.dataKey || setCategoryAxis() || ''}
1876
- section='xAxis'
1877
- fieldName='dataKey'
1878
- label='Data Key'
1879
- initial='Select'
1880
- required={true}
1545
+ <label>
1546
+ Anchor Line Style
1547
+ <select
1548
+ value={config.xAxis.anchors[index].lineStyle || ''}
1549
+ onChange={e => {
1550
+ const copiedAnchors = [...config.xAxis.anchors]
1551
+ copiedAnchors[index].lineStyle = e.target.value
1552
+ updateConfig({
1553
+ ...config,
1554
+ xAxis: {
1555
+ ...config.xAxis,
1556
+ anchors: copiedAnchors
1557
+ }
1558
+ })
1559
+ }}
1560
+ >
1561
+ <option>Select</option>
1562
+ {lineOptions.map(line => (
1563
+ <option key={line.key}>{line.value}</option>
1564
+ ))}
1565
+ </select>
1566
+ </label>
1567
+ </AccordionItemPanel>
1568
+ </AccordionItem>
1569
+ ))}
1570
+ </Accordion>
1571
+
1572
+ <button
1573
+ className='btn full-width'
1574
+ onClick={e => {
1575
+ e.preventDefault()
1576
+ const anchors = [...config.xAxis.anchors]
1577
+ anchors.push({} as Anchor)
1578
+ updateConfig({
1579
+ ...config,
1580
+ xAxis: {
1581
+ ...config.xAxis,
1582
+ anchors
1583
+ }
1584
+ })
1585
+ }}
1586
+ >
1587
+ Add Anchor
1588
+ </button>
1589
+ </div>
1590
+ )}
1591
+ {/* end: anchors */}
1592
+ </AccordionItemPanel>
1593
+ </AccordionItem>
1594
+ )}
1595
+ {/* Right Value Axis Settings */}
1596
+ {hasRightAxis && (
1597
+ <AccordionItem>
1598
+ <AccordionItemHeading>
1599
+ <AccordionItemButton>Right Value Axis</AccordionItemButton>
1600
+ </AccordionItemHeading>
1601
+ <AccordionItemPanel>
1602
+ <TextField value={config.yAxis.rightLabel} section='yAxis' fieldName='rightLabel' label='Label' updateField={updateField} />
1603
+ <TextField value={config.yAxis.rightNumTicks} placeholder='Auto' type='number' section='yAxis' fieldName='rightNumTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />
1604
+ <TextField value={config.yAxis.rightAxisSize} type='number' section='yAxis' fieldName='rightAxisSize' label='Size (Width)' className='number-narrow' updateField={updateField} />
1605
+ <TextField value={config.yAxis.rightLabelOffsetSize} type='number' section='yAxis' fieldName='rightLabelOffsetSize' label='Label Offset' className='number-narrow' updateField={updateField} />
1606
+
1607
+ <span className='divider-heading'>Number Formatting</span>
1608
+ <CheckBox value={config.dataFormat.rightCommas} section='dataFormat' fieldName='rightCommas' label='Add commas' updateField={updateField} />
1609
+ <TextField value={config.dataFormat.rightRoundTo} type='number' section='dataFormat' fieldName='rightRoundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
1610
+ <div className='two-col-inputs'>
1611
+ <TextField
1612
+ value={config.dataFormat.rightPrefix}
1613
+ section='dataFormat'
1614
+ fieldName='rightPrefix'
1615
+ label='Prefix'
1881
1616
  updateField={updateField}
1882
- options={getColumns(false)}
1883
1617
  tooltip={
1884
1618
  <Tooltip style={{ textTransform: 'none' }}>
1885
1619
  <Tooltip.Target>
1886
1620
  <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1887
1621
  </Tooltip.Target>
1888
1622
  <Tooltip.Content>
1889
- <p>Select the column or row containing the categories or dates for this axis. </p>
1623
+ {config.visualizationType === 'Pie' && <p>Enter a data prefix to display in the data table and chart tooltips, if applicable.</p>}
1624
+ {config.visualizationType !== 'Pie' && <p>Enter a data prefix (such as "$"), if applicable.</p>}
1890
1625
  </Tooltip.Content>
1891
1626
  </Tooltip>
1892
1627
  }
1893
1628
  />
1894
- </>
1895
- )}
1896
-
1897
- {config.visualizationType === 'Pie' && (
1898
- <Select
1899
- value={config.xAxis.dataKey || ''}
1900
- section='xAxis'
1901
- fieldName='dataKey'
1902
- label='Segment Labels'
1903
- initial='Select'
1904
- required={true}
1905
- updateField={updateField}
1906
- options={getColumns(false)}
1907
- tooltip={
1908
- <Tooltip style={{ textTransform: 'none' }}>
1909
- <Tooltip.Target>
1910
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1911
- </Tooltip.Target>
1912
- <Tooltip.Content>
1913
- <p>Select the source row or column that contains the segment labels. Depending on the data structure, it may be listed as "Key."</p>
1914
- </Tooltip.Content>
1915
- </Tooltip>
1916
- }
1917
- />
1918
- )}
1919
-
1920
- {config.visualizationType !== 'Pie' && (
1921
- <>
1922
- <TextField value={config.xAxis.label} section='xAxis' fieldName='label' label='Label' updateField={updateField} />
1923
-
1924
- {config.xAxis.type === 'continuous' && (
1925
- <>
1926
- <TextField
1927
- value={config.dataFormat.bottomPrefix}
1928
- section='dataFormat'
1929
- fieldName='bottomPrefix'
1930
- label='Prefix'
1931
- updateField={updateField}
1932
- tooltip={
1933
- <Tooltip style={{ textTransform: 'none' }}>
1934
- <Tooltip.Target>
1935
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1936
- </Tooltip.Target>
1937
- <Tooltip.Content>
1938
- <p>Enter a data suffix (such as "%"), if applicable.</p>
1939
- </Tooltip.Content>
1940
- </Tooltip>
1941
- }
1942
- />
1943
-
1944
- <TextField
1945
- value={config.dataFormat.bottomSuffix}
1946
- section='dataFormat'
1947
- fieldName='bottomSuffix'
1948
- label='Suffix'
1949
- updateField={updateField}
1950
- tooltip={
1951
- <Tooltip style={{ textTransform: 'none' }}>
1952
- <Tooltip.Target>
1953
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1954
- </Tooltip.Target>
1955
- <Tooltip.Content>
1956
- <p>Enter a data suffix (such as "%"), if applicable.</p>
1957
- </Tooltip.Content>
1958
- </Tooltip>
1959
- }
1960
- />
1961
-
1962
- <CheckBox
1963
- value={config.dataFormat.bottomAbbreviated}
1964
- section='dataFormat'
1965
- fieldName='bottomAbbreviated'
1966
- label='Abbreviate Axis Values'
1967
- updateField={updateField}
1968
- tooltip={
1969
- <Tooltip style={{ textTransform: 'none' }}>
1970
- <Tooltip.Target>
1971
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1972
- </Tooltip.Target>
1973
- <Tooltip.Content>
1974
- <p>{`This option abbreviates very large or very small numbers on the value axis`}</p>
1975
- </Tooltip.Content>
1976
- </Tooltip>
1977
- }
1978
- />
1979
- </>
1980
- )}
1981
-
1982
- {config.xAxis.type === 'date' && (
1983
- <>
1984
- <p style={{ padding: '1.5em 0 0.5em', fontSize: '.9rem', lineHeight: '1rem' }}>
1985
- Format how charts should parse and display your dates using{' '}
1986
- <a href='https://github.com/d3/d3-time-format#locale_format' target='_blank' rel='noreferrer'>
1987
- these guidelines
1988
- </a>
1989
- .
1990
- </p>
1991
- <TextField value={config.xAxis.dateParseFormat} section='xAxis' fieldName='dateParseFormat' placeholder='Ex. %Y-%m-%d' label='Date Parse Format' updateField={updateField} />
1992
- <TextField value={config.xAxis.dateDisplayFormat} section='xAxis' fieldName='dateDisplayFormat' placeholder='Ex. %Y-%m-%d' label='Date Display Format' updateField={updateField} />
1993
- </>
1994
- )}
1995
-
1996
- <CheckBox
1997
- value={config.exclusions.active}
1998
- section='exclusions'
1999
- fieldName='active'
2000
- label={config.xAxis.type === 'date' ? 'Limit by start and/or end dates' : 'Exclude one or more values'}
1629
+ <TextField
1630
+ value={config.dataFormat.rightSuffix}
1631
+ section='dataFormat'
1632
+ fieldName='rightSuffix'
1633
+ label='Suffix'
1634
+ updateField={updateField}
2001
1635
  tooltip={
2002
1636
  <Tooltip style={{ textTransform: 'none' }}>
2003
1637
  <Tooltip.Target>
2004
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1638
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2005
1639
  </Tooltip.Target>
2006
1640
  <Tooltip.Content>
2007
- <p>When this option is checked, you can select source-file values for exclusion from the date/category axis. </p>
1641
+ {config.visualizationType === 'Pie' && <p>Enter a data suffix to display in the data table and tooltips, if applicable.</p>}
1642
+ {config.visualizationType !== 'Pie' && <p>Enter a data suffix (such as "%"), if applicable.</p>}
2008
1643
  </Tooltip.Content>
2009
1644
  </Tooltip>
2010
1645
  }
2011
- updateField={updateField}
2012
1646
  />
2013
- {/* {visHasBrushChart && <CheckBox value={config.brush.active} section='brush' fieldName='active' label='Brush Slider ' updateField={updateField} />} */}
1647
+ </div>
2014
1648
 
2015
- {config.exclusions.active && (
2016
- <>
2017
- {config.xAxis.type === 'categorical' && (
2018
- <>
2019
- {config.exclusions.keys.length > 0 && (
2020
- <>
2021
- <fieldset>
2022
- <legend className='edit-label'>Excluded Keys</legend>
2023
- </fieldset>
2024
- <ExclusionsList />
2025
- </>
2026
- )}
1649
+ <CheckBox value={config.yAxis.rightHideAxis} section='yAxis' fieldName='rightHideAxis' label='Hide Axis' updateField={updateField} />
1650
+ <CheckBox value={config.yAxis.rightHideLabel} section='yAxis' fieldName='rightHideLabel' label='Hide Label' updateField={updateField} />
1651
+ <CheckBox value={config.yAxis.rightHideTicks} section='yAxis' fieldName='rightHideTicks' label='Hide Ticks' updateField={updateField} />
1652
+
1653
+ <TextField value={config.yAxis.max} section='yAxis' fieldName='rightMax' type='number' label='right axis max value' placeholder='Auto' updateField={updateField} />
1654
+ <span style={{ color: 'red', display: 'block' }}>{warningMsg.rightMaxMessage}</span>
1655
+ <TextField value={config.yAxis.min} section='yAxis' fieldName='rightMin' type='number' label='right axis min value' placeholder='Auto' updateField={updateField} />
1656
+ <span style={{ color: 'red', display: 'block' }}>{warningMsg.minMsg}</span>
1657
+ </AccordionItemPanel>
1658
+ </AccordionItem>
1659
+ )}
1660
+ {visSupportsDateCategoryAxis() && (
1661
+ <AccordionItem>
1662
+ <AccordionItemHeading>
1663
+ <AccordionItemButton>
1664
+ {config.visualizationType === 'Pie' ? 'Segments' : 'Date/Category Axis'}
1665
+ {!config.xAxis.dataKey && <WarningImage width='25' className='warning-icon' />}
1666
+ </AccordionItemButton>
1667
+ </AccordionItemHeading>
1668
+ <AccordionItemPanel>
1669
+ {config.visualizationType !== 'Pie' && (
1670
+ <>
1671
+ {config.visualizationType !== 'Forest Plot' && (
1672
+ <>
1673
+ <label>
1674
+ <span className='edit-label'>
1675
+ Data Scaling Type
1676
+ <Tooltip style={{ textTransform: 'none', display: 'inline-block' }}>
1677
+ <Tooltip.Target>
1678
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1679
+ </Tooltip.Target>
1680
+ <Tooltip.Content>Linear scales are employed for quantitative data, while time scales are used for time-series data.</Tooltip.Content>
1681
+ </Tooltip>
1682
+ </span>
1683
+ <select
1684
+ value={config.xAxis.type}
1685
+ onChange={e =>
1686
+ updateConfig({
1687
+ ...config,
1688
+ xAxis: {
1689
+ ...config.xAxis,
1690
+ type: e.target.value
1691
+ }
1692
+ })
1693
+ }
1694
+ >
1695
+ <option value='categorical'>Categorical (Linear Scale)</option>
1696
+ <option value='date'>Date (Linear Scale)</option>
1697
+ <option value='date-time'>Date (Date Time Scale)</option>
1698
+ {config.visualizationType === 'Scatter Plot' && <option value={'continuous'}>Continuous</option>}
1699
+ </select>
1700
+ </label>
2027
1701
 
2028
- <Select
2029
- fieldName='visualizationType'
2030
- label='Add Exclusion'
2031
- initial='Select'
2032
- onChange={e => {
2033
- if (e.target.value !== '' && e.target.value !== 'Select') {
2034
- addNewExclusion(e.target.value)
2035
- }
2036
- e.target.value = ''
2037
- }}
2038
- options={getDataValues(config.xAxis.dataKey, true)}
1702
+ {visSupportsDateCategoryAxisPadding() && (
1703
+ <TextField
1704
+ value={config.xAxis.padding}
1705
+ type='number'
1706
+ min={0}
1707
+ section='xAxis'
1708
+ fieldName='padding'
1709
+ label={'Padding (Percent)'}
1710
+ className='number-narrow'
1711
+ updateField={updateField}
1712
+ tooltip={
1713
+ <Tooltip style={{ textTransform: 'none' }}>
1714
+ <Tooltip.Target>
1715
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1716
+ </Tooltip.Target>
1717
+ <Tooltip.Content>
1718
+ <p>For use with date scale. Extends the earliest and latest dates represented on the scale by the percentage specified.</p>
1719
+ </Tooltip.Content>
1720
+ </Tooltip>
1721
+ }
2039
1722
  />
2040
- </>
2041
- )}
2042
-
2043
- {config.xAxis.type === 'date' && (
2044
- <>
2045
- <TextField type='date' section='exclusions' fieldName='dateStart' label='Start Date' updateField={updateField} value={config.exclusions.dateStart || ''} />
2046
- <TextField type='date' section='exclusions' fieldName='dateEnd' label='End Date' updateField={updateField} value={config.exclusions.dateEnd || ''} />
2047
- </>
2048
- )}
2049
- </>
2050
- )}
2051
-
2052
- {visSupportsDateCategoryNumTicks() && <TextField value={config.xAxis.numTicks} placeholder='Auto' type='number' min={1} section='xAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />}
2053
- {visSupportsDateCategoryHeight() && <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} />}
2054
-
2055
- {/* Hiding this for now, not interested in moving the axis lines away from chart comp. right now. */}
2056
- {/* <TextField value={config.xAxis.axisPadding} type='number' max={10} min={0} section='xAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} /> */}
2057
- {(config.xAxis.type === 'continuous' || config.forestPlot.type === 'Logarithmic') && (
2058
- <>
2059
- <CheckBox value={config.dataFormat.bottomCommas} section='dataFormat' fieldName='bottomCommas' label='Add commas' updateField={updateField} />
2060
- <TextField value={config.dataFormat.bottomRoundTo} type='number' section='dataFormat' fieldName='bottomRoundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
2061
- </>
2062
- )}
2063
- {visSupportsResponsiveTicks() && config.orientation === 'vertical' && config.visualizationType !== 'Paired Bar' && <CheckBox value={config.isResponsiveTicks} fieldName='isResponsiveTicks' label='Use Responsive Ticks' updateField={updateField} />}
2064
- {(config.orientation === 'horizontal' || !config.isResponsiveTicks) && visSupportsDateCategoryTickRotation() && (
2065
- <TextField value={config.xAxis.tickRotation} type='number' min={0} section='xAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />
2066
- )}
2067
- {config.orientation === 'vertical' && config.isResponsiveTicks && config.visualizationType !== 'Paired Bar' && (
2068
- <TextField
2069
- value={config.xAxis.maxTickRotation}
2070
- type='number'
2071
- min={0}
1723
+ )}
1724
+ </>
1725
+ )}
1726
+ <Select
1727
+ value={config.xAxis.dataKey || setCategoryAxis() || ''}
2072
1728
  section='xAxis'
2073
- fieldName='maxTickRotation'
2074
- label='Max Tick Rotation'
2075
- className='number-narrow'
1729
+ fieldName='dataKey'
1730
+ label='Data Key'
1731
+ initial='Select'
1732
+ required={true}
2076
1733
  updateField={updateField}
1734
+ options={getColumns(false)}
2077
1735
  tooltip={
2078
1736
  <Tooltip style={{ textTransform: 'none' }}>
2079
1737
  <Tooltip.Target>
2080
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1738
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2081
1739
  </Tooltip.Target>
2082
1740
  <Tooltip.Content>
2083
- <p>Degrees ticks will be rotated if values overlap, especially in smaller viewports.</p>
1741
+ <p>Select the column or row containing the categories or dates for this axis. </p>
2084
1742
  </Tooltip.Content>
2085
1743
  </Tooltip>
2086
1744
  }
2087
1745
  />
2088
- )}
2089
-
2090
- {config.orientation === 'horizontal' ? (
2091
- <>
2092
- {visSupportsDateCategoryAxisLine() && <CheckBox value={config.yAxis.hideAxis} section='yAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
2093
- {visSupportsDateCategoryAxisLabel() && <CheckBox value={config.yAxis.hideLabel} section='yAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
2094
- </>
2095
- ) : (
2096
- <>
2097
- {visSupportsDateCategoryAxisLine() && <CheckBox value={config.xAxis.hideAxis} section='xAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
2098
- {visSupportsDateCategoryAxisLabel() && <CheckBox value={config.xAxis.hideLabel} section='xAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
2099
- {visSupportsDateCategoryAxisTicks() && <CheckBox value={config.xAxis.hideTicks} section='xAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />}
2100
- </>
2101
- )}
2102
-
2103
- {config.series?.length === 1 && config.visualizationType === 'Bar' && (
2104
- <>
2105
- {/* HIGHLIGHTED BARS */}
2106
- <label htmlFor='barHighlight'>Bar Highlighting</label>
2107
- {config.series.length === 1 &&
2108
- highlightedBarValues.map((highlightedBarValue, i) => (
2109
- <fieldset>
2110
- <div className='edit-block' key={`highlighted-bar-${i}`}>
2111
- <button className='remove-column' onClick={e => handleRemoveHighlightedBar(e, i)}>
2112
- Remove
2113
- </button>
2114
- <p>Highlighted Bar {i + 1}</p>
2115
- <label>
2116
- <span className='edit-label column-heading'>Value</span>
2117
- <select value={config.highlightedBarValues[i].value} onChange={e => handleUpdateHighlightedBar(e, i)}>
2118
- <option value=''>- Select Value -</option>
2119
- {highlightedSeriesValues && [...new Set(highlightedSeriesValues)].sort().map(option => <option key={`special-class-value-option-${i}-${option}`}>{option}</option>)}
2120
- </select>
2121
- </label>
2122
- <label>
2123
- <span className='edit-label column-heading'>Color</span>
2124
- <input type='text' value={config.highlightedBarValues[i].color ? config.highlightedBarValues[i].color : ''} onChange={e => handleUpdateHighlightedBarColor(e, i)} />
2125
- </label>
2126
- <label>
2127
- <span className='edit-label column-heading'>Border Width</span>
2128
- <input max='5' min='0' type='number' value={config.highlightedBarValues[i].borderWidth ? config.highlightedBarValues[i].borderWidth : ''} onChange={e => handleUpdateHighlightedBorderWidth(e, i)} />
2129
- </label>
2130
- <label>
2131
- <span className='edit-label column-heading'>Legend Label</span>
2132
- <input type='text' value={config.highlightedBarValues[i].legendLabel ? config.highlightedBarValues[i].legendLabel : ''} onChange={e => handleHighlightedBarLegendLabel(e, i)} />
2133
- </label>
2134
- </div>
2135
- </fieldset>
2136
- ))}
2137
- <button className='btn full-width' onClick={e => handleAddNewHighlightedBar(e)}>
2138
- Add Highlighted Bar
2139
- </button>
2140
- </>
2141
- )}
2142
- </>
2143
- )}
1746
+ </>
1747
+ )}
2144
1748
 
2145
- {config.visualizationType === 'Pie' && (
2146
- <>
2147
- <CheckBox
2148
- value={config.exclusions.active}
2149
- section='exclusions'
2150
- fieldName='active'
2151
- label={'Exclude one or more values'}
1749
+ {config.visualizationType === 'Pie' && (
1750
+ <Select
1751
+ value={config.xAxis.dataKey || ''}
1752
+ section='xAxis'
1753
+ fieldName='dataKey'
1754
+ label='Segment Labels'
1755
+ initial='Select'
1756
+ required={true}
2152
1757
  updateField={updateField}
1758
+ options={getColumns(false)}
2153
1759
  tooltip={
2154
1760
  <Tooltip style={{ textTransform: 'none' }}>
2155
1761
  <Tooltip.Target>
2156
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1762
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2157
1763
  </Tooltip.Target>
2158
1764
  <Tooltip.Content>
2159
- <p>When this option is checked, you can select values for exclusion from the pie segments.</p>
1765
+ <p>Select the source row or column that contains the segment labels. Depending on the data structure, it may be listed as "Key."</p>
2160
1766
  </Tooltip.Content>
2161
1767
  </Tooltip>
2162
1768
  }
2163
1769
  />
2164
- {config.exclusions.active && (
2165
- <>
2166
- {config.exclusions.keys.length > 0 && (
2167
- <>
2168
- <fieldset>
2169
- <legend className='edit-label'>Excluded Keys</legend>
2170
- </fieldset>
2171
- <ExclusionsList />
2172
- </>
2173
- )}
2174
-
2175
- <Select
2176
- fieldName='visualizationType'
2177
- label='Add Exclusion'
2178
- initial='Select'
2179
- onChange={e => {
2180
- if (e.target.value !== '' && e.target.value !== 'Select') {
2181
- addNewExclusion(e.target.value)
1770
+ )}
1771
+
1772
+ {config.visualizationType !== 'Pie' && (
1773
+ <>
1774
+ <TextField value={config.xAxis.label} section='xAxis' fieldName='label' label='Label' updateField={updateField} />
1775
+
1776
+ {config.xAxis.type === 'continuous' && (
1777
+ <>
1778
+ <TextField
1779
+ value={config.dataFormat.bottomPrefix}
1780
+ section='dataFormat'
1781
+ fieldName='bottomPrefix'
1782
+ label='Prefix'
1783
+ updateField={updateField}
1784
+ tooltip={
1785
+ <Tooltip style={{ textTransform: 'none' }}>
1786
+ <Tooltip.Target>
1787
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1788
+ </Tooltip.Target>
1789
+ <Tooltip.Content>
1790
+ <p>Enter a data suffix (such as "%"), if applicable.</p>
1791
+ </Tooltip.Content>
1792
+ </Tooltip>
2182
1793
  }
2183
- e.target.value = ''
2184
- }}
2185
- options={getDataValues(config.xAxis.dataKey, true)}
2186
- />
2187
- </>
2188
- )}
2189
- </>
2190
- )}
2191
-
2192
- {/* anchors */}
2193
- {visHasAnchors() && config.orientation !== 'horizontal' && (
2194
- <div className='edit-block'>
2195
- <span className='edit-label column-heading'>Anchors</span>
2196
- <Accordion allowZeroExpanded>
2197
- {config.xAxis?.anchors?.map((anchor, index) => (
2198
- <AccordionItem className='series-item series-item--chart' key={`xaxis-anchors-2-${index}`}>
2199
- <AccordionItemHeading className='series-item__title'>
2200
- <>
2201
- <AccordionItemButton className={'accordion__button accordion__button'}>
2202
- Anchor {index + 1}
2203
- <button
2204
- className='series-list__remove'
2205
- onClick={e => {
2206
- e.preventDefault()
2207
- const copiedAnchorGroups = [...config.xAxis.anchors]
2208
- copiedAnchorGroups.splice(index, 1)
2209
- updateConfig({
2210
- ...config,
2211
- xAxis: {
2212
- ...config.xAxis,
2213
- anchors: copiedAnchorGroups
2214
- }
2215
- })
2216
- }}
2217
- >
2218
- Remove
2219
- </button>
2220
- </AccordionItemButton>
2221
- </>
2222
- </AccordionItemHeading>
2223
- <AccordionItemPanel>
2224
- <label>
2225
- <span>Anchor Value</span>
1794
+ />
1795
+
1796
+ <TextField
1797
+ value={config.dataFormat.bottomSuffix}
1798
+ section='dataFormat'
1799
+ fieldName='bottomSuffix'
1800
+ label='Suffix'
1801
+ updateField={updateField}
1802
+ tooltip={
2226
1803
  <Tooltip style={{ textTransform: 'none' }}>
2227
1804
  <Tooltip.Target>
2228
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
1805
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
2229
1806
  </Tooltip.Target>
2230
1807
  <Tooltip.Content>
2231
- <p>Enter the value as its shown in the data column</p>
1808
+ <p>Enter a data suffix (such as "%"), if applicable.</p>
2232
1809
  </Tooltip.Content>
2233
1810
  </Tooltip>
2234
- <input
2235
- type='text'
2236
- value={config.xAxis.anchors[index].value ? config.xAxis.anchors[index].value : ''}
2237
- onChange={e => {
2238
- e.preventDefault()
2239
- const copiedAnchors = [...config.xAxis.anchors]
2240
- copiedAnchors[index].value = e.target.value
2241
- updateConfig({
2242
- ...config,
2243
- xAxis: {
2244
- ...config.xAxis,
2245
- anchors: copiedAnchors
2246
- }
2247
- })
2248
- }}
2249
- />
2250
- </label>
1811
+ }
1812
+ />
2251
1813
 
2252
- <label>
2253
- <span>Anchor Color</span>
2254
- <input
2255
- type='text'
2256
- value={config.xAxis.anchors[index].color ? config.xAxis.anchors[index].color : ''}
1814
+ <CheckBox
1815
+ value={config.dataFormat.bottomAbbreviated}
1816
+ section='dataFormat'
1817
+ fieldName='bottomAbbreviated'
1818
+ label='Abbreviate Axis Values'
1819
+ updateField={updateField}
1820
+ tooltip={
1821
+ <Tooltip style={{ textTransform: 'none' }}>
1822
+ <Tooltip.Target>
1823
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1824
+ </Tooltip.Target>
1825
+ <Tooltip.Content>
1826
+ <p>{`This option abbreviates very large or very small numbers on the value axis`}</p>
1827
+ </Tooltip.Content>
1828
+ </Tooltip>
1829
+ }
1830
+ />
1831
+ </>
1832
+ )}
1833
+
1834
+ {isDateScale(config.xAxis) && (
1835
+ <>
1836
+ <p style={{ padding: '1.5em 0 0.5em', fontSize: '.9rem', lineHeight: '1rem' }}>
1837
+ Format how charts should parse and display your dates using{' '}
1838
+ <a href='https://github.com/d3/d3-time-format#locale_format' target='_blank' rel='noreferrer'>
1839
+ these guidelines
1840
+ </a>
1841
+ .
1842
+ </p>
1843
+ <TextField
1844
+ tooltip={
1845
+ <Tooltip style={{ textTransform: 'none' }}>
1846
+ <Tooltip.Target>
1847
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1848
+ </Tooltip.Target>
1849
+ <Tooltip.Content>
1850
+ <p>This field specifies the pattern used to read and interpret dates in your dataset, ensuring the dates are correctly understood and processed. </p>
1851
+ </Tooltip.Content>
1852
+ </Tooltip>
1853
+ }
1854
+ value={config.xAxis.dateParseFormat}
1855
+ section='xAxis'
1856
+ fieldName='dateParseFormat'
1857
+ placeholder='Ex. %Y-%m-%d'
1858
+ label='Date Parse Format'
1859
+ updateField={updateField}
1860
+ />
1861
+ <TextField
1862
+ tooltip={
1863
+ <Tooltip style={{ textTransform: 'none' }}>
1864
+ <Tooltip.Target>
1865
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1866
+ </Tooltip.Target>
1867
+ <Tooltip.Content>
1868
+ <p> Adjusts the date display format on the axis for clear, visual date representation.</p>
1869
+ </Tooltip.Content>
1870
+ </Tooltip>
1871
+ }
1872
+ value={config.xAxis.dateDisplayFormat}
1873
+ section='xAxis'
1874
+ fieldName='dateDisplayFormat'
1875
+ placeholder='Ex. %Y-%m-%d'
1876
+ label='AXIS DATE DISPLAY FORMAT'
1877
+ updateField={updateField}
1878
+ />
1879
+ <TextField
1880
+ tooltip={
1881
+ <Tooltip style={{ textTransform: 'none' }}>
1882
+ <Tooltip.Target>
1883
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1884
+ </Tooltip.Target>
1885
+ <Tooltip.Content>
1886
+ <p>Specify a custom format for displaying dates in data table. If left empty, dates will adopt the Axis Date Display format. </p>
1887
+ </Tooltip.Content>
1888
+ </Tooltip>
1889
+ }
1890
+ value={config.table.dateDisplayFormat}
1891
+ section='table'
1892
+ fieldName='dateDisplayFormat'
1893
+ placeholder='Ex. %Y-%m-%d'
1894
+ label='DATA TABLE DATE DISPLAY FORMAT'
1895
+ updateField={updateField}
1896
+ />
1897
+ <TextField
1898
+ tooltip={
1899
+ <Tooltip style={{ textTransform: 'none' }}>
1900
+ <Tooltip.Target>
1901
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1902
+ </Tooltip.Target>
1903
+ <Tooltip.Content>
1904
+ <p>Specify a custom format for displaying dates on hovers. If left empty, dates will adopt the Axis Date Display format. </p>
1905
+ </Tooltip.Content>
1906
+ </Tooltip>
1907
+ }
1908
+ value={config.tooltips.dateDisplayFormat}
1909
+ section='tooltips'
1910
+ fieldName='dateDisplayFormat'
1911
+ placeholder='Ex. %Y-%m-%d'
1912
+ label='HOVER DATE DISPLAY FORMAT'
1913
+ updateField={updateField}
1914
+ />
1915
+ </>
1916
+ )}
1917
+
1918
+ <CheckBox
1919
+ value={config.exclusions.active}
1920
+ section='exclusions'
1921
+ fieldName='active'
1922
+ label={config.xAxis.type === 'date' ? 'Limit by start and/or end dates' : 'Exclude one or more values'}
1923
+ tooltip={
1924
+ <Tooltip style={{ textTransform: 'none' }}>
1925
+ <Tooltip.Target>
1926
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
1927
+ </Tooltip.Target>
1928
+ <Tooltip.Content>
1929
+ <p>When this option is checked, you can select source-file values for exclusion from the date/category axis. </p>
1930
+ </Tooltip.Content>
1931
+ </Tooltip>
1932
+ }
1933
+ updateField={updateField}
1934
+ />
1935
+ {/* {visHasBrushChart && <CheckBox value={config.brush.active} section='brush' fieldName='active' label='Brush Slider ' updateField={updateField} />} */}
1936
+
1937
+ {config.exclusions.active && (
1938
+ <>
1939
+ {config.xAxis.type === 'categorical' && (
1940
+ <>
1941
+ {config.exclusions.keys.length > 0 && (
1942
+ <>
1943
+ <fieldset>
1944
+ <legend className='edit-label'>Excluded Keys</legend>
1945
+ </fieldset>
1946
+ <ExclusionsList />
1947
+ </>
1948
+ )}
1949
+
1950
+ <Select
1951
+ fieldName='visualizationType'
1952
+ label='Add Exclusion'
1953
+ initial='Select'
2257
1954
  onChange={e => {
2258
- e.preventDefault()
2259
- const copiedAnchors = [...config.xAxis.anchors]
2260
- copiedAnchors[index].color = e.target.value
2261
- updateConfig({
2262
- ...config,
2263
- xAxis: {
2264
- ...config.xAxis,
2265
- anchors: copiedAnchors
2266
- }
2267
- })
1955
+ if (e.target.value !== '' && e.target.value !== 'Select') {
1956
+ addNewExclusion(e.target.value)
1957
+ }
1958
+ e.target.value = ''
2268
1959
  }}
1960
+ options={getDataValues(config.xAxis.dataKey, true)}
2269
1961
  />
2270
- </label>
1962
+ </>
1963
+ )}
2271
1964
 
2272
- <label>
2273
- Anchor Line Style
2274
- <select
2275
- value={config.xAxis.anchors[index].lineStyle || ''}
2276
- onChange={e => {
2277
- const copiedAnchors = [...config.xAxis.anchors]
2278
- copiedAnchors[index].lineStyle = e.target.value
2279
- updateConfig({
2280
- ...config,
2281
- xAxis: {
2282
- ...config.xAxis,
2283
- anchors: copiedAnchors
2284
- }
2285
- })
2286
- }}
2287
- >
2288
- <option>Select</option>
2289
- {lineOptions.map(line => (
2290
- <option key={line.key}>{line.value}</option>
2291
- ))}
2292
- </select>
2293
- </label>
2294
- </AccordionItemPanel>
2295
- </AccordionItem>
2296
- ))}
2297
- </Accordion>
2298
-
2299
- <button
2300
- className='btn full-width'
2301
- onClick={e => {
2302
- e.preventDefault()
2303
- const anchors = [...config.xAxis.anchors]
2304
- anchors.push({} as Anchor)
2305
- updateConfig({
2306
- ...config,
2307
- xAxis: {
2308
- ...config.xAxis,
2309
- anchors
1965
+ {config.xAxis.type === 'date' && (
1966
+ <>
1967
+ <TextField type='date' section='exclusions' fieldName='dateStart' label='Start Date' updateField={updateField} value={config.exclusions.dateStart || ''} />
1968
+ <TextField type='date' section='exclusions' fieldName='dateEnd' label='End Date' updateField={updateField} value={config.exclusions.dateEnd || ''} />
1969
+ </>
1970
+ )}
1971
+ </>
1972
+ )}
1973
+
1974
+ {visSupportsDateCategoryNumTicks() && <TextField value={config.xAxis.numTicks} placeholder='Auto' type='number' min={1} section='xAxis' fieldName='numTicks' label='Number of ticks' className='number-narrow' updateField={updateField} />}
1975
+ {visSupportsDateCategoryHeight() && <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} />}
1976
+
1977
+ {visSupportsDateCategoryAxisPadding() && <TextField value={config.xAxis.padding} type='number' min={0} section='xAxis' fieldName='padding' label={'Padding (Percent)'} className='number-narrow' updateField={updateField} />}
1978
+
1979
+ {/* Hiding this for now, not interested in moving the axis lines away from chart comp. right now. */}
1980
+ {/* <TextField value={config.xAxis.axisPadding} type='number' max={10} min={0} section='xAxis' fieldName='axisPadding' label={'Axis Padding'} className='number-narrow' updateField={updateField} /> */}
1981
+ {(config.xAxis.type === 'continuous' || config.forestPlot.type === 'Logarithmic') && (
1982
+ <>
1983
+ <CheckBox value={config.dataFormat.bottomCommas} section='dataFormat' fieldName='bottomCommas' label='Add commas' updateField={updateField} />
1984
+ <TextField value={config.dataFormat.bottomRoundTo} type='number' section='dataFormat' fieldName='bottomRoundTo' label='Round to decimal point' className='number-narrow' updateField={updateField} min={0} />
1985
+ </>
1986
+ )}
1987
+ {visSupportsResponsiveTicks() && config.orientation === 'vertical' && config.visualizationType !== 'Paired Bar' && <CheckBox value={config.isResponsiveTicks} fieldName='isResponsiveTicks' label='Use Responsive Ticks' updateField={updateField} />}
1988
+ {(config.orientation === 'horizontal' || !config.isResponsiveTicks) && visSupportsDateCategoryTickRotation() && (
1989
+ <TextField value={config.xAxis.tickRotation} type='number' min={0} section='xAxis' fieldName='tickRotation' label='Tick rotation (Degrees)' className='number-narrow' updateField={updateField} />
1990
+ )}
1991
+ {config.orientation === 'vertical' && config.isResponsiveTicks && config.visualizationType !== 'Paired Bar' && (
1992
+ <TextField
1993
+ value={config.xAxis.maxTickRotation}
1994
+ type='number'
1995
+ min={0}
1996
+ section='xAxis'
1997
+ fieldName='maxTickRotation'
1998
+ label='Max Tick Rotation'
1999
+ className='number-narrow'
2000
+ updateField={updateField}
2001
+ tooltip={
2002
+ <Tooltip style={{ textTransform: 'none' }}>
2003
+ <Tooltip.Target>
2004
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
2005
+ </Tooltip.Target>
2006
+ <Tooltip.Content>
2007
+ <p>Degrees ticks will be rotated if values overlap, especially in smaller viewports.</p>
2008
+ </Tooltip.Content>
2009
+ </Tooltip>
2310
2010
  }
2311
- })
2312
- }}
2313
- >
2314
- Add Anchor
2315
- </button>
2316
- </div>
2317
- )}
2318
-
2319
- {visHasAnchors() && config.orientation === 'horizontal' && (
2320
- <div className='edit-block'>
2321
- <span className='edit-label column-heading'>Anchors</span>
2322
- <Accordion allowZeroExpanded>
2323
- {config.yAxis?.anchors?.map((anchor, index) => (
2324
- <AccordionItem className='series-item series-item--chart' key={`accordion-yaxis-anchors-${index}`}>
2325
- <AccordionItemHeading className='series-item__title'>
2011
+ />
2012
+ )}
2013
+
2014
+ {config.orientation === 'horizontal' ? (
2015
+ <>
2016
+ {visSupportsDateCategoryAxisLine() && <CheckBox value={config.yAxis.hideAxis} section='yAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
2017
+ {visSupportsDateCategoryAxisLabel() && <CheckBox value={config.yAxis.hideLabel} section='yAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
2018
+ </>
2019
+ ) : (
2020
+ <>
2021
+ {visSupportsDateCategoryAxisLine() && <CheckBox value={config.xAxis.hideAxis} section='xAxis' fieldName='hideAxis' label='Hide Axis' updateField={updateField} />}
2022
+ {visSupportsDateCategoryAxisLabel() && <CheckBox value={config.xAxis.hideLabel} section='xAxis' fieldName='hideLabel' label='Hide Label' updateField={updateField} />}
2023
+ {visSupportsDateCategoryAxisTicks() && <CheckBox value={config.xAxis.hideTicks} section='xAxis' fieldName='hideTicks' label='Hide Ticks' updateField={updateField} />}
2024
+ </>
2025
+ )}
2026
+
2027
+ {config.series?.length === 1 && config.visualizationType === 'Bar' && (
2028
+ <>
2029
+ {/* HIGHLIGHTED BARS */}
2030
+ <label htmlFor='barHighlight'>Bar Highlighting</label>
2031
+ {config.series.length === 1 &&
2032
+ highlightedBarValues.map((highlightedBarValue, i) => (
2033
+ <fieldset>
2034
+ <div className='edit-block' key={`highlighted-bar-${i}`}>
2035
+ <button className='remove-column' onClick={e => handleRemoveHighlightedBar(e, i)}>
2036
+ Remove
2037
+ </button>
2038
+ <p>Highlighted Bar {i + 1}</p>
2039
+ <label>
2040
+ <span className='edit-label column-heading'>Value</span>
2041
+ <select value={config.highlightedBarValues[i].value} onChange={e => handleUpdateHighlightedBar(e, i)}>
2042
+ <option value=''>- Select Value -</option>
2043
+ {highlightedSeriesValues && [...new Set(highlightedSeriesValues)].sort().map(option => <option key={`special-class-value-option-${i}-${option}`}>{option}</option>)}
2044
+ </select>
2045
+ </label>
2046
+ <label>
2047
+ <span className='edit-label column-heading'>Color</span>
2048
+ <input type='text' value={config.highlightedBarValues[i].color ? config.highlightedBarValues[i].color : ''} onChange={e => handleUpdateHighlightedBarColor(e, i)} />
2049
+ </label>
2050
+ <label>
2051
+ <span className='edit-label column-heading'>Border Width</span>
2052
+ <input max='5' min='0' type='number' value={config.highlightedBarValues[i].borderWidth ? config.highlightedBarValues[i].borderWidth : ''} onChange={e => handleUpdateHighlightedBorderWidth(e, i)} />
2053
+ </label>
2054
+ <label>
2055
+ <span className='edit-label column-heading'>Legend Label</span>
2056
+ <input type='text' value={config.highlightedBarValues[i].legendLabel ? config.highlightedBarValues[i].legendLabel : ''} onChange={e => handleHighlightedBarLegendLabel(e, i)} />
2057
+ </label>
2058
+ </div>
2059
+ </fieldset>
2060
+ ))}
2061
+ <button className='btn full-width' onClick={e => handleAddNewHighlightedBar(e)}>
2062
+ Add Highlighted Bar
2063
+ </button>
2064
+ </>
2065
+ )}
2066
+ </>
2067
+ )}
2068
+
2069
+ {config.visualizationType === 'Pie' && (
2070
+ <>
2071
+ <CheckBox
2072
+ value={config.exclusions.active}
2073
+ section='exclusions'
2074
+ fieldName='active'
2075
+ label={'Exclude one or more values'}
2076
+ updateField={updateField}
2077
+ tooltip={
2078
+ <Tooltip style={{ textTransform: 'none' }}>
2079
+ <Tooltip.Target>
2080
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
2081
+ </Tooltip.Target>
2082
+ <Tooltip.Content>
2083
+ <p>When this option is checked, you can select values for exclusion from the pie segments.</p>
2084
+ </Tooltip.Content>
2085
+ </Tooltip>
2086
+ }
2087
+ />
2088
+ {config.exclusions.active && (
2089
+ <>
2090
+ {config.exclusions.keys.length > 0 && (
2326
2091
  <>
2327
- <AccordionItemButton className={'accordion__button accordion__button'}>
2328
- Anchor {index + 1}
2329
- <button
2330
- className='series-list__remove'
2331
- onClick={e => {
2092
+ <fieldset>
2093
+ <legend className='edit-label'>Excluded Keys</legend>
2094
+ </fieldset>
2095
+ <ExclusionsList />
2096
+ </>
2097
+ )}
2098
+
2099
+ <Select
2100
+ fieldName='visualizationType'
2101
+ label='Add Exclusion'
2102
+ initial='Select'
2103
+ onChange={e => {
2104
+ if (e.target.value !== '' && e.target.value !== 'Select') {
2105
+ addNewExclusion(e.target.value)
2106
+ }
2107
+ e.target.value = ''
2108
+ }}
2109
+ options={getDataValues(config.xAxis.dataKey, true)}
2110
+ />
2111
+ </>
2112
+ )}
2113
+ </>
2114
+ )}
2115
+
2116
+ {/* anchors */}
2117
+ {visHasAnchors() && config.orientation !== 'horizontal' && (
2118
+ <div className='edit-block'>
2119
+ <span className='edit-label column-heading'>Anchors</span>
2120
+ <Accordion allowZeroExpanded>
2121
+ {config.xAxis?.anchors?.map((anchor, index) => (
2122
+ <AccordionItem className='series-item series-item--chart' key={`xaxis-anchors-2-${index}`}>
2123
+ <AccordionItemHeading className='series-item__title'>
2124
+ <>
2125
+ <AccordionItemButton className={'accordion__button accordion__button'}>
2126
+ Anchor {index + 1}
2127
+ <button
2128
+ className='series-list__remove'
2129
+ onClick={e => {
2130
+ e.preventDefault()
2131
+ const copiedAnchorGroups = [...config.xAxis.anchors]
2132
+ copiedAnchorGroups.splice(index, 1)
2133
+ updateConfig({
2134
+ ...config,
2135
+ xAxis: {
2136
+ ...config.xAxis,
2137
+ anchors: copiedAnchorGroups
2138
+ }
2139
+ })
2140
+ }}
2141
+ >
2142
+ Remove
2143
+ </button>
2144
+ </AccordionItemButton>
2145
+ </>
2146
+ </AccordionItemHeading>
2147
+ <AccordionItemPanel>
2148
+ <label>
2149
+ <span>Anchor Value</span>
2150
+ <Tooltip style={{ textTransform: 'none' }}>
2151
+ <Tooltip.Target>
2152
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2153
+ </Tooltip.Target>
2154
+ <Tooltip.Content>
2155
+ <p>Enter the value as its shown in the data column</p>
2156
+ </Tooltip.Content>
2157
+ </Tooltip>
2158
+ <input
2159
+ type='text'
2160
+ value={config.xAxis.anchors[index].value ? config.xAxis.anchors[index].value : ''}
2161
+ onChange={e => {
2332
2162
  e.preventDefault()
2333
- const copiedAnchorGroups = [...config.yAxis.anchors]
2334
- copiedAnchorGroups.splice(index, 1)
2163
+ const copiedAnchors = [...config.xAxis.anchors]
2164
+ copiedAnchors[index].value = e.target.value
2165
+ updateConfig({
2166
+ ...config,
2167
+ xAxis: {
2168
+ ...config.xAxis,
2169
+ anchors: copiedAnchors
2170
+ }
2171
+ })
2172
+ }}
2173
+ />
2174
+ </label>
2175
+
2176
+ <label>
2177
+ <span>Anchor Color</span>
2178
+ <input
2179
+ type='text'
2180
+ value={config.xAxis.anchors[index].color ? config.xAxis.anchors[index].color : ''}
2181
+ onChange={e => {
2182
+ e.preventDefault()
2183
+ const copiedAnchors = [...config.xAxis.anchors]
2184
+ copiedAnchors[index].color = e.target.value
2185
+ updateConfig({
2186
+ ...config,
2187
+ xAxis: {
2188
+ ...config.xAxis,
2189
+ anchors: copiedAnchors
2190
+ }
2191
+ })
2192
+ }}
2193
+ />
2194
+ </label>
2195
+
2196
+ <label>
2197
+ Anchor Line Style
2198
+ <select
2199
+ value={config.xAxis.anchors[index].lineStyle || ''}
2200
+ onChange={e => {
2201
+ const copiedAnchors = [...config.xAxis.anchors]
2202
+ copiedAnchors[index].lineStyle = e.target.value
2203
+ updateConfig({
2204
+ ...config,
2205
+ xAxis: {
2206
+ ...config.xAxis,
2207
+ anchors: copiedAnchors
2208
+ }
2209
+ })
2210
+ }}
2211
+ >
2212
+ <option>Select</option>
2213
+ {lineOptions.map(line => (
2214
+ <option key={line.key}>{line.value}</option>
2215
+ ))}
2216
+ </select>
2217
+ </label>
2218
+ </AccordionItemPanel>
2219
+ </AccordionItem>
2220
+ ))}
2221
+ </Accordion>
2222
+
2223
+ <button
2224
+ className='btn full-width'
2225
+ onClick={e => {
2226
+ e.preventDefault()
2227
+ const anchors = [...config.xAxis.anchors]
2228
+ anchors.push({} as Anchor)
2229
+ updateConfig({
2230
+ ...config,
2231
+ xAxis: {
2232
+ ...config.xAxis,
2233
+ anchors
2234
+ }
2235
+ })
2236
+ }}
2237
+ >
2238
+ Add Anchor
2239
+ </button>
2240
+ </div>
2241
+ )}
2242
+
2243
+ {visHasAnchors() && config.orientation === 'horizontal' && (
2244
+ <div className='edit-block'>
2245
+ <span className='edit-label column-heading'>Anchors</span>
2246
+ <Accordion allowZeroExpanded>
2247
+ {config.yAxis?.anchors?.map((anchor, index) => (
2248
+ <AccordionItem className='series-item series-item--chart' key={`accordion-yaxis-anchors-${index}`}>
2249
+ <AccordionItemHeading className='series-item__title'>
2250
+ <>
2251
+ <AccordionItemButton className={'accordion__button accordion__button'}>
2252
+ Anchor {index + 1}
2253
+ <button
2254
+ className='series-list__remove'
2255
+ onClick={e => {
2256
+ e.preventDefault()
2257
+ const copiedAnchorGroups = [...config.yAxis.anchors]
2258
+ copiedAnchorGroups.splice(index, 1)
2259
+ updateConfig({
2260
+ ...config,
2261
+ yAxis: {
2262
+ ...config.yAxis,
2263
+ anchors: copiedAnchorGroups
2264
+ }
2265
+ })
2266
+ }}
2267
+ >
2268
+ Remove
2269
+ </button>
2270
+ </AccordionItemButton>
2271
+ </>
2272
+ </AccordionItemHeading>
2273
+ <AccordionItemPanel>
2274
+ <label>
2275
+ <span>Anchor Value</span>
2276
+ <Tooltip style={{ textTransform: 'none' }}>
2277
+ <Tooltip.Target>
2278
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2279
+ </Tooltip.Target>
2280
+ <Tooltip.Content>
2281
+ <p>Enter the value as its shown in the data column</p>
2282
+ </Tooltip.Content>
2283
+ </Tooltip>
2284
+ <input
2285
+ type='text'
2286
+ value={config.yAxis.anchors[index].value ? config.yAxis.anchors[index].value : ''}
2287
+ onChange={e => {
2288
+ e.preventDefault()
2289
+ const copiedAnchors = [...config.yAxis.anchors]
2290
+ copiedAnchors[index].value = e.target.value
2335
2291
  updateConfig({
2336
2292
  ...config,
2337
2293
  yAxis: {
2338
2294
  ...config.yAxis,
2339
- anchors: copiedAnchorGroups
2295
+ anchors: copiedAnchors
2340
2296
  }
2341
2297
  })
2342
2298
  }}
2343
- >
2344
- Remove
2345
- </button>
2346
- </AccordionItemButton>
2347
- </>
2348
- </AccordionItemHeading>
2349
- <AccordionItemPanel>
2350
- <label>
2351
- <span>Anchor Value</span>
2352
- <Tooltip style={{ textTransform: 'none' }}>
2353
- <Tooltip.Target>
2354
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2355
- </Tooltip.Target>
2356
- <Tooltip.Content>
2357
- <p>Enter the value as its shown in the data column</p>
2358
- </Tooltip.Content>
2359
- </Tooltip>
2360
- <input
2361
- type='text'
2362
- value={config.yAxis.anchors[index].value ? config.yAxis.anchors[index].value : ''}
2363
- onChange={e => {
2364
- e.preventDefault()
2365
- const copiedAnchors = [...config.yAxis.anchors]
2366
- copiedAnchors[index].value = e.target.value
2367
- updateConfig({
2368
- ...config,
2369
- yAxis: {
2370
- ...config.yAxis,
2371
- anchors: copiedAnchors
2372
- }
2373
- })
2374
- }}
2375
- />
2376
- </label>
2299
+ />
2300
+ </label>
2377
2301
 
2378
- <label>
2379
- <span>Anchor Color</span>
2380
- <input
2381
- type='text'
2382
- value={config.yAxis.anchors[index].color ? config.yAxis.anchors[index].color : ''}
2383
- onChange={e => {
2384
- e.preventDefault()
2385
- const copiedAnchors = [...config.yAxis.anchors]
2386
- copiedAnchors[index].color = e.target.value
2387
- updateConfig({
2388
- ...config,
2389
- yAxis: {
2390
- ...config.yAxis,
2391
- anchors: copiedAnchors
2392
- }
2393
- })
2394
- }}
2395
- />
2396
- </label>
2302
+ <label>
2303
+ <span>Anchor Color</span>
2304
+ <input
2305
+ type='text'
2306
+ value={config.yAxis.anchors[index].color ? config.yAxis.anchors[index].color : ''}
2307
+ onChange={e => {
2308
+ e.preventDefault()
2309
+ const copiedAnchors = [...config.yAxis.anchors]
2310
+ copiedAnchors[index].color = e.target.value
2311
+ updateConfig({
2312
+ ...config,
2313
+ yAxis: {
2314
+ ...config.yAxis,
2315
+ anchors: copiedAnchors
2316
+ }
2317
+ })
2318
+ }}
2319
+ />
2320
+ </label>
2397
2321
 
2398
- <label>
2399
- Anchor Line Style
2400
- <select
2401
- value={config.yAxis.anchors[index].lineStyle || ''}
2402
- onChange={e => {
2403
- const copiedAnchors = [...config.yAxis.anchors]
2404
- copiedAnchors[index].lineStyle = e.target.value
2405
- updateConfig({
2406
- ...config,
2407
- yAxis: {
2408
- ...config.yAxis,
2409
- anchors: copiedAnchors
2410
- }
2411
- })
2412
- }}
2413
- >
2414
- <option>Select</option>
2415
- {lineOptions.map(line => (
2416
- <option key={line.key}>{line.value}</option>
2417
- ))}
2418
- </select>
2419
- </label>
2420
- </AccordionItemPanel>
2421
- </AccordionItem>
2422
- ))}
2423
- </Accordion>
2424
-
2425
- <button
2426
- className='btn full-width'
2427
- onClick={e => {
2428
- e.preventDefault()
2429
- const anchors = [...config.yAxis.anchors]
2430
- anchors.push({} as Anchor)
2431
- updateConfig({
2432
- ...config,
2433
- yAxis: {
2434
- ...config.yAxis,
2435
- anchors
2436
- }
2437
- })
2438
- }}
2439
- >
2440
- Add Anchor
2441
- </button>
2442
- </div>
2443
- )}
2444
- </AccordionItemPanel>
2445
- </AccordionItem>
2446
- )}
2447
- <Panels.Regions name='Regions' />
2448
- {/* Columns */}
2449
- {config.visualizationType !== 'Box Plot' && (
2450
- <AccordionItem>
2451
- <AccordionItemHeading>
2452
- <AccordionItemButton>Columns</AccordionItemButton>
2453
- </AccordionItemHeading>
2454
- <AccordionItemPanel>
2455
- {'navigation' !== config.type && (
2456
- <fieldset className='primary-fieldset edit-block'>
2457
- <label>
2458
- <span className='edit-label'>
2459
- Additional Columns
2460
- <Tooltip style={{ textTransform: 'none' }}>
2461
- <Tooltip.Target>
2462
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2463
- </Tooltip.Target>
2464
- <Tooltip.Content>
2465
- <p>You can specify additional columns to display in tooltips and / or the supporting data table.</p>
2466
- </Tooltip.Content>
2467
- </Tooltip>
2468
- </span>
2469
- </label>
2470
- {additionalColumns.map(val => (
2471
- <fieldset className='edit-block' key={val}>
2472
- <button
2473
- className='remove-column'
2474
- onClick={event => {
2475
- event.preventDefault()
2476
- removeAdditionalColumn(val)
2477
- }}
2478
- >
2479
- Remove
2480
- </button>
2481
- <label>
2482
- <span className='edit-label column-heading'>Column</span>
2483
- <select
2484
- value={config.columns[val] ? config.columns[val].name : getColumns()[0]}
2485
- onChange={event => {
2486
- editColumn(val, 'name', event.target.value)
2487
- }}
2488
- >
2489
- {getColumns().map(option => (
2490
- <option>{option}</option>
2491
- ))}
2492
- </select>
2493
- </label>
2494
- <label>
2495
- <span className='edit-label column-heading'>Associate to Series</span>
2496
- <select
2497
- value={config.columns[val] ? config.columns[val].series : ''}
2498
- onChange={event => {
2499
- editColumn(val, 'series', event.target.value)
2322
+ <label>
2323
+ Anchor Line Style
2324
+ <select
2325
+ value={config.yAxis.anchors[index].lineStyle || ''}
2326
+ onChange={e => {
2327
+ const copiedAnchors = [...config.yAxis.anchors]
2328
+ copiedAnchors[index].lineStyle = e.target.value
2329
+ updateConfig({
2330
+ ...config,
2331
+ yAxis: {
2332
+ ...config.yAxis,
2333
+ anchors: copiedAnchors
2334
+ }
2335
+ })
2336
+ }}
2337
+ >
2338
+ <option>Select</option>
2339
+ {lineOptions.map(line => (
2340
+ <option key={line.key}>{line.value}</option>
2341
+ ))}
2342
+ </select>
2343
+ </label>
2344
+ </AccordionItemPanel>
2345
+ </AccordionItem>
2346
+ ))}
2347
+ </Accordion>
2348
+
2349
+ <button
2350
+ className='btn full-width'
2351
+ onClick={e => {
2352
+ e.preventDefault()
2353
+ const anchors = [...config.yAxis.anchors]
2354
+ anchors.push({} as Anchor)
2355
+ updateConfig({
2356
+ ...config,
2357
+ yAxis: {
2358
+ ...config.yAxis,
2359
+ anchors
2360
+ }
2361
+ })
2362
+ }}
2363
+ >
2364
+ Add Anchor
2365
+ </button>
2366
+ </div>
2367
+ )}
2368
+ </AccordionItemPanel>
2369
+ </AccordionItem>
2370
+ )}
2371
+ <Panels.Regions name='Regions' />
2372
+ {/* Columns */}
2373
+ {config.visualizationType !== 'Box Plot' && (
2374
+ <AccordionItem>
2375
+ <AccordionItemHeading>
2376
+ <AccordionItemButton>Columns</AccordionItemButton>
2377
+ </AccordionItemHeading>
2378
+ <AccordionItemPanel>
2379
+ {'navigation' !== config.type && (
2380
+ <fieldset className='primary-fieldset edit-block'>
2381
+ <label>
2382
+ <span className='edit-label'>
2383
+ Additional Columns
2384
+ <Tooltip style={{ textTransform: 'none' }}>
2385
+ <Tooltip.Target>
2386
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2387
+ </Tooltip.Target>
2388
+ <Tooltip.Content>
2389
+ <p>You can specify additional columns to display in tooltips and / or the supporting data table.</p>
2390
+ </Tooltip.Content>
2391
+ </Tooltip>
2392
+ </span>
2393
+ </label>
2394
+ {additionalColumns.map(val => (
2395
+ <fieldset className='edit-block' key={val}>
2396
+ <button
2397
+ className='remove-column'
2398
+ onClick={event => {
2399
+ event.preventDefault()
2400
+ removeAdditionalColumn(val)
2500
2401
  }}
2501
2402
  >
2502
- <option value=''>Select series</option>
2503
- {config.series.map(series => (
2504
- <option>{series.dataKey}</option>
2505
- ))}
2506
- </select>
2507
- </label>
2508
- <TextField value={config.columns[val].label} section='columns' subsection={val} fieldName='label' label='Label' updateField={updateField} />
2509
- <ul className='column-edit'>
2510
- <li className='three-col'>
2511
- <TextField value={config.columns[val].prefix} section='columns' subsection={val} fieldName='prefix' label='Prefix' updateField={updateField} />
2512
- <TextField value={config.columns[val].suffix} section='columns' subsection={val} fieldName='suffix' label='Suffix' updateField={updateField} />
2513
- <TextField type='number' value={config.columns[val].roundToPlace} section='columns' subsection={val} fieldName='roundToPlace' label='Round' updateField={updateField} />
2514
- </li>
2515
- <li>
2516
- <label className='checkbox'>
2517
- <input
2518
- type='checkbox'
2519
- checked={config.columns[val].commas}
2520
- onChange={event => {
2521
- editColumn(val, 'commas', event.target.checked)
2522
- }}
2523
- />
2524
- <span className='edit-label'>Add Commas to Numbers</span>
2525
- </label>
2526
- </li>
2527
- <li>
2528
- {config.table.showVertical && (
2403
+ Remove
2404
+ </button>
2405
+ <label>
2406
+ <span className='edit-label column-heading'>Column</span>
2407
+ <select
2408
+ value={config.columns[val] ? config.columns[val].name : getColumns()[0]}
2409
+ onChange={event => {
2410
+ editColumn(val, 'name', event.target.value)
2411
+ }}
2412
+ >
2413
+ {getColumns().map(option => (
2414
+ <option>{option}</option>
2415
+ ))}
2416
+ </select>
2417
+ </label>
2418
+ <label>
2419
+ <span className='edit-label column-heading'>Associate to Series</span>
2420
+ <select
2421
+ value={config.columns[val] ? config.columns[val].series : ''}
2422
+ onChange={event => {
2423
+ editColumn(val, 'series', event.target.value)
2424
+ }}
2425
+ >
2426
+ <option value=''>Select series</option>
2427
+ {config.series.map(series => (
2428
+ <option>{series.dataKey}</option>
2429
+ ))}
2430
+ </select>
2431
+ </label>
2432
+ <TextField value={config.columns[val].label} section='columns' subsection={val} fieldName='label' label='Label' updateField={updateField} />
2433
+ <ul className='column-edit'>
2434
+ <li className='three-col'>
2435
+ <TextField value={config.columns[val].prefix} section='columns' subsection={val} fieldName='prefix' label='Prefix' updateField={updateField} />
2436
+ <TextField value={config.columns[val].suffix} section='columns' subsection={val} fieldName='suffix' label='Suffix' updateField={updateField} />
2437
+ <TextField type='number' value={config.columns[val].roundToPlace} section='columns' subsection={val} fieldName='roundToPlace' label='Round' updateField={updateField} />
2438
+ </li>
2439
+ <li>
2529
2440
  <label className='checkbox'>
2530
2441
  <input
2531
2442
  type='checkbox'
2532
- checked={config.columns[val].dataTable}
2443
+ checked={config.columns[val].commas}
2533
2444
  onChange={event => {
2534
- editColumn(val, 'dataTable', event.target.checked)
2445
+ editColumn(val, 'commas', event.target.checked)
2535
2446
  }}
2536
2447
  />
2537
- <span className='edit-label'>Show in Data Table</span>
2448
+ <span className='edit-label'>Add Commas to Numbers</span>
2538
2449
  </label>
2539
- )}
2540
- </li>
2541
- {/* disable for now */}
2542
-
2543
- <li>
2544
- <label className='checkbox'>
2545
- <input
2546
- type='checkbox'
2547
- checked={config.columns[val].tooltips || false}
2548
- onChange={event => {
2549
- updateSeriesTooltip(val, event.target.checked)
2550
- }}
2551
- />
2552
- <span className='edit-label'>Show in tooltip</span>
2553
- </label>
2554
- </li>
2555
-
2556
- {config.visualizationType === 'Forest Plot' && (
2557
- <>
2558
- <li>
2450
+ </li>
2451
+ <li>
2452
+ {config.table.showVertical && (
2559
2453
  <label className='checkbox'>
2560
2454
  <input
2561
2455
  type='checkbox'
2562
- checked={config.columns[val].forestPlot || false}
2456
+ checked={config.columns[val].dataTable}
2563
2457
  onChange={event => {
2564
- editColumn(val, 'forestPlot', event.target.checked)
2458
+ editColumn(val, 'dataTable', event.target.checked)
2565
2459
  }}
2566
2460
  />
2567
- <span className='edit-label'>Show in Forest Plot</span>
2461
+ <span className='edit-label'>Show in Data Table</span>
2568
2462
  </label>
2569
- </li>
2463
+ )}
2464
+ </li>
2465
+ {config.visualizationType === 'Pie' && (
2570
2466
  <li>
2571
2467
  <label className='checkbox'>
2572
2468
  <input
2573
2469
  type='checkbox'
2574
- checked={config.columns[val].forestPlotAlignRight || false}
2470
+ checked={config.columns[val].showInViz}
2575
2471
  onChange={event => {
2576
- editColumn(val, 'forestPlotAlignRight', event.target.checked)
2472
+ editColumn(val, 'showInViz', event.target.checked)
2577
2473
  }}
2578
2474
  />
2579
- <span className='edit-label'>Align Right</span>
2475
+ <span className='edit-label'>Show in Visualization</span>
2580
2476
  </label>
2581
2477
  </li>
2478
+ )}
2479
+
2480
+ {/* disable for now */}
2481
+
2482
+ <li>
2483
+ <label className='checkbox'>
2484
+ <input
2485
+ type='checkbox'
2486
+ checked={config.columns[val].tooltips || false}
2487
+ onChange={event => {
2488
+ updateSeriesTooltip(val, event.target.checked)
2489
+ }}
2490
+ />
2491
+ <span className='edit-label'>Show in tooltip</span>
2492
+ </label>
2493
+ </li>
2582
2494
 
2583
- {!config.columns[val].forestPlotAlignRight && (
2495
+ {config.visualizationType === 'Forest Plot' && (
2496
+ <>
2584
2497
  <li>
2585
- <label className='text'>
2586
- <span className='edit-label'>Forest Plot Starting Point</span>
2498
+ <label className='checkbox'>
2587
2499
  <input
2588
- type='number'
2589
- value={config.columns[val].forestPlotStartingPoint || 0}
2500
+ type='checkbox'
2501
+ checked={config.columns[val].forestPlot || false}
2590
2502
  onChange={event => {
2591
- editColumn(val, 'forestPlotStartingPoint', event.target.value)
2503
+ editColumn(val, 'forestPlot', event.target.checked)
2592
2504
  }}
2593
2505
  />
2506
+ <span className='edit-label'>Show in Forest Plot</span>
2594
2507
  </label>
2595
2508
  </li>
2596
- )}
2597
- </>
2598
- )}
2599
- </ul>
2600
- </fieldset>
2601
- ))}
2602
- <button
2603
- className={'btn full-width'}
2604
- onClick={event => {
2605
- event.preventDefault()
2606
- addAdditionalColumn(additionalColumns.length + 1)
2607
- }}
2608
- >
2609
- Add Column
2610
- </button>
2611
- </fieldset>
2612
- )}
2613
- {'category' === config.legend.type && (
2614
- <fieldset className='primary-fieldset edit-block'>
2615
- <label>
2616
- <span className='edit-label'>
2617
- Additional Category
2618
- <Tooltip style={{ textTransform: 'none' }}>
2619
- <Tooltip.Target>
2620
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2621
- </Tooltip.Target>
2622
- <Tooltip.Content>
2623
- <p>You can provide additional categories to ensure they appear in the legend</p>
2624
- </Tooltip.Content>
2625
- </Tooltip>
2626
- </span>
2627
- </label>
2628
- {config.legend.additionalCategories &&
2629
- config.legend.additionalCategories.map((val, i) => (
2630
- <fieldset className='edit-block' key={val}>
2631
- <button
2632
- className='remove-column'
2633
- onClick={event => {
2634
- event.preventDefault()
2635
- const updatedAdditionaCategories = [...config.legend.additionalCategories]
2636
- updatedAdditionaCategories.splice(i, 1)
2637
- updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
2638
- }}
2639
- >
2640
- Remove
2641
- </button>
2642
- <TextField
2643
- value={val}
2644
- label='Category'
2645
- section='legend'
2646
- subsection={null}
2647
- fieldName='additionalCategories'
2648
- updateField={(section, subsection, fieldName, value) => {
2649
- const updatedAdditionaCategories = [...config.legend.additionalCategories]
2650
- updatedAdditionaCategories[i] = value
2651
- updateField(section, subsection, fieldName, updatedAdditionaCategories)
2652
- }}
2653
- />
2509
+ <li>
2510
+ <label className='checkbox'>
2511
+ <input
2512
+ type='checkbox'
2513
+ checked={config.columns[val].forestPlotAlignRight || false}
2514
+ onChange={event => {
2515
+ editColumn(val, 'forestPlotAlignRight', event.target.checked)
2516
+ }}
2517
+ />
2518
+ <span className='edit-label'>Align Right</span>
2519
+ </label>
2520
+ </li>
2521
+
2522
+ {!config.columns[val].forestPlotAlignRight && (
2523
+ <li>
2524
+ <label className='text'>
2525
+ <span className='edit-label'>Forest Plot Starting Point</span>
2526
+ <input
2527
+ type='number'
2528
+ value={config.columns[val].forestPlotStartingPoint || 0}
2529
+ onChange={event => {
2530
+ editColumn(val, 'forestPlotStartingPoint', event.target.value)
2531
+ }}
2532
+ />
2533
+ </label>
2534
+ </li>
2535
+ )}
2536
+ </>
2537
+ )}
2538
+ </ul>
2654
2539
  </fieldset>
2655
2540
  ))}
2656
- <button
2657
- className={'btn full-width'}
2658
- onClick={event => {
2659
- event.preventDefault()
2660
- const updatedAdditionaCategories = [...(config.legend.additionalCategories || [])]
2661
- updatedAdditionaCategories.push('')
2662
- updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
2663
- }}
2664
- >
2665
- Add Category
2666
- </button>
2667
- </fieldset>
2668
- )}
2669
- </AccordionItemPanel>
2670
- </AccordionItem>
2671
- )}
2672
- {/* End Columns */}
2673
- {visHasLegend() && (
2674
- <AccordionItem>
2675
- <AccordionItemHeading>
2676
- <AccordionItemButton>Legend</AccordionItemButton>
2677
- </AccordionItemHeading>
2678
- <AccordionItemPanel>
2679
- <CheckBox value={config.legend.reverseLabelOrder} section='legend' fieldName='reverseLabelOrder' label='Reverse Labels' updateField={updateField} />
2680
- {/* <fieldset className="checkbox-group">
2541
+ <button
2542
+ className={'btn full-width'}
2543
+ onClick={event => {
2544
+ event.preventDefault()
2545
+ addAdditionalColumn(additionalColumns.length + 1)
2546
+ }}
2547
+ >
2548
+ Add Column
2549
+ </button>
2550
+ </fieldset>
2551
+ )}
2552
+ {'category' === config.legend.type && (
2553
+ <fieldset className='primary-fieldset edit-block'>
2554
+ <label>
2555
+ <span className='edit-label'>
2556
+ Additional Category
2557
+ <Tooltip style={{ textTransform: 'none' }}>
2558
+ <Tooltip.Target>
2559
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2560
+ </Tooltip.Target>
2561
+ <Tooltip.Content>
2562
+ <p>You can provide additional categories to ensure they appear in the legend</p>
2563
+ </Tooltip.Content>
2564
+ </Tooltip>
2565
+ </span>
2566
+ </label>
2567
+ {config.legend.additionalCategories &&
2568
+ config.legend.additionalCategories.map((val, i) => (
2569
+ <fieldset className='edit-block' key={val}>
2570
+ <button
2571
+ className='remove-column'
2572
+ onClick={event => {
2573
+ event.preventDefault()
2574
+ const updatedAdditionaCategories = [...config.legend.additionalCategories]
2575
+ updatedAdditionaCategories.splice(i, 1)
2576
+ updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
2577
+ }}
2578
+ >
2579
+ Remove
2580
+ </button>
2581
+ <TextField
2582
+ value={val}
2583
+ label='Category'
2584
+ section='legend'
2585
+ subsection={null}
2586
+ fieldName='additionalCategories'
2587
+ updateField={(section, subsection, fieldName, value) => {
2588
+ const updatedAdditionaCategories = [...config.legend.additionalCategories]
2589
+ updatedAdditionaCategories[i] = value
2590
+ updateField(section, subsection, fieldName, updatedAdditionaCategories)
2591
+ }}
2592
+ />
2593
+ </fieldset>
2594
+ ))}
2595
+ <button
2596
+ className={'btn full-width'}
2597
+ onClick={event => {
2598
+ event.preventDefault()
2599
+ const updatedAdditionaCategories = [...(config.legend.additionalCategories || [])]
2600
+ updatedAdditionaCategories.push('')
2601
+ updateField('legend', null, 'additionalCategories', updatedAdditionaCategories)
2602
+ }}
2603
+ >
2604
+ Add Category
2605
+ </button>
2606
+ </fieldset>
2607
+ )}
2608
+ </AccordionItemPanel>
2609
+ </AccordionItem>
2610
+ )}
2611
+ {/* End Columns */}
2612
+ {visHasLegend() && (
2613
+ <AccordionItem>
2614
+ <AccordionItemHeading>
2615
+ <AccordionItemButton>Legend</AccordionItemButton>
2616
+ </AccordionItemHeading>
2617
+ <AccordionItemPanel>
2618
+ <CheckBox value={config.legend.reverseLabelOrder} section='legend' fieldName='reverseLabelOrder' label='Reverse Labels' updateField={updateField} />
2619
+ {/* <fieldset className="checkbox-group">
2681
2620
  <CheckBox value={config.legend.dynamicLegend} section="legend" fieldName="dynamicLegend" label="Dynamic Legend" updateField={updateField}/>
2682
2621
  {config.legend.dynamicLegend && (
2683
2622
  <>
@@ -2688,57 +2627,128 @@ const EditorPanel = () => {
2688
2627
  </>
2689
2628
  )}
2690
2629
  </fieldset> */}
2691
- <CheckBox
2692
- value={config.legend.hide ? true : false}
2693
- section='legend'
2694
- fieldName='hide'
2695
- label='Hide Legend'
2696
- updateField={updateField}
2697
- tooltip={
2698
- <Tooltip style={{ textTransform: 'none' }}>
2699
- <Tooltip.Target>
2700
- <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
2701
- </Tooltip.Target>
2702
- <Tooltip.Content>
2703
- <p>With a single-series chart, consider hiding the legend to reduce visual clutter.</p>
2704
- </Tooltip.Content>
2705
- </Tooltip>
2706
- }
2707
- />
2708
- {/* {config.visualizationType === 'Box Plot' &&
2630
+ <CheckBox
2631
+ value={config.legend.hide ? true : false}
2632
+ section='legend'
2633
+ fieldName='hide'
2634
+ label='Hide Legend'
2635
+ updateField={updateField}
2636
+ tooltip={
2637
+ <Tooltip style={{ textTransform: 'none' }}>
2638
+ <Tooltip.Target>
2639
+ <Icon display='question' style={{ marginLeft: '0.5rem', display: 'inline-block', whiteSpace: 'nowrap' }} />
2640
+ </Tooltip.Target>
2641
+ <Tooltip.Content>
2642
+ <p>With a single-series chart, consider hiding the legend to reduce visual clutter.</p>
2643
+ </Tooltip.Content>
2644
+ </Tooltip>
2645
+ }
2646
+ />
2647
+ {/* {config.visualizationType === 'Box Plot' &&
2709
2648
  <>
2710
2649
  <CheckBox value={config.boxplot.legend.displayHowToReadText} fieldName='displayHowToReadText' section='boxplot' subsection='legend' label='Display How To Read Text' updateField={updateField} />
2711
2650
  <TextField type='textarea' value={config.boxplot.legend.howToReadText} updateField={updateField} fieldName='howToReadText' section='boxplot' subsection='legend' label='How to read text' />
2712
2651
  </>
2713
2652
  } */}
2714
- {config.visualizationType === 'Line' && <CheckBox value={config.legend.lineMode} section='legend' fieldName='lineMode' label='Show Lined Style Legend' updateField={updateField} />}
2715
- {config.visualizationType === 'Bar' && config.visualizationSubType === 'regular' && config.runtime.seriesKeys.length === 1 && (
2716
- <Select value={config.legend.colorCode} section='legend' fieldName='colorCode' label='Color code by category' initial='Select' updateField={updateField} options={getDataValueOptions(data)} />
2717
- )}
2718
- <Select value={config.legend.behavior} section='legend' fieldName='behavior' label='Legend Behavior (When clicked)' updateField={updateField} options={['highlight', 'isolate']} />
2719
- {config.legend.behavior === 'highlight' && config.tooltips.singleSeries && <CheckBox value={config.legend.highlightOnHover} section='legend' fieldName='highlightOnHover' label='HIGHLIGHT DATA SERIES ON HOVER' updateField={updateField} />}
2720
- <TextField value={config.legend.label} section='legend' fieldName='label' label='Title' updateField={updateField} />
2721
- <Select value={config.legend.position} section='legend' fieldName='position' label='Position' updateField={updateField} options={['right', 'left', 'bottom']} />
2722
- {config.legend.position === 'bottom' && (
2723
- <>
2724
- <CheckBox value={config.legend.singleRow} section='legend' fieldName='singleRow' label='Single Row Legend' updateField={updateField} />
2725
- <CheckBox value={config.legend.verticalSorted} section='legend' fieldName='verticalSorted' label='Vertical sorted Legend' updateField={updateField} />
2726
- </>
2727
- )}
2728
- <TextField type='textarea' value={config.legend.description} updateField={updateField} section='legend' fieldName='description' label='Legend Description' />
2729
- </AccordionItemPanel>
2730
- </AccordionItem>
2731
- )}
2732
- {visSupportsFilters() && (
2733
- <AccordionItem>
2734
- <AccordionItemHeading>
2735
- <AccordionItemButton>Filters</AccordionItemButton>
2736
- </AccordionItemHeading>
2737
- <AccordionItemPanel>
2738
- {config.filters && (
2739
- <>
2740
- {/* prettier-ignore */}
2741
- <Select
2653
+ {config.visualizationType === 'Line' && <CheckBox value={config.legend.lineMode} section='legend' fieldName='lineMode' label='Show Lined Style Legend' updateField={updateField} />}
2654
+ {config.visualizationType === 'Bar' && config.visualizationSubType === 'regular' && config.runtime.seriesKeys.length === 1 && (
2655
+ <Select value={config.legend.colorCode} section='legend' fieldName='colorCode' label='Color code by category' initial='Select' updateField={updateField} options={getDataValueOptions(data)} />
2656
+ )}
2657
+ <Select value={config.legend.behavior} section='legend' fieldName='behavior' label='Legend Behavior (When clicked)' updateField={(...[section, , fieldName, value]) => updateBehavior(section, fieldName, value)} options={['highlight', 'isolate']} />
2658
+ {visHasLegendAxisAlign() && <CheckBox value={config.legend.axisAlign} fieldName='axisAlign' section='legend' label='Align to Axis on Isolate' updateField={updateField} />}
2659
+
2660
+ {config.legend.behavior === 'highlight' && config.tooltips.singleSeries && <CheckBox value={config.legend.highlightOnHover} section='legend' fieldName='highlightOnHover' label='HIGHLIGHT DATA SERIES ON HOVER' updateField={updateField} />}
2661
+
2662
+ {/* start: isolated values */}
2663
+ {visHasSelectableLegendValues && config.legend.behavior === 'isolate' && !colorCodeByCategory && (
2664
+ <fieldset className='primary-fieldset edit-block' key={'additional-highlight-values'}>
2665
+ <label>
2666
+ <span className='edit-label'>
2667
+ Isolate Data Series
2668
+ <Tooltip style={{ textTransform: 'none' }}>
2669
+ <Tooltip.Target>
2670
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
2671
+ </Tooltip.Target>
2672
+ <Tooltip.Content>
2673
+ <p>You can choose data series that are shown on load. Others will be added when the user clicks on them in the legend.</p>
2674
+ </Tooltip.Content>
2675
+ </Tooltip>
2676
+ </span>
2677
+ </label>
2678
+ {config.legend.seriesHighlight &&
2679
+ config.legend.seriesHighlight.map((val, i) => (
2680
+ <fieldset className='edit-block' key={`${val}-${i}`}>
2681
+ <button
2682
+ className='remove-column'
2683
+ onClick={event => {
2684
+ event.preventDefault()
2685
+ const updatedSeriesHighlight = [...config.legend.seriesHighlight]
2686
+ updatedSeriesHighlight.splice(i, 1)
2687
+ updateField('legend', null, 'seriesHighlight', updatedSeriesHighlight)
2688
+ if (!updatedSeriesHighlight.length) {
2689
+ highlightReset()
2690
+ }
2691
+ }}
2692
+ >
2693
+ Remove
2694
+ </button>
2695
+ <Select
2696
+ value={config.legend.seriesHighlight[i]}
2697
+ fieldName='seriesHighlight'
2698
+ label='Isolate Value'
2699
+ onChange={e => {
2700
+ const updatedSeriesHighlight = [...config.legend.seriesHighlight]
2701
+ if (!updatedSeriesHighlight.includes(e.target.value)) {
2702
+ updatedSeriesHighlight[i] = e.target.value
2703
+ updateSeriesIsolateValues([...updatedSeriesHighlight])
2704
+ }
2705
+ }}
2706
+ options={getLegendColumns()}
2707
+ />
2708
+ </fieldset>
2709
+ ))}
2710
+ <button
2711
+ className={'btn full-width'}
2712
+ onClick={event => {
2713
+ event.preventDefault()
2714
+ const legendColumns = getLegendColumns()
2715
+ const updatedSeriesHighlight = [...config.legend.seriesHighlight]
2716
+ const seriesLength = updatedSeriesHighlight.length
2717
+ if (seriesLength < legendColumns.length) {
2718
+ const [newSeriesHighlight] = legendColumns.filter(d => !updatedSeriesHighlight.includes(d))
2719
+ updatedSeriesHighlight.push(newSeriesHighlight)
2720
+ updateSeriesIsolateValues([...updatedSeriesHighlight])
2721
+ }
2722
+ }}
2723
+ >
2724
+ Add Isolate Value
2725
+ </button>
2726
+ </fieldset>
2727
+ )}
2728
+ {/* end: isolated values */}
2729
+
2730
+ <TextField value={config.legend.label} section='legend' fieldName='label' label='Title' updateField={updateField} />
2731
+ <Select value={config.legend.position} section='legend' fieldName='position' label='Position' updateField={updateField} options={['right', 'left', 'bottom']} />
2732
+ {config.legend.position === 'bottom' && (
2733
+ <>
2734
+ <CheckBox value={config.legend.singleRow} section='legend' fieldName='singleRow' label='Single Row Legend' updateField={updateField} />
2735
+ <CheckBox value={config.legend.verticalSorted} section='legend' fieldName='verticalSorted' label='Vertical sorted Legend' updateField={updateField} />
2736
+ </>
2737
+ )}
2738
+ <TextField type='textarea' value={config.legend.description} updateField={updateField} section='legend' fieldName='description' label='Legend Description' />
2739
+ </AccordionItemPanel>
2740
+ </AccordionItem>
2741
+ )}
2742
+ {visSupportsFilters() && (
2743
+ <AccordionItem>
2744
+ <AccordionItemHeading>
2745
+ <AccordionItemButton>Filters</AccordionItemButton>
2746
+ </AccordionItemHeading>
2747
+ <AccordionItemPanel>
2748
+ {config.filters && (
2749
+ <>
2750
+ {/* prettier-ignore */}
2751
+ <Select
2742
2752
  value={config.filterBehavior}
2743
2753
  fieldName='filterBehavior'
2744
2754
  label='Filter Behavior'
@@ -2755,417 +2765,163 @@ const EditorPanel = () => {
2755
2765
  </Tooltip>
2756
2766
  }
2757
2767
  />
2758
- <br />
2759
- </>
2760
- )}
2761
- {config.filters && (
2762
- <ul className='filters-list'>
2763
- {/* Whether filters should apply onChange or Apply Button */}
2764
-
2765
- {config.filters.map((filter, index) => {
2766
- if (filter.type === 'url') return <></>
2767
-
2768
- return (
2769
- <fieldset className='edit-block' key={index}>
2770
- <button
2771
- type='button'
2772
- className='remove-column'
2773
- onClick={() => {
2774
- removeFilter(index)
2775
- }}
2776
- >
2777
- Remove
2778
- </button>
2779
- <label>
2780
- <span className='edit-label column-heading'>Filter</span>
2781
- <select
2782
- value={filter.columnName}
2783
- onChange={e => {
2784
- updateFilterProp('columnName', index, e.target.value)
2785
- }}
2786
- >
2787
- <option value=''>- Select Option -</option>
2788
- {getFilters().map((dataKey, index) => (
2789
- <option value={dataKey} key={index}>
2790
- {dataKey}
2791
- </option>
2792
- ))}
2793
- </select>
2794
- </label>
2795
-
2796
- <label>
2797
- <span className='edit-showDropdown column-heading'>Show Filter Input</span>
2798
- <input
2799
- type='checkbox'
2800
- checked={filter.showDropdown === undefined ? true : filter.showDropdown}
2801
- onChange={e => {
2802
- updateFilterProp('showDropdown', index, e.target.checked)
2803
- }}
2804
- />
2805
- </label>
2768
+ <br />
2769
+ </>
2770
+ )}
2771
+ {config.filters && (
2772
+ <ul className='filters-list'>
2773
+ {/* Whether filters should apply onChange or Apply Button */}
2806
2774
 
2807
- <label>
2808
- <span className='edit-label column-heading'>Filter Style</span>
2775
+ {config.filters.map((filter, index) => {
2776
+ if (filter.type === 'url') return <></>
2809
2777
 
2810
- <select
2811
- value={filter.filterStyle}
2812
- onChange={e => {
2813
- updateFilterProp('filterStyle', index, e.target.value)
2778
+ return (
2779
+ <fieldset className='edit-block' key={index}>
2780
+ <button
2781
+ type='button'
2782
+ className='remove-column'
2783
+ onClick={() => {
2784
+ removeFilter(index)
2814
2785
  }}
2815
2786
  >
2816
- {filterStyleOptions.map((item, index) => {
2817
- return (
2818
- <option key={`filter-style-${index}`} value={item}>
2819
- {item}
2820
- </option>
2821
- )
2822
- })}
2823
- </select>
2824
- </label>
2825
- <label>
2826
- <span className='edit-label column-heading'>Label</span>
2827
- <input
2828
- type='text'
2829
- value={filter.label}
2830
- onChange={e => {
2831
- updateFilterProp('label', index, e.target.value)
2832
- }}
2833
- />
2834
- </label>
2835
-
2836
- <label>
2837
- <span className='edit-filterOrder column-heading'>Filter Order</span>
2838
- <select value={filter.order ? filter.order : 'asc'} onChange={e => updateFilterProp('order', index, e.target.value)}>
2839
- {filterOrderOptions.map((option, index) => {
2840
- return (
2841
- <option value={option.value} key={`filter-${index}`}>
2842
- {option.label}
2787
+ Remove
2788
+ </button>
2789
+ <label>
2790
+ <span className='edit-label column-heading'>Filter</span>
2791
+ <select
2792
+ value={filter.columnName}
2793
+ onChange={e => {
2794
+ updateFilterProp('columnName', index, e.target.value)
2795
+ }}
2796
+ >
2797
+ <option value=''>- Select Option -</option>
2798
+ {getFilters().map((dataKey, index) => (
2799
+ <option value={dataKey} key={index}>
2800
+ {dataKey}
2843
2801
  </option>
2844
- )
2845
- })}
2846
- </select>
2847
-
2848
- {filter.order === 'cust' && (
2849
- <DragDropContext onDragEnd={({ source, destination }) => handleFilterOrder(source.index, destination.index, index, config.filters[index])}>
2850
- <Droppable droppableId='filter_order'>
2851
- {provided => (
2852
- <ul {...provided.droppableProps} className='sort-list' ref={provided.innerRef} style={{ marginTop: '1em' }}>
2853
- {config.filters[index]?.values.map((value, index) => {
2854
- return (
2855
- <Draggable key={value} draggableId={`draggableFilter-${value}`} index={index}>
2856
- {(provided, snapshot) => (
2857
- <li>
2858
- <div className={snapshot.isDragging ? 'currently-dragging' : ''} style={getItemStyle(snapshot.isDragging, provided.draggableProps.style)} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps}>
2859
- {value}
2860
- </div>
2861
- </li>
2862
- )}
2863
- </Draggable>
2864
- )
2865
- })}
2866
- {provided.placeholder}
2867
- </ul>
2868
- )}
2869
- </Droppable>
2870
- </DragDropContext>
2871
- )}
2872
- </label>
2873
- </fieldset>
2874
- )
2875
- })}
2876
- </ul>
2877
- )}
2878
- {!config.filters && <p style={{ textAlign: 'center' }}>There are currently no filters.</p>}
2879
- <button type='button' onClick={addNewFilter} className='btn full-width'>
2880
- Add Filter
2881
- </button>
2882
- </AccordionItemPanel>
2883
- </AccordionItem>
2884
- )}
2885
- <AccordionItem>
2886
- <AccordionItemHeading>
2887
- <AccordionItemButton>Visual</AccordionItemButton>
2888
- </AccordionItemHeading>
2889
- <AccordionItemPanel>
2890
- {config.isLollipopChart && (
2891
- <>
2892
- <fieldset className='header'>
2893
- <legend className='edit-label'>Lollipop Shape</legend>
2894
- <div
2895
- onChange={e => {
2896
- setLollipopShape(e.target.value)
2897
- }}
2898
- >
2899
- <label className='radio-label'>
2900
- <input type='radio' name='lollipopShape' value='circle' checked={config.lollipopShape === 'circle'} />
2901
- Circle
2902
- </label>
2903
- <label className='radio-label'>
2904
- <input type='radio' name='lollipopShape' value='square' checked={config.lollipopShape === 'square'} />
2905
- Square
2906
- </label>
2907
- </div>
2908
- </fieldset>
2909
- <Select value={config.lollipopColorStyle ? config.lollipopColorStyle : 'two-tone'} fieldName='lollipopColorStyle' label='Lollipop Color Style' updateField={updateField} options={['regular', 'two-tone']} />
2910
- <Select value={config.lollipopSize ? config.lollipopSize : 'small'} fieldName='lollipopSize' label='Lollipop Size' updateField={updateField} options={['small', 'medium', 'large']} />
2911
- </>
2912
- )}
2913
-
2914
- {config.visualizationType === 'Box Plot' && (
2915
- <fieldset className='fieldset fieldset--boxplot'>
2916
- <legend className=''>Box Plot Settings</legend>
2917
- <Select value={config.boxplot.borders} fieldName='borders' section='boxplot' label='Box Plot Borders' updateField={updateField} options={['true', 'false']} />
2918
- <CheckBox value={config.boxplot.plotOutlierValues} fieldName='plotOutlierValues' section='boxplot' label='Plot Outliers' updateField={updateField} />
2919
- <CheckBox value={config.boxplot.plotNonOutlierValues} fieldName='plotNonOutlierValues' section='boxplot' label='Plot non-outlier values' updateField={updateField} />
2920
- </fieldset>
2921
- )}
2922
-
2923
- <Select value={config.fontSize} fieldName='fontSize' label='Font Size' updateField={updateField} options={['small', 'medium', 'large']} />
2924
- {visHasBarBorders() && <Select value={config.barHasBorder} fieldName='barHasBorder' label='Bar Borders' updateField={updateField} options={['true', 'false']} />}
2925
- {visCanAnimate() && <CheckBox value={config.animate} fieldName='animate' label='Animate Visualization' updateField={updateField} />}
2926
-
2927
- {/*<CheckBox value={config.animateReplay} fieldName="animateReplay" label="Replay Animation When Filters Are Changed" updateField={updateField} />*/}
2928
-
2929
- {((config.series?.some(series => series.type === 'Line' || series.type === 'dashed-lg' || series.type === 'dashed-sm' || series.type === 'dashed-md') && config.visualizationType === 'Combo') || config.visualizationType === 'Line') && (
2930
- <>
2931
- <Select value={config.lineDatapointStyle} fieldName='lineDatapointStyle' label='Line Datapoint Style' updateField={updateField} options={['hidden', 'hover', 'always show']} />
2932
- <Select value={config.lineDatapointColor} fieldName='lineDatapointColor' label='Line Datapoint Color' updateField={updateField} options={['Same as Line', 'Lighter than Line']} />
2933
- </>
2934
- )}
2935
-
2936
- {/* eslint-disable */}
2937
- <label className='header'>
2938
- <span className='edit-label'>Header Theme</span>
2939
- <ul className='color-palette'>
2940
- {headerColors.map(palette => (
2941
- <button
2942
- title={palette}
2943
- key={palette}
2944
- onClick={e => {
2945
- e.preventDefault()
2946
- updateConfig({ ...config, theme: palette })
2947
- }}
2948
- className={config.theme === palette ? 'selected ' + palette : palette}
2949
- ></button>
2950
- ))}
2951
- </ul>
2952
- </label>
2953
- {/* eslint-enable */}
2954
- {(visSupportsNonSequentialPallete() || visSupportsNonSequentialPallete()) && (
2955
- <>
2956
- <label>
2957
- <span className='edit-label'>Chart Color Palette</span>
2958
- </label>
2959
- {visSupportsReverseColorPalette() && <InputToggle fieldName='isPaletteReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={config.isPaletteReversed} />}
2960
- {visSupportsSequentialPallete() && (
2961
- <>
2962
- <span>Sequential</span>
2963
- <ul className='color-palette'>
2964
- {sequential.map(palette => {
2965
- const colorOne = {
2966
- backgroundColor: colorPalettes[palette][2]
2967
- }
2802
+ ))}
2803
+ </select>
2804
+ </label>
2968
2805
 
2969
- const colorTwo = {
2970
- backgroundColor: colorPalettes[palette][3]
2971
- }
2806
+ <label>
2807
+ <span className='edit-showDropdown column-heading'>Show Filter Input</span>
2808
+ <input
2809
+ type='checkbox'
2810
+ checked={filter.showDropdown === undefined ? true : filter.showDropdown}
2811
+ onChange={e => {
2812
+ updateFilterProp('showDropdown', index, e.target.checked)
2813
+ }}
2814
+ />
2815
+ </label>
2972
2816
 
2973
- const colorThree = {
2974
- backgroundColor: colorPalettes[palette][5]
2975
- }
2817
+ <label>
2818
+ <span className='edit-label column-heading'>Filter Style</span>
2976
2819
 
2977
- return (
2978
- <button
2979
- title={palette}
2980
- key={palette}
2981
- onClick={e => {
2982
- e.preventDefault()
2983
- updateConfig({ ...config, palette })
2984
- }}
2985
- className={config.palette === palette ? 'selected' : ''}
2986
- >
2987
- <span style={colorOne}></span>
2988
- <span style={colorTwo}></span>
2989
- <span style={colorThree}></span>
2990
- </button>
2991
- )
2992
- })}
2993
- </ul>
2994
- </>
2995
- )}
2996
- {visSupportsNonSequentialPallete() && (
2997
- <>
2998
- <span>Non-Sequential</span>
2999
- <ul className='color-palette'>
3000
- {nonSequential.map(palette => {
3001
- const colorOne = {
3002
- backgroundColor: colorPalettes[palette][2]
3003
- }
2820
+ <select
2821
+ value={filter.filterStyle}
2822
+ onChange={e => {
2823
+ updateFilterProp('filterStyle', index, e.target.value)
2824
+ }}
2825
+ >
2826
+ {filterStyleOptions.map((item, index) => {
2827
+ return (
2828
+ <option key={`filter-style-${index}`} value={item}>
2829
+ {item}
2830
+ </option>
2831
+ )
2832
+ })}
2833
+ </select>
2834
+ </label>
2835
+ <label>
2836
+ <span className='edit-label column-heading'>Label</span>
2837
+ <input
2838
+ type='text'
2839
+ value={filter.label}
2840
+ onChange={e => {
2841
+ updateFilterProp('label', index, e.target.value)
2842
+ }}
2843
+ />
2844
+ </label>
3004
2845
 
3005
- const colorTwo = {
3006
- backgroundColor: colorPalettes[palette][4]
3007
- }
2846
+ <label>
2847
+ <span className='edit-label column-heading'>Default Value Set By Query String Parameter</span>
2848
+ <input
2849
+ type='text'
2850
+ value={filter.setByQueryParameter}
2851
+ onChange={e => {
2852
+ updateFilterProp('setByQueryParameter', index, e.target.value)
2853
+ }}
2854
+ />
2855
+ </label>
3008
2856
 
3009
- const colorThree = {
3010
- backgroundColor: colorPalettes[palette][6]
3011
- }
2857
+ <label>
2858
+ <span className='edit-filterOrder column-heading'>Filter Order</span>
2859
+ <select value={filter.order ? filter.order : 'asc'} onChange={e => updateFilterProp('order', index, e.target.value)}>
2860
+ {filterOrderOptions.map((option, index) => {
2861
+ return (
2862
+ <option value={option.value} key={`filter-${index}`}>
2863
+ {option.label}
2864
+ </option>
2865
+ )
2866
+ })}
2867
+ </select>
3012
2868
 
3013
- return (
3014
- <button
3015
- title={palette}
3016
- key={palette}
3017
- onClick={e => {
3018
- e.preventDefault()
3019
- updateConfig({ ...config, palette })
3020
- }}
3021
- className={config.palette === palette ? 'selected' : ''}
3022
- >
3023
- <span style={colorOne}></span>
3024
- <span style={colorTwo}></span>
3025
- <span style={colorThree}></span>
3026
- </button>
3027
- )
3028
- })}
3029
- </ul>
3030
- </>
2869
+ {filter.order === 'cust' && (
2870
+ <DragDropContext onDragEnd={({ source, destination }) => handleFilterOrder(source.index, destination.index, index, config.filters[index])}>
2871
+ <Droppable droppableId='filter_order'>
2872
+ {provided => (
2873
+ <ul {...provided.droppableProps} className='sort-list' ref={provided.innerRef} style={{ marginTop: '1em' }}>
2874
+ {config.filters[index]?.values.map((value, index) => {
2875
+ return (
2876
+ <Draggable key={value} draggableId={`draggableFilter-${value}`} index={index}>
2877
+ {(provided, snapshot) => (
2878
+ <li>
2879
+ <div className={snapshot.isDragging ? 'currently-dragging' : ''} style={getItemStyle(snapshot.isDragging, provided.draggableProps.style)} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps}>
2880
+ {value}
2881
+ </div>
2882
+ </li>
2883
+ )}
2884
+ </Draggable>
2885
+ )
2886
+ })}
2887
+ {provided.placeholder}
2888
+ </ul>
2889
+ )}
2890
+ </Droppable>
2891
+ </DragDropContext>
2892
+ )}
2893
+ </label>
2894
+ </fieldset>
2895
+ )
2896
+ })}
2897
+ </ul>
3031
2898
  )}
3032
- </>
3033
- )}
3034
- {(config.visualizationType === 'Paired Bar' || config.visualizationType === 'Deviation Bar') && (
3035
- <>
3036
- <InputToggle section='twoColor' fieldName='isPaletteReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={config.twoColor.isPaletteReversed} />
3037
- <ul className='color-palette'>
3038
- {twoColorPalettes.map(palette => {
3039
- const colorOne = {
3040
- backgroundColor: twoColorPalette[palette][0]
3041
- }
3042
-
3043
- const colorTwo = {
3044
- backgroundColor: twoColorPalette[palette][1]
3045
- }
3046
-
3047
- return (
3048
- <button
3049
- title={palette}
3050
- key={palette}
3051
- onClick={e => {
3052
- e.preventDefault()
3053
- updateConfig({ ...config, twoColor: { ...config.twoColor, palette } })
3054
- }}
3055
- className={config.twoColor.palette === palette ? 'selected' : ''}
3056
- >
3057
- <span className='two-color' style={colorOne}></span>
3058
- <span className='two-color' style={colorTwo}></span>
3059
- </button>
3060
- )
3061
- })}
3062
- </ul>
3063
- </>
3064
- )}
3065
-
3066
- {visHasDataCutoff() && (
3067
- <>
3068
- <TextField
3069
- value={config.dataCutoff}
3070
- type='number'
3071
- fieldName='dataCutoff'
3072
- className='number-narrow'
3073
- label='Data Cutoff'
3074
- updateField={updateField}
3075
- tooltip={
3076
- <Tooltip style={{ textTransform: 'none' }}>
3077
- <Tooltip.Target>
3078
- <Icon display='question' style={{ marginLeft: '0.5rem' }} />
3079
- </Tooltip.Target>
3080
- <Tooltip.Content>
3081
- <p>Any value below the cut-off value is included in a special "less than" category. This option supports special conditions like suppressed data.</p>
3082
- </Tooltip.Content>
3083
- </Tooltip>
3084
- }
3085
- />
3086
- </>
3087
- )}
3088
- {visSupportsBarThickness() && 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} />}
3089
- {((config.visualizationType === 'Bar' && config.orientation !== 'horizontal') || config.visualizationType === 'Combo') && <TextField value={config.barThickness} type='number' fieldName='barThickness' label='Bar Thickness' updateField={updateField} />}
3090
- {visSupportsBarSpace() && <TextField type='number' value={config.barSpace || '15'} fieldName='barSpace' label='Bar Space' updateField={updateField} min={0} />}
3091
- {(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} />}
3092
-
3093
- {config.visualizationType === 'Spark Line' && (
3094
- <div className='cove-accordion__panel-section checkbox-group'>
3095
- <CheckBox value={config.visual?.border} section='visual' fieldName='border' label='Show Border' updateField={updateField} />
3096
- <CheckBox value={config.visual?.borderColorTheme} section='visual' fieldName='borderColorTheme' label='Use Border Color Theme' updateField={updateField} />
3097
- <CheckBox value={config.visual?.accent} section='visual' fieldName='accent' label='Use Accent Style' updateField={updateField} />
3098
- <CheckBox value={config.visual?.background} section='visual' fieldName='background' label='Use Theme Background Color' updateField={updateField} />
3099
- <CheckBox value={config.visual?.hideBackgroundColor} section='visual' fieldName='hideBackgroundColor' label='Hide Background Color' updateField={updateField} />
3100
- </div>
3101
- )}
3102
-
3103
- {(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && <CheckBox value={config.showLineSeriesLabels} fieldName='showLineSeriesLabels' label='Append Series Name to End of Line Charts' updateField={updateField} />}
3104
- {(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && config.showLineSeriesLabels && (
3105
- <CheckBox value={config.colorMatchLineSeriesLabels} fieldName='colorMatchLineSeriesLabels' label='Match Series Color to Name at End of Line Charts' updateField={updateField} />
3106
- )}
3107
-
3108
- {visSupportsTooltipLines() && (
3109
- <>
3110
- <CheckBox value={config.visual.verticalHoverLine} fieldName='verticalHoverLine' section='visual' label='Vertical Hover Line' updateField={updateField} />
3111
- <CheckBox value={config.visual.horizontalHoverLine} fieldName='horizontalHoverLine' section='visual' label='Horizontal Hover Line' updateField={updateField} />
3112
- </>
3113
- )}
3114
- {visSupportsTooltipOpacity() && (
3115
- <label>
3116
- <span className='edit-label column-heading'>Tooltip Opacity</span>
3117
- <input
3118
- type='number'
3119
- value={config.tooltips.opacity ? config.tooltips.opacity : 100}
3120
- onChange={e =>
3121
- updateConfig({
3122
- ...config,
3123
- tooltips: {
3124
- ...config.tooltips,
3125
- opacity: e.target.value
3126
- }
3127
- })
3128
- }
3129
- />
3130
- </label>
3131
- )}
3132
- {config.visualizationType === 'Bar' && <CheckBox value={config.tooltips.singleSeries} fieldName='singleSeries' section='tooltips' label='SHOW HOVER FOR SINGLE DATA SERIES' updateField={updateField} />}
3133
-
3134
- <label>
3135
- <span className='edit-label column-heading'>No Data Message</span>
3136
- <input
3137
- type='text'
3138
- value={config.chartMessage.noData ? config.chartMessage.noData : ''}
3139
- onChange={e =>
3140
- updateConfig({
3141
- ...config,
3142
- chartMessage: {
3143
- ...config.chartMessage,
3144
- noData: e.target.value
3145
- }
3146
- })
3147
- }
3148
- />
3149
- </label>
3150
- </AccordionItemPanel>
3151
- </AccordionItem>
3152
- {/* Spark Line has no data table */}
3153
- {config.visualizationType !== 'Spark Line' && (
3154
- <AccordionItem>
3155
- <AccordionItemHeading>
3156
- <AccordionItemButton>Data Table</AccordionItemButton>
3157
- </AccordionItemHeading>
3158
- <AccordionItemPanel>
3159
- <DataTableEditor config={config} columns={Object.keys(data[0] || {})} updateField={updateField} isDashboard={isDashboard} isLoadedFromUrl={isLoadedFromUrl} />{' '}
3160
- </AccordionItemPanel>
3161
- </AccordionItem>
3162
- )}
3163
- {/* {(config.visualizationType === 'Bar' || config.visualizationType === 'Line') && <Panels.DateHighlighting name='Date Highlighting' />} */}
3164
- </Accordion>
3165
- {config.type !== 'Spark Line' && <AdvancedEditor loadConfig={updateConfig} state={config} convertStateToConfig={convertStateToConfig} />}
2899
+ {!config.filters && <p style={{ textAlign: 'center' }}>There are currently no filters.</p>}
2900
+ <button type='button' onClick={addNewFilter} className='btn full-width'>
2901
+ Add Filter
2902
+ </button>
2903
+ </AccordionItemPanel>
2904
+ </AccordionItem>
2905
+ )}
2906
+ <Panels.Visual name='Visual' />
2907
+ {/* Spark Line has no data table */}
2908
+ {config.visualizationType !== 'Spark Line' && (
2909
+ <AccordionItem>
2910
+ <AccordionItemHeading>
2911
+ <AccordionItemButton>Data Table</AccordionItemButton>
2912
+ </AccordionItemHeading>
2913
+ <AccordionItemPanel>
2914
+ <DataTableEditor config={config} columns={Object.keys(data[0] || {})} updateField={updateField} isDashboard={isDashboard} isLoadedFromUrl={isLoadedFromUrl} />{' '}
2915
+ </AccordionItemPanel>
2916
+ </AccordionItem>
2917
+ )}
2918
+ {/* {(config.visualizationType === 'Bar' || config.visualizationType === 'Line') && <Panels.DateHighlighting name='Date Highlighting' />} */}
2919
+ </Accordion>
2920
+ {config.type !== 'Spark Line' && <AdvancedEditor loadConfig={updateConfig} state={config} convertStateToConfig={convertStateToConfig} />}
2921
+ </section>
3166
2922
  </section>
3167
- </section>
3168
- </ErrorBoundary>
2923
+ </ErrorBoundary>
2924
+ </EditorPanelContext.Provider>
3169
2925
  )
3170
2926
  }
3171
2927