@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
@@ -0,0 +1,338 @@
1
+ import { useContext, FC } from 'react'
2
+
3
+ // external libraries
4
+ import { AccordionItem, AccordionItemHeading, AccordionItemPanel, AccordionItemButton } from 'react-accessible-accordion'
5
+
6
+ // core
7
+ import { TextField, Select, CheckBox } from '@cdc/core/components/EditorPanel/Inputs'
8
+ import Tooltip from '@cdc/core/components/ui/Tooltip'
9
+ import Icon from '@cdc/core/components/ui/Icon'
10
+ import InputToggle from '@cdc/core/components/inputs/InputToggle'
11
+
12
+ // contexts
13
+ import { useColorPalette } from '../../../../hooks/useColorPalette'
14
+ import { ChartContext } from './../../../../types/ChartContext.js'
15
+
16
+ import { useEditorPermissions } from '../../useEditorPermissions.js'
17
+ import { useEditorPanelContext } from '../../EditorPanelContext.js'
18
+ import ConfigContext from '../../../../ConfigContext.js'
19
+ import { PanelProps } from '../PanelProps'
20
+
21
+ const PanelVisual: FC<PanelProps> = props => {
22
+ const { config, updateConfig, colorPalettes, twoColorPalette } = useContext<ChartContext>(ConfigContext)
23
+ const { visual } = config
24
+ const { setLollipopShape, updateField } = useEditorPanelContext()
25
+ const { visHasBarBorders, visCanAnimate, visSupportsNonSequentialPallete, headerColors, visSupportsTooltipOpacity, visSupportsTooltipLines, visSupportsBarSpace, visSupportsBarThickness, visHasDataCutoff, visSupportsSequentialPallete, visSupportsReverseColorPalette } = useEditorPermissions()
26
+ const { twoColorPalettes, sequential, nonSequential } = useColorPalette(config, updateConfig)
27
+
28
+ const updateColor = (property, _value) => {
29
+ console.log('value', _value)
30
+ if (property === 'storyNodeFontColor') {
31
+ updateConfig({
32
+ ...config,
33
+ sankey: {
34
+ ...config.sankey,
35
+ storyNodeFontColor: _value
36
+ }
37
+ })
38
+ return
39
+ } else {
40
+ updateConfig({
41
+ ...config,
42
+ sankey: {
43
+ ...config.sankey,
44
+ [property]: {
45
+ ...config.sankey[property],
46
+ default: _value
47
+ }
48
+ }
49
+ })
50
+ }
51
+ }
52
+
53
+ return (
54
+ <AccordionItem>
55
+ <AccordionItemHeading>
56
+ <AccordionItemButton>Visual</AccordionItemButton>
57
+ </AccordionItemHeading>
58
+ <AccordionItemPanel>
59
+ {config.isLollipopChart && (
60
+ <>
61
+ <fieldset className='header'>
62
+ <legend className='edit-label'>Lollipop Shape</legend>
63
+ <div
64
+ onChange={e => {
65
+ setLollipopShape(e.target.value)
66
+ }}
67
+ >
68
+ <label className='radio-label'>
69
+ <input type='radio' name='lollipopShape' value='circle' checked={config.lollipopShape === 'circle'} />
70
+ Circle
71
+ </label>
72
+ <label className='radio-label'>
73
+ <input type='radio' name='lollipopShape' value='square' checked={config.lollipopShape === 'square'} />
74
+ Square
75
+ </label>
76
+ </div>
77
+ </fieldset>
78
+ <Select value={config.lollipopColorStyle ? config.lollipopColorStyle : 'two-tone'} fieldName='lollipopColorStyle' label='Lollipop Color Style' updateField={updateField} options={['regular', 'two-tone']} />
79
+ <Select value={config.lollipopSize ? config.lollipopSize : 'small'} fieldName='lollipopSize' label='Lollipop Size' updateField={updateField} options={['small', 'medium', 'large']} />
80
+ </>
81
+ )}
82
+
83
+ {config.visualizationType === 'Box Plot' && (
84
+ <fieldset className='fieldset fieldset--boxplot'>
85
+ <legend className=''>Box Plot Settings</legend>
86
+ <Select value={config.boxplot.borders} fieldName='borders' section='boxplot' label='Box Plot Borders' updateField={updateField} options={['true', 'false']} />
87
+ <CheckBox value={config.boxplot.plotOutlierValues} fieldName='plotOutlierValues' section='boxplot' label='Plot Outliers' updateField={updateField} />
88
+ <CheckBox value={config.boxplot.plotNonOutlierValues} fieldName='plotNonOutlierValues' section='boxplot' label='Plot non-outlier values' updateField={updateField} />
89
+ </fieldset>
90
+ )}
91
+
92
+ <Select value={config.fontSize} fieldName='fontSize' label='Font Size' updateField={updateField} options={['small', 'medium', 'large']} />
93
+ {visHasBarBorders() && <Select value={config.barHasBorder} fieldName='barHasBorder' label='Bar Borders' updateField={updateField} options={['true', 'false']} />}
94
+ {visCanAnimate() && <CheckBox value={config.animate} fieldName='animate' label='Animate Visualization' updateField={updateField} />}
95
+
96
+ {/*<CheckBox value={config.animateReplay} fieldName="animateReplay" label="Replay Animation When Filters Are Changed" updateField={updateField} />*/}
97
+
98
+ {((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') && (
99
+ <>
100
+ <Select value={config.lineDatapointStyle} fieldName='lineDatapointStyle' label='Line Datapoint Style' updateField={updateField} options={['hidden', 'hover', 'always show']} />
101
+ <Select value={config.lineDatapointColor} fieldName='lineDatapointColor' label='Line Datapoint Color' updateField={updateField} options={['Same as Line', 'Lighter than Line']} />
102
+ </>
103
+ )}
104
+
105
+ {/* eslint-disable */}
106
+ <label className='header'>
107
+ <span className='edit-label'>Header Theme</span>
108
+ <ul className='color-palette'>
109
+ {headerColors.map(palette => (
110
+ <button
111
+ title={palette}
112
+ key={palette}
113
+ onClick={e => {
114
+ e.preventDefault()
115
+ updateConfig({ ...config, theme: palette })
116
+ }}
117
+ className={config.theme === palette ? 'selected ' + palette : palette}
118
+ ></button>
119
+ ))}
120
+ </ul>
121
+ </label>
122
+ {/* eslint-enable */}
123
+ {(visSupportsNonSequentialPallete() || visSupportsNonSequentialPallete()) && (
124
+ <>
125
+ <label>
126
+ <span className='edit-label'>Chart Color Palette</span>
127
+ </label>
128
+ {visSupportsReverseColorPalette() && <InputToggle fieldName='isPaletteReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={config.isPaletteReversed} />}
129
+ {visSupportsSequentialPallete() && (
130
+ <>
131
+ <span>Sequential</span>
132
+ <ul className='color-palette'>
133
+ {sequential.map(palette => {
134
+ const colorOne = {
135
+ backgroundColor: colorPalettes[palette][2]
136
+ }
137
+
138
+ const colorTwo = {
139
+ backgroundColor: colorPalettes[palette][3]
140
+ }
141
+
142
+ const colorThree = {
143
+ backgroundColor: colorPalettes[palette][5]
144
+ }
145
+
146
+ return (
147
+ <button
148
+ title={palette}
149
+ key={palette}
150
+ onClick={e => {
151
+ e.preventDefault()
152
+ updateConfig({ ...config, palette })
153
+ }}
154
+ className={config.palette === palette ? 'selected' : ''}
155
+ >
156
+ <span style={colorOne}></span>
157
+ <span style={colorTwo}></span>
158
+ <span style={colorThree}></span>
159
+ </button>
160
+ )
161
+ })}
162
+ </ul>
163
+ </>
164
+ )}
165
+ {visSupportsNonSequentialPallete() && (
166
+ <>
167
+ <span>Non-Sequential</span>
168
+ <ul className='color-palette'>
169
+ {nonSequential.map(palette => {
170
+ const colorOne = {
171
+ backgroundColor: colorPalettes[palette][2]
172
+ }
173
+
174
+ const colorTwo = {
175
+ backgroundColor: colorPalettes[palette][4]
176
+ }
177
+
178
+ const colorThree = {
179
+ backgroundColor: colorPalettes[palette][6]
180
+ }
181
+
182
+ return (
183
+ <button
184
+ title={palette}
185
+ key={palette}
186
+ onClick={e => {
187
+ e.preventDefault()
188
+ updateConfig({ ...config, palette })
189
+ }}
190
+ className={config.palette === palette ? 'selected' : ''}
191
+ >
192
+ <span style={colorOne}></span>
193
+ <span style={colorTwo}></span>
194
+ <span style={colorThree}></span>
195
+ </button>
196
+ )
197
+ })}
198
+ </ul>
199
+ </>
200
+ )}
201
+ </>
202
+ )}
203
+ {config.visualizationType === 'Sankey' && (
204
+ <>
205
+ <span className='sankey__color-input'>
206
+ <input type='color' value={config.sankey.nodeColor.default} id='storyNodeColor' name='storyNodeColor' onChange={e => updateColor('nodeColor', e.target.value)} />
207
+ <label htmlFor='storyNodeColor'>Story Node Color</label>
208
+ </span>
209
+ <span className='sankey__color-input'>
210
+ <input type='color' value={config.sankey.storyNodeFontColor || 'red'} id='storyNodeFontColor' name='storyNodeFontColor' onChange={e => updateColor('storyNodeFontColor', e.target.value)} />
211
+ <label htmlFor='storyNodeFontColor'>Story Node Font Color</label>
212
+ </span>
213
+ <span className='sankey__color-input'>
214
+ <input type='color' value={config.sankey.linkColor.default} id='linkColor' name='linkColor' onChange={e => updateColor('linkColor', e.target.value)} />
215
+ <label htmlFor='linkColor'>Link Color</label>
216
+ </span>
217
+ </>
218
+ )}
219
+ {(config.visualizationType === 'Paired Bar' || config.visualizationType === 'Deviation Bar') && (
220
+ <>
221
+ <InputToggle section='twoColor' fieldName='isPaletteReversed' size='small' label='Use selected palette in reverse order' updateField={updateField} value={config.twoColor.isPaletteReversed} />
222
+ <ul className='color-palette'>
223
+ {twoColorPalettes.map(palette => {
224
+ const colorOne = {
225
+ backgroundColor: twoColorPalette[palette][0]
226
+ }
227
+
228
+ const colorTwo = {
229
+ backgroundColor: twoColorPalette[palette][1]
230
+ }
231
+
232
+ return (
233
+ <button
234
+ title={palette}
235
+ key={palette}
236
+ onClick={e => {
237
+ e.preventDefault()
238
+ updateConfig({ ...config, twoColor: { ...config.twoColor, palette } })
239
+ }}
240
+ className={config.twoColor.palette === palette ? 'selected' : ''}
241
+ >
242
+ <span className='two-color' style={colorOne}></span>
243
+ <span className='two-color' style={colorTwo}></span>
244
+ </button>
245
+ )
246
+ })}
247
+ </ul>
248
+ </>
249
+ )}
250
+
251
+ {visHasDataCutoff() && (
252
+ <>
253
+ <TextField
254
+ value={config.dataCutoff}
255
+ type='number'
256
+ fieldName='dataCutoff'
257
+ className='number-narrow'
258
+ label='Data Cutoff'
259
+ updateField={updateField}
260
+ tooltip={
261
+ <Tooltip style={{ textTransform: 'none' }}>
262
+ <Tooltip.Target>
263
+ <Icon display='question' style={{ marginLeft: '0.5rem' }} />
264
+ </Tooltip.Target>
265
+ <Tooltip.Content>
266
+ <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>
267
+ </Tooltip.Content>
268
+ </Tooltip>
269
+ }
270
+ />
271
+ </>
272
+ )}
273
+ {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} />}
274
+ {((config.visualizationType === 'Bar' && config.orientation !== 'horizontal') || config.visualizationType === 'Combo') && <TextField value={config.barThickness} type='number' fieldName='barThickness' label='Bar Thickness' updateField={updateField} />}
275
+ {visSupportsBarSpace() && <TextField type='number' value={config.barSpace || '15'} fieldName='barSpace' label='Bar Space' updateField={updateField} min={0} />}
276
+ {(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} />}
277
+
278
+ {config.visualizationType === 'Spark Line' && (
279
+ <div className='cove-accordion__panel-section checkbox-group'>
280
+ <CheckBox value={visual?.border} section='visual' fieldName='border' label='Show Border' updateField={updateField} />
281
+ <CheckBox value={visual?.borderColorTheme} section='visual' fieldName='borderColorTheme' label='Use Border Color Theme' updateField={updateField} />
282
+ <CheckBox value={visual?.accent} section='visual' fieldName='accent' label='Use Accent Style' updateField={updateField} />
283
+ <CheckBox value={visual?.background} section='visual' fieldName='background' label='Use Theme Background Color' updateField={updateField} />
284
+ <CheckBox value={visual?.hideBackgroundColor} section='visual' fieldName='hideBackgroundColor' label='Hide Background Color' updateField={updateField} />
285
+ </div>
286
+ )}
287
+
288
+ {(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && <CheckBox value={config.showLineSeriesLabels} fieldName='showLineSeriesLabels' label='Append Series Name to End of Line Charts' updateField={updateField} />}
289
+ {(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && config.showLineSeriesLabels && <CheckBox value={config.colorMatchLineSeriesLabels} fieldName='colorMatchLineSeriesLabels' label='Match Series Color to Name at End of Line Charts' updateField={updateField} />}
290
+
291
+ {visSupportsTooltipLines() && (
292
+ <>
293
+ <CheckBox value={visual.verticalHoverLine} fieldName='verticalHoverLine' section='visual' label='Vertical Hover Line' updateField={updateField} />
294
+ <CheckBox value={visual.horizontalHoverLine} fieldName='horizontalHoverLine' section='visual' label='Horizontal Hover Line' updateField={updateField} />
295
+ </>
296
+ )}
297
+ {visSupportsTooltipOpacity() && (
298
+ <label>
299
+ <span className='edit-label column-heading'>Tooltip Opacity</span>
300
+ <input
301
+ type='number'
302
+ value={config.tooltips.opacity ? config.tooltips.opacity : 100}
303
+ onChange={e =>
304
+ updateConfig({
305
+ ...config,
306
+ tooltips: {
307
+ ...config.tooltips,
308
+ opacity: e.target.value
309
+ }
310
+ })
311
+ }
312
+ />
313
+ </label>
314
+ )}
315
+ {config.visualizationType === 'Bar' && <CheckBox value={config.tooltips.singleSeries} fieldName='singleSeries' section='tooltips' label='SHOW HOVER FOR SINGLE DATA SERIES' updateField={updateField} />}
316
+
317
+ <label>
318
+ <span className='edit-label column-heading'>No Data Message</span>
319
+ <input
320
+ type='text'
321
+ value={config.chartMessage.noData ? config.chartMessage.noData : ''}
322
+ onChange={e =>
323
+ updateConfig({
324
+ ...config,
325
+ chartMessage: {
326
+ ...config.chartMessage,
327
+ noData: e.target.value
328
+ }
329
+ })
330
+ }
331
+ />
332
+ </label>
333
+ </AccordionItemPanel>
334
+ </AccordionItem>
335
+ )
336
+ }
337
+
338
+ export default PanelVisual
@@ -0,0 +1,19 @@
1
+ import ForestPlotSettings from './Panel.ForestPlotSettings'
2
+ import Series from './Panel.Series'
3
+ import Regions from './Panel.Regions'
4
+ import General from './Panel.General'
5
+ import BoxPlot from './Panel.BoxPlot'
6
+ import Visual from './Panel.Visual'
7
+ import Sankey from './Panel.Sankey'
8
+
9
+ const Panels = {
10
+ ForestPlot: ForestPlotSettings,
11
+ Series: Series,
12
+ Regions,
13
+ General,
14
+ BoxPlot,
15
+ Visual,
16
+ Sankey
17
+ }
18
+
19
+ export default Panels
@@ -70,3 +70,14 @@
70
70
  }
71
71
  }
72
72
  }
73
+
74
+ .sankey__color-input {
75
+ display: flex;
76
+ align-items: center;
77
+ margin: 10px auto;
78
+ label {
79
+ align-items: center;
80
+ padding-left: 5px;
81
+ margin-top: 0 !important;
82
+ }
83
+ }
@@ -8,17 +8,6 @@
8
8
 
9
9
  .cdc-open-viz-module.type-chart {
10
10
  .editor-panel {
11
- @import './components/panels.scss';
12
- display: flex;
13
- flex-direction: column;
14
- position: fixed;
15
- top: 0;
16
- bottom: 0;
17
- left: 0;
18
- width: 350px;
19
- background: #fff;
20
- z-index: 8;
21
-
22
11
  &.hidden {
23
12
  display: none;
24
13
  }
@@ -711,14 +700,13 @@
711
700
  color: #000;
712
701
  font-size: 1em;
713
702
  border: 0;
714
- position: fixed;
703
+ position: absolute;
715
704
  z-index: 100;
716
705
  transition: 0.1s background;
717
706
  cursor: pointer;
718
707
  width: 25px;
719
708
  height: 25px;
720
709
  left: 307px;
721
- top: 10px;
722
710
  box-shadow: rgba(0, 0, 0, 0.5) 0 1px 2px;
723
711
 
724
712
  &:before {
@@ -14,18 +14,19 @@ export const useEditorPermissions = () => {
14
14
  'Combo',
15
15
  'Deviation Bar',
16
16
  'Forecasting',
17
- 'Forest Plot',
17
+ // 'Forest Plot',
18
18
  'Line',
19
19
  'Paired Bar',
20
20
  'Pie',
21
21
  'Scatter Plot',
22
- 'Spark Line'
22
+ 'Spark Line',
23
+ 'Sankey'
23
24
  ]
24
25
 
25
26
  const headerColors = ['theme-blue', 'theme-purple', 'theme-brown', 'theme-teal', 'theme-pink', 'theme-orange', 'theme-slate', 'theme-indigo', 'theme-cyan', 'theme-green', 'theme-amber']
26
27
 
27
28
  const visSupportsDateCategoryAxis = () => {
28
- const disabledCharts = ['Forest Plot']
29
+ const disabledCharts = ['Forest Plot', 'Sankey']
29
30
  if (disabledCharts.includes(visualizationType)) return false
30
31
  return true
31
32
  }
@@ -43,13 +44,13 @@ export const useEditorPermissions = () => {
43
44
  }
44
45
 
45
46
  const visHasLabelOnData = () => {
46
- const disabledCharts = ['Area Chart', 'Box Plot', 'Pie', 'Scatter Plot', 'Forest Plot', 'Spark Line']
47
+ const disabledCharts = ['Area Chart', 'Box Plot', 'Pie', 'Scatter Plot', 'Forest Plot', 'Spark Line', 'Sankey']
47
48
  if (disabledCharts.includes(visualizationType)) return false
48
49
  return true
49
50
  }
50
51
 
51
52
  const visCanAnimate = () => {
52
- const disabledCharts = ['Area Chart', 'Scatter Plot', 'Box Plot', 'Forest Plot', 'Spark Line']
53
+ const disabledCharts = ['Area Chart', 'Scatter Plot', 'Box Plot', 'Forest Plot', 'Spark Line', 'Sankey']
53
54
  if (disabledCharts.includes(visualizationType)) return false
54
55
  return true
55
56
  }
@@ -62,6 +63,8 @@ export const useEditorPermissions = () => {
62
63
  return false
63
64
  case 'Spark Line':
64
65
  return false
66
+ case 'Sankey':
67
+ return false
65
68
  default:
66
69
  return true
67
70
  }
@@ -107,6 +110,8 @@ export const useEditorPermissions = () => {
107
110
 
108
111
  const visHasDataCutoff = () => {
109
112
  switch (visualizationType) {
113
+ case 'Sankey':
114
+ return false
110
115
  case 'Forest Plot':
111
116
  return false
112
117
  case 'Box Plot':
@@ -120,8 +125,13 @@ export const useEditorPermissions = () => {
120
125
  }
121
126
  }
122
127
 
128
+ const visHasSelectableLegendValues = !['Box Plot', 'Forest Plot', 'Spark Line'].includes(visualizationType)
129
+ const visHasLegendAxisAlign = () => {
130
+ return visualizationType === 'Bar' && visualizationSubType === 'stacked' && config.legend.behavior === 'isolate'
131
+ }
132
+
123
133
  const visSupportsTooltipOpacity = () => {
124
- const disabledCharts = ['Spark Line']
134
+ const disabledCharts = ['Spark Line', 'Sankey']
125
135
  if (disabledCharts.includes(visualizationType)) return false
126
136
  return true
127
137
  }
@@ -133,19 +143,19 @@ export const useEditorPermissions = () => {
133
143
  }
134
144
 
135
145
  const visSupportsSequentialPallete = () => {
136
- const disabledCharts = ['Paired Bar', 'Deviation Bar', 'Forest Plot', 'Forecasting']
146
+ const disabledCharts = ['Paired Bar', 'Deviation Bar', 'Forest Plot', 'Forecasting', 'Sankey']
137
147
  if (disabledCharts.includes(visualizationType)) return false
138
148
  return true
139
149
  }
140
150
 
141
151
  const visSupportsNonSequentialPallete = () => {
142
- const disabledCharts = ['Paired Bar', 'Deviation Bar', 'Forest Plot', 'Forecasting']
152
+ const disabledCharts = ['Paired Bar', 'Deviation Bar', 'Forest Plot', 'Forecasting', 'Sankey']
143
153
  if (disabledCharts.includes(visualizationType)) return false
144
154
  return true
145
155
  }
146
156
 
147
157
  const visSupportsReverseColorPalette = () => {
148
- const disabledCharts = ['Forest Plot', 'Paired Bar', 'Deviation Bar']
158
+ const disabledCharts = ['Forest Plot', 'Paired Bar', 'Deviation Bar', 'Sankey']
149
159
  if (disabledCharts.includes(visualizationType)) return false
150
160
  return true
151
161
  }
@@ -187,7 +197,7 @@ export const useEditorPermissions = () => {
187
197
  }
188
198
 
189
199
  const visSupportsRegions = () => {
190
- const disabledCharts = ['Forest Plot', 'Pie', 'Paired Bar', 'Spark Line']
200
+ const disabledCharts = ['Forest Plot', 'Pie', 'Paired Bar', 'Spark Line', 'Sankey']
191
201
  if (disabledCharts.includes(visualizationType)) return false
192
202
  return true
193
203
  }
@@ -205,7 +215,7 @@ export const useEditorPermissions = () => {
205
215
  }
206
216
 
207
217
  const visSupportsFilters = () => {
208
- const disabledCharts = ['Forest Plot']
218
+ const disabledCharts = ['Forest Plot', 'Sankey']
209
219
  if (disabledCharts.includes(visualizationType)) return false
210
220
  return true
211
221
  }
@@ -258,7 +268,7 @@ export const useEditorPermissions = () => {
258
268
  }
259
269
 
260
270
  const visSupportsLeftValueAxis = () => {
261
- const disabledCharts = ['Spark Line']
271
+ const disabledCharts = ['Spark Line', 'Sankey']
262
272
  if (disabledCharts.includes(visualizationType)) return false
263
273
  return true
264
274
  }
@@ -270,17 +280,34 @@ export const useEditorPermissions = () => {
270
280
  }
271
281
 
272
282
  const visSupportsDateCategoryHeight = () => {
273
- const disabledCharts = ['Spark Line']
283
+ const disabledCharts = ['Spark Line', 'Sankey']
274
284
  if (disabledCharts.includes(visualizationType)) return false
275
285
  return true
276
286
  }
277
287
 
288
+ const visSupportsDateCategoryAxisPadding = () => {
289
+ return config.xAxis.type === 'date-time'
290
+ }
291
+
278
292
  const visSupportsReactTooltip = () => {
279
293
  if (['Deviation Bar', 'Box Plot', 'Scatter Plot', 'Paired Bar'].includes(visualizationType) || (visualizationType === 'Bar' && config.tooltips.singleSeries)) {
280
294
  return true
281
295
  }
282
296
  }
283
297
 
298
+ const visSupportsPreliminaryData = () => {
299
+ // check if Line added in Combo
300
+ const lineExist = config?.series.some(item => ['Line', 'dashed-sm', 'dashed-md', 'dashed-lg'].includes(item?.type))
301
+ if (visualizationType === 'Line') {
302
+ return true
303
+ }
304
+
305
+ if (visualizationType === 'Combo' && lineExist) {
306
+ return true
307
+ }
308
+ return false
309
+ }
310
+
284
311
  return {
285
312
  enabledChartTypes,
286
313
  headerColors,
@@ -291,6 +318,7 @@ export const useEditorPermissions = () => {
291
318
  visHasLabelOnData,
292
319
  visHasDataSuppression,
293
320
  visHasLegend,
321
+ visHasLegendAxisAlign,
294
322
  visHasBrushChart,
295
323
  visHasNumbersOnBars,
296
324
  visSupportsBarSpace,
@@ -303,10 +331,12 @@ export const useEditorPermissions = () => {
303
331
  visSupportsDateCategoryHeight,
304
332
  visSupportsDateCategoryNumTicks,
305
333
  visSupportsDateCategoryTickRotation,
334
+ visSupportsDateCategoryAxisPadding,
306
335
  visSupportsFilters,
307
336
  visSupportsFootnotes,
308
337
  visSupportsLeftValueAxis,
309
338
  visSupportsNonSequentialPallete,
339
+ visSupportsPreliminaryData,
310
340
  visSupportsRankByValue,
311
341
  visSupportsRegions,
312
342
  visSupportsResponsiveTicks,
@@ -314,6 +344,7 @@ export const useEditorPermissions = () => {
314
344
  visSupportsSequentialPallete,
315
345
  visSupportsSuperTitle,
316
346
  visSupportsTooltipLines,
347
+ visHasSelectableLegendValues,
317
348
  visSupportsTooltipOpacity,
318
349
  visSupportsValueAxisGridLines,
319
350
  visSupportsValueAxisLabels,