@cdc/chart 4.24.10 → 4.24.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdcchart.js +34618 -33995
- package/examples/feature/boxplot/boxplot-data.json +88 -22
- package/examples/feature/boxplot/boxplot.json +540 -16
- package/examples/feature/boxplot/testing.csv +7 -7
- package/examples/feature/sankey/sankey-example-data.json +0 -1
- package/examples/private/test.json +20092 -0
- package/index.html +3 -3
- package/package.json +2 -2
- package/src/CdcChart.tsx +86 -86
- package/src/_stories/Chart.CustomColors.stories.tsx +19 -0
- package/src/_stories/Chart.DynamicSeries.stories.tsx +27 -0
- package/src/_stories/Chart.Legend.Gradient.stories.tsx +42 -1
- package/src/_stories/Chart.stories.tsx +7 -8
- package/src/_stories/ChartEditor.stories.tsx +27 -0
- package/src/_stories/ChartLine.Suppression.stories.tsx +25 -0
- package/src/_stories/ChartPrefixSuffix.stories.tsx +8 -0
- package/src/_stories/_mock/boxplot_multiseries.json +647 -0
- package/src/_stories/_mock/dynamic_series_bar_config.json +723 -0
- package/src/_stories/_mock/dynamic_series_config.json +979 -0
- package/{examples/feature/scatterplot/scatterplot.json → src/_stories/_mock/scatterplot_mock.json} +62 -92
- package/src/_stories/_mock/suppression_mock.json +1549 -0
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +43 -9
- package/src/components/BarChart/components/BarChart.Vertical.tsx +60 -42
- package/src/components/BarChart/helpers/index.ts +1 -2
- package/src/components/BoxPlot/BoxPlot.tsx +189 -0
- package/src/components/EditorPanel/EditorPanel.tsx +64 -62
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +3 -3
- package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +51 -6
- package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +40 -9
- package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +3 -3
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +121 -56
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -2
- package/src/components/EditorPanel/useEditorPermissions.ts +15 -1
- package/src/components/Legend/Legend.Component.tsx +9 -10
- package/src/components/Legend/Legend.tsx +16 -16
- package/src/components/LineChart/helpers.ts +48 -43
- package/src/components/LineChart/index.tsx +88 -82
- package/src/components/LinearChart.tsx +17 -10
- package/src/components/Sankey/index.tsx +50 -32
- package/src/components/Sankey/sankey.scss +6 -5
- package/src/components/Sankey/useSankeyAlert.tsx +60 -0
- package/src/components/ScatterPlot/ScatterPlot.jsx +20 -4
- package/src/data/initial-state.js +3 -9
- package/src/hooks/useLegendClasses.ts +10 -23
- package/src/hooks/useMinMax.ts +27 -13
- package/src/hooks/useReduceData.ts +43 -10
- package/src/hooks/useScales.ts +56 -35
- package/src/hooks/useTooltip.tsx +54 -49
- package/src/scss/main.scss +0 -18
- package/src/types/ChartConfig.ts +6 -19
- package/src/types/ChartContext.ts +4 -1
- package/src/types/ForestPlot.ts +8 -0
- package/src/components/BoxPlot/BoxPlot.jsx +0 -111
|
@@ -171,7 +171,7 @@ const PreliminaryData: React.FC<PreliminaryProps> = ({ config, updateConfig, dat
|
|
|
171
171
|
<p> {type === 'suppression' ? 'Suppressed' : 'Effect'} Data</p>
|
|
172
172
|
<button
|
|
173
173
|
type='button'
|
|
174
|
-
className='
|
|
174
|
+
className='btn btn-danger'
|
|
175
175
|
onClick={event => {
|
|
176
176
|
event.preventDefault()
|
|
177
177
|
removeColumn(i)
|
|
@@ -450,7 +450,7 @@ const PreliminaryData: React.FC<PreliminaryProps> = ({ config, updateConfig, dat
|
|
|
450
450
|
}
|
|
451
451
|
)}
|
|
452
452
|
|
|
453
|
-
<button type='button' onClick={addColumn} className='btn full-width'>
|
|
453
|
+
<button type='button' onClick={addColumn} className='btn btn-primary full-width'>
|
|
454
454
|
{config.visualizationType === 'Line'
|
|
455
455
|
? 'Add Special Line'
|
|
456
456
|
: config.visualizationType === 'Bar'
|
|
@@ -530,7 +530,7 @@ const CategoricalAxis: React.FC<CategoricalAxisProps> = ({ config, updateConfig,
|
|
|
530
530
|
<p>Axis Category {i + 1}</p>
|
|
531
531
|
<button
|
|
532
532
|
type='button'
|
|
533
|
-
className='
|
|
533
|
+
className='btn btn-danger'
|
|
534
534
|
onClick={event => {
|
|
535
535
|
event.preventDefault()
|
|
536
536
|
removeColumn(i)
|
|
@@ -583,7 +583,7 @@ const CategoricalAxis: React.FC<CategoricalAxisProps> = ({ config, updateConfig,
|
|
|
583
583
|
)
|
|
584
584
|
})}
|
|
585
585
|
|
|
586
|
-
<button type='button' onClick={addColumn} className='btn full-width'>
|
|
586
|
+
<button type='button' onClick={addColumn} className='btn btn-primary full-width'>
|
|
587
587
|
Add Axis Category
|
|
588
588
|
</button>
|
|
589
589
|
</>
|
|
@@ -619,52 +619,35 @@ const EditorPanel = () => {
|
|
|
619
619
|
const { leftMax, rightMax } = useMinMax(properties)
|
|
620
620
|
|
|
621
621
|
const {
|
|
622
|
-
headerColors,
|
|
623
|
-
visSupportsTooltipLines,
|
|
624
|
-
visSupportsNonSequentialPallete,
|
|
625
|
-
visSupportsSequentialPallete,
|
|
626
|
-
visSupportsReverseColorPalette,
|
|
627
|
-
visHasLabelOnData,
|
|
628
|
-
visHasNumbersOnBars,
|
|
629
622
|
visHasAnchors,
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
visHasSelectableLegendValues,
|
|
633
|
-
visCanAnimate,
|
|
623
|
+
visHasBrushChart,
|
|
624
|
+
visHasCategoricalAxis,
|
|
634
625
|
visHasLegend,
|
|
635
626
|
visHasLegendAxisAlign,
|
|
636
627
|
visHasLegendColorCategory,
|
|
637
|
-
|
|
628
|
+
visHasSelectableLegendValues,
|
|
638
629
|
visSupportsDateCategoryAxis,
|
|
639
|
-
visSupportsValueAxisMin,
|
|
640
|
-
visSupportsValueAxisMax,
|
|
641
630
|
visSupportsDateCategoryAxisLabel,
|
|
642
631
|
visSupportsDateCategoryAxisLine,
|
|
632
|
+
visSupportsDateCategoryAxisMax,
|
|
633
|
+
visSupportsDateCategoryAxisMin,
|
|
634
|
+
visSupportsDateCategoryAxisPadding,
|
|
643
635
|
visSupportsDateCategoryAxisTicks,
|
|
644
|
-
|
|
636
|
+
visSupportsDateCategoryHeight,
|
|
645
637
|
visSupportsDateCategoryNumTicks,
|
|
646
|
-
|
|
647
|
-
|
|
638
|
+
visSupportsDateCategoryTickRotation,
|
|
639
|
+
visSupportsDynamicSeries,
|
|
648
640
|
visSupportsFilters,
|
|
649
|
-
visSupportsPreliminaryData,
|
|
650
|
-
visSupportsValueAxisGridLines,
|
|
651
|
-
visSupportsValueAxisLine,
|
|
652
|
-
visSupportsValueAxisTicks,
|
|
653
|
-
visSupportsValueAxisLabels,
|
|
654
|
-
visSupportsBarSpace,
|
|
655
|
-
visSupportsBarThickness,
|
|
656
|
-
visSupportsFootnotes,
|
|
657
|
-
visSupportsSuperTitle,
|
|
658
|
-
visSupportsDataCutoff,
|
|
659
|
-
visSupportsChartHeight,
|
|
660
641
|
visSupportsLeftValueAxis,
|
|
661
|
-
|
|
642
|
+
visSupportsPreliminaryData,
|
|
662
643
|
visSupportsRankByValue,
|
|
663
644
|
visSupportsResponsiveTicks,
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
645
|
+
visSupportsValueAxisGridLines,
|
|
646
|
+
visSupportsValueAxisLabels,
|
|
647
|
+
visSupportsValueAxisLine,
|
|
648
|
+
visSupportsValueAxisMax,
|
|
649
|
+
visSupportsValueAxisMin,
|
|
650
|
+
visSupportsValueAxisTicks
|
|
668
651
|
} = useEditorPermissions()
|
|
669
652
|
|
|
670
653
|
// when the visualization type changes we
|
|
@@ -763,7 +746,7 @@ const EditorPanel = () => {
|
|
|
763
746
|
newValue
|
|
764
747
|
) // eslint-disable-line
|
|
765
748
|
|
|
766
|
-
if (section === 'boxplot' && subsection === 'legend') {
|
|
749
|
+
if (section === 'boxplot' && (subsection === 'legend' || subsection === 'labels')) {
|
|
767
750
|
updateConfig({
|
|
768
751
|
...config,
|
|
769
752
|
[section]: {
|
|
@@ -833,19 +816,6 @@ const EditorPanel = () => {
|
|
|
833
816
|
return null
|
|
834
817
|
}
|
|
835
818
|
|
|
836
|
-
useEffect(() => {
|
|
837
|
-
if (!config.general?.boxplot) return
|
|
838
|
-
if (!config.general.boxplot.firstQuartilePercentage) {
|
|
839
|
-
updateConfig({
|
|
840
|
-
...config,
|
|
841
|
-
boxplot: {
|
|
842
|
-
...config.boxplot,
|
|
843
|
-
firstQuartilePercentage: 25
|
|
844
|
-
}
|
|
845
|
-
})
|
|
846
|
-
}
|
|
847
|
-
}, [config])
|
|
848
|
-
|
|
849
819
|
const setLollipopShape = shape => {
|
|
850
820
|
updateConfig({
|
|
851
821
|
...config,
|
|
@@ -1427,14 +1397,15 @@ const EditorPanel = () => {
|
|
|
1427
1397
|
</AccordionItemButton>
|
|
1428
1398
|
</AccordionItemHeading>
|
|
1429
1399
|
<AccordionItemPanel>
|
|
1430
|
-
{
|
|
1400
|
+
{/* FEATURE to be reintroduced by DEV-9747 */}
|
|
1401
|
+
{/* {visSupportsDynamicSeries() && (
|
|
1431
1402
|
<CheckBox
|
|
1432
1403
|
value={config.dynamicSeries}
|
|
1433
1404
|
fieldName='dynamicSeries'
|
|
1434
1405
|
label='Dynamically generate series'
|
|
1435
1406
|
updateField={updateField}
|
|
1436
1407
|
/>
|
|
1437
|
-
)}
|
|
1408
|
+
)} */}
|
|
1438
1409
|
{config.dynamicSeries && config.visualizationType === 'Line' && (
|
|
1439
1410
|
<Select
|
|
1440
1411
|
fieldName='dynamicSeriesType'
|
|
@@ -2166,7 +2137,7 @@ const EditorPanel = () => {
|
|
|
2166
2137
|
</Accordion>
|
|
2167
2138
|
|
|
2168
2139
|
<button
|
|
2169
|
-
className='btn full-width'
|
|
2140
|
+
className='btn btn-primary full-width'
|
|
2170
2141
|
onClick={e => {
|
|
2171
2142
|
e.preventDefault()
|
|
2172
2143
|
const anchors = [...config.yAxis.anchors]
|
|
@@ -2292,7 +2263,7 @@ const EditorPanel = () => {
|
|
|
2292
2263
|
</Accordion>
|
|
2293
2264
|
|
|
2294
2265
|
<button
|
|
2295
|
-
className='btn full-width'
|
|
2266
|
+
className='btn btn-primary full-width'
|
|
2296
2267
|
onClick={e => {
|
|
2297
2268
|
e.preventDefault()
|
|
2298
2269
|
const anchors = [...config.xAxis.anchors]
|
|
@@ -2517,7 +2488,6 @@ const EditorPanel = () => {
|
|
|
2517
2488
|
)}
|
|
2518
2489
|
</select>
|
|
2519
2490
|
</label>
|
|
2520
|
-
|
|
2521
2491
|
<CheckBox
|
|
2522
2492
|
value={config.xAxis.manual}
|
|
2523
2493
|
section='xAxis'
|
|
@@ -2525,6 +2495,14 @@ const EditorPanel = () => {
|
|
|
2525
2495
|
label='Manual Ticks'
|
|
2526
2496
|
updateField={updateField}
|
|
2527
2497
|
/>
|
|
2498
|
+
<CheckBox
|
|
2499
|
+
display={config.xAxis.type !== 'categorical'}
|
|
2500
|
+
value={config.xAxis.sortByRecentDate}
|
|
2501
|
+
section='xAxis'
|
|
2502
|
+
fieldName='sortByRecentDate'
|
|
2503
|
+
label='Show dates newest to oldest'
|
|
2504
|
+
updateField={updateField}
|
|
2505
|
+
/>
|
|
2528
2506
|
|
|
2529
2507
|
{visSupportsDateCategoryAxisPadding() && (
|
|
2530
2508
|
<TextField
|
|
@@ -3210,7 +3188,7 @@ const EditorPanel = () => {
|
|
|
3210
3188
|
highlightedBarValues.map((highlightedBarValue, i) => (
|
|
3211
3189
|
<fieldset>
|
|
3212
3190
|
<div className='edit-block' key={`highlighted-bar-${i}`}>
|
|
3213
|
-
<button className='
|
|
3191
|
+
<button className='btn btn-danger' onClick={e => handleRemoveHighlightedBar(e, i)}>
|
|
3214
3192
|
Remove
|
|
3215
3193
|
</button>
|
|
3216
3194
|
<p>Highlighted Bar {i + 1}</p>
|
|
@@ -3268,7 +3246,7 @@ const EditorPanel = () => {
|
|
|
3268
3246
|
</div>
|
|
3269
3247
|
</fieldset>
|
|
3270
3248
|
))}
|
|
3271
|
-
<button className='btn full-width' onClick={e => handleAddNewHighlightedBar(e)}>
|
|
3249
|
+
<button className='btn btn-primary full-width' onClick={e => handleAddNewHighlightedBar(e)}>
|
|
3272
3250
|
Add Highlighted Bar
|
|
3273
3251
|
</button>
|
|
3274
3252
|
</>
|
|
@@ -3328,6 +3306,30 @@ const EditorPanel = () => {
|
|
|
3328
3306
|
</>
|
|
3329
3307
|
)}
|
|
3330
3308
|
|
|
3309
|
+
{visSupportsDateCategoryAxisMin() && (
|
|
3310
|
+
<TextField
|
|
3311
|
+
value={config.xAxis.min}
|
|
3312
|
+
section='xAxis'
|
|
3313
|
+
fieldName='min'
|
|
3314
|
+
type='number'
|
|
3315
|
+
label='min value'
|
|
3316
|
+
placeholder='Auto'
|
|
3317
|
+
updateField={updateField}
|
|
3318
|
+
/>
|
|
3319
|
+
)}
|
|
3320
|
+
|
|
3321
|
+
{visSupportsDateCategoryAxisMax() && (
|
|
3322
|
+
<TextField
|
|
3323
|
+
value={config.xAxis.max}
|
|
3324
|
+
section='xAxis'
|
|
3325
|
+
fieldName='max'
|
|
3326
|
+
type='number'
|
|
3327
|
+
label='max value'
|
|
3328
|
+
placeholder='Auto'
|
|
3329
|
+
updateField={updateField}
|
|
3330
|
+
/>
|
|
3331
|
+
)}
|
|
3332
|
+
|
|
3331
3333
|
{/* anchors */}
|
|
3332
3334
|
{visHasAnchors() && config.orientation !== 'horizontal' && (
|
|
3333
3335
|
<div className='edit-block'>
|
|
@@ -3436,7 +3438,7 @@ const EditorPanel = () => {
|
|
|
3436
3438
|
</Accordion>
|
|
3437
3439
|
|
|
3438
3440
|
<button
|
|
3439
|
-
className='btn full-width'
|
|
3441
|
+
className='btn btn-primary full-width'
|
|
3440
3442
|
onClick={e => {
|
|
3441
3443
|
e.preventDefault()
|
|
3442
3444
|
const anchors = [...config.xAxis.anchors]
|
|
@@ -3565,7 +3567,7 @@ const EditorPanel = () => {
|
|
|
3565
3567
|
</Accordion>
|
|
3566
3568
|
|
|
3567
3569
|
<button
|
|
3568
|
-
className='btn full-width'
|
|
3570
|
+
className='btn btn-primary full-width'
|
|
3569
3571
|
onClick={e => {
|
|
3570
3572
|
e.preventDefault()
|
|
3571
3573
|
const anchors = [...config.yAxis.anchors]
|
|
@@ -3812,7 +3814,7 @@ const EditorPanel = () => {
|
|
|
3812
3814
|
config.legend.seriesHighlight.map((val, i) => (
|
|
3813
3815
|
<fieldset className='edit-block' key={`${val}-${i}`}>
|
|
3814
3816
|
<button
|
|
3815
|
-
className='
|
|
3817
|
+
className='btn btn-danger'
|
|
3816
3818
|
onClick={event => {
|
|
3817
3819
|
event.preventDefault()
|
|
3818
3820
|
const updatedSeriesHighlight = [...config.legend.seriesHighlight]
|
|
@@ -3841,7 +3843,7 @@ const EditorPanel = () => {
|
|
|
3841
3843
|
</fieldset>
|
|
3842
3844
|
))}
|
|
3843
3845
|
<button
|
|
3844
|
-
className={'btn full-width'}
|
|
3846
|
+
className={'btn btn-primary full-width'}
|
|
3845
3847
|
onClick={event => {
|
|
3846
3848
|
event.preventDefault()
|
|
3847
3849
|
const legendColumns = getLegendColumns()
|
|
@@ -283,7 +283,7 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
283
283
|
</select>
|
|
284
284
|
</label>
|
|
285
285
|
|
|
286
|
-
<Button className='
|
|
286
|
+
<Button className='btn btn-danger full-width' onClick={() => handleRemoveAnnotation(index)}>
|
|
287
287
|
Delete Annotation
|
|
288
288
|
</Button>
|
|
289
289
|
</div>
|
|
@@ -291,9 +291,9 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
291
291
|
</Accordion>
|
|
292
292
|
))}
|
|
293
293
|
{config?.annotations?.length < 3 && (
|
|
294
|
-
<
|
|
294
|
+
<button onClick={handleAddAnnotation} className='btn btn-primary mt-2 full-width'>
|
|
295
295
|
Add Annotation
|
|
296
|
-
</
|
|
296
|
+
</button>
|
|
297
297
|
)}
|
|
298
298
|
</Accordion.Section>
|
|
299
299
|
</Accordion>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { useContext, FC } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AccordionItem,
|
|
4
|
+
AccordionItemHeading,
|
|
5
|
+
AccordionItemPanel,
|
|
6
|
+
AccordionItemButton
|
|
7
|
+
} from 'react-accessible-accordion'
|
|
3
8
|
import { TextField } from '@cdc/core/components/EditorPanel/Inputs'
|
|
4
9
|
import Tooltip from '@cdc/core/components/ui/Tooltip'
|
|
5
10
|
import Icon from '@cdc/core/components/ui/Icon'
|
|
@@ -131,15 +136,55 @@ const PanelBoxPlot: FC<PanelProps> = props => {
|
|
|
131
136
|
<h4 style={{ fontSize: '18px' }}>Labels for Additional Measures</h4>
|
|
132
137
|
|
|
133
138
|
{/* iqr */}
|
|
134
|
-
<TextField
|
|
139
|
+
<TextField
|
|
140
|
+
type='text'
|
|
141
|
+
value={boxplot.labels.iqr}
|
|
142
|
+
fieldName='iqr'
|
|
143
|
+
section='boxplot'
|
|
144
|
+
subsection='labels'
|
|
145
|
+
label='Interquartile Range'
|
|
146
|
+
updateField={updateField}
|
|
147
|
+
/>
|
|
135
148
|
{/* count */}
|
|
136
|
-
<TextField
|
|
149
|
+
<TextField
|
|
150
|
+
type='text'
|
|
151
|
+
value={boxplot.labels.count}
|
|
152
|
+
fieldName='count'
|
|
153
|
+
section='boxplot'
|
|
154
|
+
subsection='labels'
|
|
155
|
+
label='Count'
|
|
156
|
+
updateField={updateField}
|
|
157
|
+
/>
|
|
137
158
|
{/* mean */}
|
|
138
|
-
<TextField
|
|
159
|
+
<TextField
|
|
160
|
+
type='text'
|
|
161
|
+
value={boxplot.labels.mean}
|
|
162
|
+
fieldName='mean'
|
|
163
|
+
section='boxplot'
|
|
164
|
+
subsection='labels'
|
|
165
|
+
label='Mean'
|
|
166
|
+
updateField={updateField}
|
|
167
|
+
/>
|
|
139
168
|
{/* outliers */}
|
|
140
|
-
<TextField
|
|
169
|
+
<TextField
|
|
170
|
+
type='text'
|
|
171
|
+
value={boxplot.labels.outliers}
|
|
172
|
+
fieldName='outliers'
|
|
173
|
+
section='boxplot'
|
|
174
|
+
subsection='labels'
|
|
175
|
+
label='Outliers'
|
|
176
|
+
updateField={updateField}
|
|
177
|
+
/>
|
|
141
178
|
{/* values */}
|
|
142
|
-
<TextField
|
|
179
|
+
<TextField
|
|
180
|
+
type='text'
|
|
181
|
+
value={boxplot.labels.values}
|
|
182
|
+
fieldName='values'
|
|
183
|
+
section='boxplot'
|
|
184
|
+
subsection='labels'
|
|
185
|
+
label='Values'
|
|
186
|
+
updateField={updateField}
|
|
187
|
+
/>
|
|
143
188
|
</AccordionItemPanel>
|
|
144
189
|
</AccordionItem>
|
|
145
190
|
)
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { memo, useContext } from 'react'
|
|
2
2
|
import { useEditorPermissions } from '../../useEditorPermissions.js'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionItemHeading,
|
|
6
|
+
AccordionItemPanel,
|
|
7
|
+
AccordionItemButton
|
|
8
|
+
} from 'react-accessible-accordion'
|
|
4
9
|
import { type ChartConfig } from '../../../../types/ChartConfig.js'
|
|
5
10
|
import { TextField, Select } from '@cdc/core/components/EditorPanel/Inputs'
|
|
6
11
|
import Tooltip from '@cdc/core/components/ui/Tooltip'
|
|
@@ -58,7 +63,7 @@ const RegionSettings = memo(({ config, updateConfig }: { config: ChartConfig; up
|
|
|
58
63
|
<div className='edit-block' key={`region-${i}`}>
|
|
59
64
|
<button
|
|
60
65
|
type='button'
|
|
61
|
-
className='remove-column'
|
|
66
|
+
className='btn btn-danger remove-column'
|
|
62
67
|
onClick={event => {
|
|
63
68
|
event.preventDefault()
|
|
64
69
|
removeColumn(i)
|
|
@@ -68,8 +73,18 @@ const RegionSettings = memo(({ config, updateConfig }: { config: ChartConfig; up
|
|
|
68
73
|
</button>
|
|
69
74
|
<TextField value={label} label='Region Label' fieldName='label' i={i} updateField={updateField} />
|
|
70
75
|
<div className='two-col-inputs'>
|
|
71
|
-
<TextField
|
|
72
|
-
|
|
76
|
+
<TextField
|
|
77
|
+
value={color}
|
|
78
|
+
label='Text Color'
|
|
79
|
+
fieldName='color'
|
|
80
|
+
updateField={(section, subsection, fieldName, value) => regionUpdate(fieldName, value, i)}
|
|
81
|
+
/>
|
|
82
|
+
<TextField
|
|
83
|
+
value={background}
|
|
84
|
+
label='Background'
|
|
85
|
+
fieldName='background'
|
|
86
|
+
updateField={(section, subsection, fieldName, value) => regionUpdate(fieldName, value, i)}
|
|
87
|
+
/>
|
|
73
88
|
</div>
|
|
74
89
|
|
|
75
90
|
<Select
|
|
@@ -91,11 +106,17 @@ const RegionSettings = memo(({ config, updateConfig }: { config: ChartConfig; up
|
|
|
91
106
|
options={fromOptions}
|
|
92
107
|
/>
|
|
93
108
|
|
|
94
|
-
{(config.regions[i].fromType === 'Fixed' ||
|
|
109
|
+
{(config.regions[i].fromType === 'Fixed' ||
|
|
110
|
+
config.regions[i].fromType === 'Previous Days' ||
|
|
111
|
+
!config.regions[i].fromType) && (
|
|
95
112
|
<>
|
|
96
113
|
<TextField
|
|
97
114
|
value={from}
|
|
98
|
-
label={
|
|
115
|
+
label={
|
|
116
|
+
config.regions[i].fromType === 'Fixed' || !config.regions[i]?.fromType
|
|
117
|
+
? 'From Value'
|
|
118
|
+
: 'Previous Number of Days'
|
|
119
|
+
}
|
|
99
120
|
fieldName='from'
|
|
100
121
|
updateField={(section, subsection, fieldName, value) => regionUpdate(fieldName, value, i)}
|
|
101
122
|
tooltip={
|
|
@@ -104,7 +125,10 @@ const RegionSettings = memo(({ config, updateConfig }: { config: ChartConfig; up
|
|
|
104
125
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
105
126
|
</Tooltip.Target>
|
|
106
127
|
<Tooltip.Content>
|
|
107
|
-
<p>
|
|
128
|
+
<p>
|
|
129
|
+
When using categorical (linear scale) match the data set value. When using date (linear / date
|
|
130
|
+
time scale) match the x-axis value.
|
|
131
|
+
</p>
|
|
108
132
|
</Tooltip.Content>
|
|
109
133
|
</Tooltip>
|
|
110
134
|
}
|
|
@@ -131,13 +155,20 @@ const RegionSettings = memo(({ config, updateConfig }: { config: ChartConfig; up
|
|
|
131
155
|
options={toOptions}
|
|
132
156
|
/>
|
|
133
157
|
|
|
134
|
-
{(config.regions[i].toType === 'Fixed' || !config.regions[i].toType) &&
|
|
158
|
+
{(config.regions[i].toType === 'Fixed' || !config.regions[i].toType) && (
|
|
159
|
+
<TextField
|
|
160
|
+
value={to}
|
|
161
|
+
label='To Value'
|
|
162
|
+
fieldName='to'
|
|
163
|
+
updateField={(section, subsection, fieldName, value) => regionUpdate(fieldName, value, i)}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
135
166
|
</div>
|
|
136
167
|
))}
|
|
137
168
|
{!config.regions && <p style={{ textAlign: 'center' }}>There are currently no regions.</p>}
|
|
138
169
|
<button
|
|
139
170
|
type='button'
|
|
140
|
-
className='btn full-width'
|
|
171
|
+
className='btn btn-primary full-width'
|
|
141
172
|
onClick={e => {
|
|
142
173
|
e.preventDefault()
|
|
143
174
|
addColumn()
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react-accessible-accordion'
|
|
12
12
|
import EditorPanelContext, { type EditorPanelContext as EPContext } from '../../EditorPanelContext'
|
|
13
13
|
|
|
14
|
-
const SankeySettings =
|
|
14
|
+
const SankeySettings: React.FC<PanelProps> = props => {
|
|
15
15
|
const { config, updateConfig } = useContext(ConfigContext)
|
|
16
16
|
const data = config.data?.[0]
|
|
17
17
|
const { updateField } = useContext<EPContext>(EditorPanelContext)
|
|
@@ -109,7 +109,7 @@ const SankeySettings = () => {
|
|
|
109
109
|
onChange={e => updateStoryNode('segmentTextAfter', e.target.value, i)}
|
|
110
110
|
/>
|
|
111
111
|
</label>
|
|
112
|
-
<Button onClick={e => removeStoryNode(i)} className='btn
|
|
112
|
+
<Button onClick={e => removeStoryNode(i)} className='btn btn-danger full-width'>
|
|
113
113
|
Remove Story Node
|
|
114
114
|
</Button>
|
|
115
115
|
</div>
|
|
@@ -117,7 +117,7 @@ const SankeySettings = () => {
|
|
|
117
117
|
{data?.storyNodeText?.length < 3 && (
|
|
118
118
|
<button
|
|
119
119
|
type='button'
|
|
120
|
-
className='btn full-width'
|
|
120
|
+
className='btn btn-primary full-width'
|
|
121
121
|
onClick={e => {
|
|
122
122
|
e.preventDefault()
|
|
123
123
|
addStoryNode()
|