@cdc/chart 4.24.4 → 4.24.5
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 +32130 -31726
- package/index.html +7 -7
- package/package.json +2 -2
- package/src/CdcChart.tsx +17 -13
- package/src/_stories/Chart.stories.tsx +8 -0
- package/src/_stories/_mock/bar-chart-suppressed.json +474 -0
- package/src/components/AreaChart/components/AreaChart.jsx +2 -2
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +52 -47
- package/src/components/BarChart/components/BarChart.Vertical.tsx +77 -92
- package/src/components/DeviationBar.jsx +4 -2
- package/src/components/EditorPanel/EditorPanel.tsx +289 -601
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +19 -2
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -5
- package/src/components/EditorPanel/useEditorPermissions.js +4 -1
- package/src/components/Legend/Legend.Component.tsx +62 -10
- package/src/components/LineChart/LineChartProps.ts +13 -6
- package/src/components/LineChart/components/LineChart.Circle.tsx +22 -11
- package/src/components/LineChart/helpers.ts +134 -10
- package/src/components/LineChart/index.tsx +69 -42
- package/src/components/LinearChart.jsx +155 -139
- package/src/components/ZoomBrush.tsx +40 -21
- package/src/data/initial-state.js +4 -4
- package/src/hooks/useBarChart.js +47 -22
- package/src/hooks/useMinMax.ts +21 -2
- package/src/hooks/useScales.ts +23 -23
- package/src/hooks/useTooltip.tsx +11 -11
- package/src/scss/main.scss +56 -6
- package/src/types/ChartConfig.ts +3 -13
- package/src/types/ChartContext.ts +4 -0
- package/src/_stories/ChartLine.preliminary.tsx +0 -19
- package/src/_stories/ChartSuppress.stories.tsx +0 -19
- package/src/_stories/_mock/suppress_mock.json +0 -911
- package/src/helpers/computeMarginBottom.ts +0 -56
package/index.html
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
-->
|
|
47
47
|
|
|
48
48
|
<!-- GENERIC CHART TYPES -->
|
|
49
|
-
<div class="react-container" data-config="/examples/test.json"></div>
|
|
49
|
+
<!-- <div class="react-container" data-config="/examples/test.json"></div> -->
|
|
50
50
|
<!-- <div class="react-container" data-config="/examples/private/rvr.json"></div> -->
|
|
51
51
|
<!-- <div class="react-container" data-config="/examples/feature/filters/url-filter.json"></div> -->
|
|
52
52
|
<!-- <div class="react-container" data-config="/examples/feature/bar/additional-column-tooltip.json"></div> -->
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<!-- <div class="react-container" data-config="/examples/feature/forest-plot/forest-plot.json"></div> -->
|
|
59
59
|
<!-- <div class="react-container" data-config="/examples/feature/pie/planet-pie-example-config.json"></div> -->
|
|
60
60
|
<!-- <div class="react-container" data-config=https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Line_Chart_Viz.json></div> -->
|
|
61
|
-
<div class="react-container" data-config=/examples/feature/regions/index.json></div>
|
|
61
|
+
<!-- <div class="react-container" data-config=/examples/feature/regions/index.json></div> -->
|
|
62
62
|
<!-- <div class="react-container" data-config=https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Line_Chart_Regions_Viz.json></div> -->
|
|
63
63
|
<!-- <div class="react-container" data-config=https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/examples/Line_Chart_Regions_Viz.json></div> -->
|
|
64
64
|
<!-- <div class="react-container" data-config="/examples/feature/forecasting/forecasting.json"></div> -->
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<!-- BAR -->
|
|
77
77
|
<!-- <div class="react-container" data-config="/examples/feature/bar/planet-example-config.json"></div> -->
|
|
78
78
|
<!-- <div class="react-container" data-config="/examples/feature/bar/planet-chart-horizontal-example-config.json"></div> -->
|
|
79
|
-
<div class="react-container" data-config="/examples/feature/bar/example-bar-chart.json"></div>
|
|
79
|
+
<!-- <div class="react-container" data-config="/examples/feature/bar/example-bar-chart.json"></div> -->
|
|
80
80
|
<!-- <div class="react-container" data-config="/examples/feature/bar/horizontal-chart-max-increase.json"></div> -->
|
|
81
81
|
<!-- <div class="react-container" data-config="/examples/feature/bar/horizontal-chart.json"></div> -->
|
|
82
82
|
<!-- <div class="react-container" data-config="/examples/feature/bar/horizontal-stacked-bar-chart.json"></div> -->
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
<!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/example-bar-chart-nonnumeric.json"></div> -->
|
|
118
118
|
<!-- <div class="react-container" data-config="/examples/sparkline.json"></div> -->
|
|
119
119
|
<!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/sparkline-chart-nonnumeric.json"></div> -->
|
|
120
|
-
<div class="react-container" data-config="/examples/region-issue.json"></div>
|
|
120
|
+
<!-- <div class="react-container" data-config="/examples/region-issue.json"></div> -->
|
|
121
121
|
<!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/stacked-vertical-bar-example-nonnumerics.json"></div> -->
|
|
122
122
|
|
|
123
123
|
<!-- TESTS CUTOFF -->
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
|
|
136
136
|
<!-- GENERIC CHART TYPES -->
|
|
137
137
|
<!-- <div class="react-container" data-config="/examples/gallery/paired-bar/paired-bar-chart.json"></div> -->
|
|
138
|
-
<div class="react-container" data-config="/examples/feature/line/line-chart.json"></div>
|
|
138
|
+
<!-- <div class="react-container" data-config="/examples/feature/line/line-chart.json"></div> -->
|
|
139
139
|
|
|
140
140
|
<!-- HORIZONTAL BAR CHARTS -->
|
|
141
141
|
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json"></div> -->
|
|
@@ -143,9 +143,9 @@
|
|
|
143
143
|
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-stacked.json"></div> -->
|
|
144
144
|
|
|
145
145
|
<!-- VERTICAL BAR CHARTS -->
|
|
146
|
-
|
|
146
|
+
<div class="react-container" data-config="/examples/gallery/bar-chart-vertical/combo-line-chart.json"></div>
|
|
147
147
|
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json"></div> -->
|
|
148
|
-
<div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div>
|
|
148
|
+
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div> -->
|
|
149
149
|
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-confidence.json"></div> -->
|
|
150
150
|
<!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart.json"></div> -->
|
|
151
151
|
<!-- <div class="react-container" data-config="https://www.cdc.gov/respiratory-viruses/modules/respiratory-virus-activity/emergency-dept-visits_live.json"></div> -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/chart",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.5",
|
|
4
4
|
"description": "React component for visualizing tabular data in various types of charts",
|
|
5
5
|
"moduleName": "CdcChart",
|
|
6
6
|
"main": "dist/cdcchart",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "def85aaf4cd9dc1983e80f2900199f35de82af95",
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/d3-sankey": "^0.12.4",
|
|
66
66
|
"resize-observer-polyfill": "^1.5.1"
|
package/src/CdcChart.tsx
CHANGED
|
@@ -36,7 +36,6 @@ import { handleChartAriaLabels } from './helpers/handleChartAriaLabels'
|
|
|
36
36
|
import { lineOptions } from './helpers/lineOptions'
|
|
37
37
|
import { handleLineType } from './helpers/handleLineType'
|
|
38
38
|
import { generateColorsArray } from './helpers/generateColorsArray'
|
|
39
|
-
import { computeMarginBottom } from './helpers/computeMarginBottom'
|
|
40
39
|
import Loading from '@cdc/core/components/Loading'
|
|
41
40
|
import Filters from '@cdc/core/components/Filters'
|
|
42
41
|
import MediaControls from '@cdc/core/components/MediaControls'
|
|
@@ -78,6 +77,11 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
78
77
|
const [coveLoadedEventRan, setCoveLoadedEventRan] = useState(false)
|
|
79
78
|
const [dynamicLegendItems, setDynamicLegendItems] = useState<any[]>([])
|
|
80
79
|
const [imageId] = useState(`cove-${Math.random().toString(16).slice(-4)}`)
|
|
80
|
+
const [brushConfig, setBrushConfig] = useState({
|
|
81
|
+
data: [],
|
|
82
|
+
isActive: false,
|
|
83
|
+
isBrushing: false
|
|
84
|
+
})
|
|
81
85
|
type Config = typeof config
|
|
82
86
|
let legendMemo = useRef(new Map()) // map collection
|
|
83
87
|
let innerContainerRef = useRef()
|
|
@@ -240,8 +244,10 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
240
244
|
}
|
|
241
245
|
if (undefined === newConfig.table.show) newConfig.table.show = !isDashboard
|
|
242
246
|
|
|
243
|
-
newConfig.series.
|
|
244
|
-
if (
|
|
247
|
+
newConfig.series.forEach(series => {
|
|
248
|
+
if (series.tooltip === undefined || series.tooltip === null) {
|
|
249
|
+
series.tooltip = true
|
|
250
|
+
}
|
|
245
251
|
if (!series.axis) series.axis = 'Left'
|
|
246
252
|
})
|
|
247
253
|
|
|
@@ -749,7 +755,7 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
749
755
|
}
|
|
750
756
|
|
|
751
757
|
// function calculates the width of given text and its font-size
|
|
752
|
-
function getTextWidth(text, font) {
|
|
758
|
+
function getTextWidth(text: string, font: string): number | undefined {
|
|
753
759
|
const canvas = document.createElement('canvas')
|
|
754
760
|
const context = canvas.getContext('2d')
|
|
755
761
|
if (!context) {
|
|
@@ -1133,11 +1139,9 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
1133
1139
|
<SkipTo skipId={handleChartTabbing} skipMessage='Skip Over Chart Container' />
|
|
1134
1140
|
{/* Visualization */}
|
|
1135
1141
|
{config?.introText && config.visualizationType !== 'Spark Line' && <section className='introText'>{parse(config.introText)}</section>}
|
|
1136
|
-
|
|
1137
|
-
<div style={{ marginBottom: computeMarginBottom(config, legend, currentViewport) }} className={getChartWrapperClasses().join(' ')}>
|
|
1142
|
+
<div className={getChartWrapperClasses().join(' ')}>
|
|
1138
1143
|
{/* All charts except sparkline */}
|
|
1139
1144
|
{config.visualizationType !== 'Spark Line' && chartComponents[config.visualizationType]}
|
|
1140
|
-
|
|
1141
1145
|
{/* Sparkline */}
|
|
1142
1146
|
{config.visualizationType === 'Spark Line' && (
|
|
1143
1147
|
<>
|
|
@@ -1163,22 +1167,19 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
1163
1167
|
</div>
|
|
1164
1168
|
{/* Link */}
|
|
1165
1169
|
{isDashboard && config.table && config.table.show && config.table.showDataTableLink ? tableLink : link && link}
|
|
1166
|
-
|
|
1167
1170
|
{/* Description */}
|
|
1168
1171
|
{description && config.visualizationType !== 'Spark Line' && <div className={'column ' + config.isResponsiveTicks ? 'subtext--responsive-ticks' : 'subtext'}>{parse(description)}</div>}
|
|
1169
|
-
|
|
1170
1172
|
{/* buttons */}
|
|
1171
1173
|
<MediaControls.Section classes={['download-buttons']}>
|
|
1172
1174
|
{config.table.showDownloadImgButton && <MediaControls.Button text='Download Image' title='Download Chart as Image' type='image' state={config} elementToCapture={imageId} />}
|
|
1173
1175
|
{config.table.showDownloadPdfButton && <MediaControls.Button text='Download PDF' title='Download Chart as PDF' type='pdf' state={config} elementToCapture={imageId} />}
|
|
1174
1176
|
</MediaControls.Section>
|
|
1175
|
-
|
|
1176
1177
|
{/* Data Table */}
|
|
1177
1178
|
{((config.xAxis.dataKey && config.table.show && config.visualizationType !== 'Spark Line' && config.visualizationType !== 'Sankey') || (config.visualizationType === 'Sankey' && config.table.show)) && (
|
|
1178
1179
|
<DataTable
|
|
1179
1180
|
config={config}
|
|
1180
1181
|
rawData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : config.table.customTableConfig ? filterData(config.filters, config.data) : config.data}
|
|
1181
|
-
runtimeData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData :
|
|
1182
|
+
runtimeData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : filteredData || excludedData}
|
|
1182
1183
|
expandDataTable={config.table.expanded}
|
|
1183
1184
|
columns={config.columns}
|
|
1184
1185
|
displayDataAsText={displayDataAsText}
|
|
@@ -1207,9 +1208,11 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
1207
1208
|
const capitalize = str => {
|
|
1208
1209
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
1209
1210
|
}
|
|
1211
|
+
|
|
1210
1212
|
const contextValues = {
|
|
1213
|
+
brushConfig,
|
|
1214
|
+
setBrushConfig,
|
|
1211
1215
|
capitalize,
|
|
1212
|
-
computeMarginBottom,
|
|
1213
1216
|
getXAxisData,
|
|
1214
1217
|
getYAxisData,
|
|
1215
1218
|
config,
|
|
@@ -1254,7 +1257,8 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
|
|
|
1254
1257
|
setSharedFilter,
|
|
1255
1258
|
setSharedFilterValue,
|
|
1256
1259
|
dashboardConfig,
|
|
1257
|
-
debugSvg: isDebug
|
|
1260
|
+
debugSvg: isDebug,
|
|
1261
|
+
clean
|
|
1258
1262
|
}
|
|
1259
1263
|
|
|
1260
1264
|
return (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import SuppressedConfig from './_mock/bar-chart-suppressed.json'
|
|
2
3
|
|
|
3
4
|
import Chart from '../CdcChart'
|
|
4
5
|
|
|
@@ -185,4 +186,11 @@ export const Lollipop: Story = {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
export const Suppression: Story = {
|
|
190
|
+
args: {
|
|
191
|
+
config: SuppressedConfig,
|
|
192
|
+
isEditor: false
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
188
196
|
export default meta
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "chart",
|
|
3
|
+
"debugSvg": false,
|
|
4
|
+
"chartMessage": {
|
|
5
|
+
"noData": "No Data Available"
|
|
6
|
+
},
|
|
7
|
+
"title": "Combo Bar-Line Chart",
|
|
8
|
+
"showTitle": true,
|
|
9
|
+
"showDownloadMediaButton": false,
|
|
10
|
+
"theme": "theme-purple",
|
|
11
|
+
"animate": false,
|
|
12
|
+
"fontSize": "medium",
|
|
13
|
+
"lineDatapointStyle": "hover",
|
|
14
|
+
"lineDatapointColor": "Same as Line",
|
|
15
|
+
"barHasBorder": "false",
|
|
16
|
+
"isLollipopChart": false,
|
|
17
|
+
"lollipopShape": "circle",
|
|
18
|
+
"lollipopColorStyle": "two-tone",
|
|
19
|
+
"visualizationSubType": "regular",
|
|
20
|
+
"barStyle": "",
|
|
21
|
+
"roundingStyle": "standard",
|
|
22
|
+
"tipRounding": "top",
|
|
23
|
+
"isResponsiveTicks": false,
|
|
24
|
+
"general": {
|
|
25
|
+
"showDownloadButton": false
|
|
26
|
+
},
|
|
27
|
+
"padding": {
|
|
28
|
+
"left": 5,
|
|
29
|
+
"right": 5
|
|
30
|
+
},
|
|
31
|
+
"preliminaryData": [
|
|
32
|
+
{
|
|
33
|
+
"type": "suppression",
|
|
34
|
+
"seriesKey": "",
|
|
35
|
+
"label": "Suppressed",
|
|
36
|
+
"column": "Data 2",
|
|
37
|
+
"value": "ABC",
|
|
38
|
+
"style": "",
|
|
39
|
+
"displayTooltip": true,
|
|
40
|
+
"displayLegend": true,
|
|
41
|
+
"displayTable": true,
|
|
42
|
+
"symbol": "Dagger",
|
|
43
|
+
"iconCode": "†",
|
|
44
|
+
"lineCode": ""
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"yAxis": {
|
|
48
|
+
"hideAxis": false,
|
|
49
|
+
"displayNumbersOnBar": false,
|
|
50
|
+
"hideLabel": false,
|
|
51
|
+
"hideTicks": false,
|
|
52
|
+
"size": "68",
|
|
53
|
+
"gridLines": true,
|
|
54
|
+
"enablePadding": false,
|
|
55
|
+
"min": "",
|
|
56
|
+
"max": "",
|
|
57
|
+
"labelColor": "#333",
|
|
58
|
+
"tickLabelColor": "#333",
|
|
59
|
+
"tickColor": "#333",
|
|
60
|
+
"rightHideAxis": true,
|
|
61
|
+
"rightAxisSize": 50,
|
|
62
|
+
"rightLabel": "",
|
|
63
|
+
"rightLabelOffsetSize": 0,
|
|
64
|
+
"rightAxisLabelColor": "#333",
|
|
65
|
+
"rightAxisTickLabelColor": "#333",
|
|
66
|
+
"rightAxisTickColor": "#333",
|
|
67
|
+
"numTicks": "",
|
|
68
|
+
"axisPadding": 0,
|
|
69
|
+
"scalePadding": 10,
|
|
70
|
+
"tickRotation": 0,
|
|
71
|
+
"anchors": [],
|
|
72
|
+
"label": "Y-Axis Label Example"
|
|
73
|
+
},
|
|
74
|
+
"boxplot": {
|
|
75
|
+
"plots": [],
|
|
76
|
+
"borders": "true",
|
|
77
|
+
"firstQuartilePercentage": 25,
|
|
78
|
+
"thirdQuartilePercentage": 75,
|
|
79
|
+
"boxWidthPercentage": 40,
|
|
80
|
+
"plotOutlierValues": false,
|
|
81
|
+
"plotNonOutlierValues": true,
|
|
82
|
+
"legend": {
|
|
83
|
+
"showHowToReadText": false,
|
|
84
|
+
"howToReadText": ""
|
|
85
|
+
},
|
|
86
|
+
"labels": {
|
|
87
|
+
"q1": "Lower Quartile",
|
|
88
|
+
"q2": "q2",
|
|
89
|
+
"q3": "Upper Quartile",
|
|
90
|
+
"q4": "q4",
|
|
91
|
+
"minimum": "Minimum",
|
|
92
|
+
"maximum": "Maximum",
|
|
93
|
+
"mean": "Mean",
|
|
94
|
+
"median": "Median",
|
|
95
|
+
"sd": "Standard Deviation",
|
|
96
|
+
"iqr": "Interquartile Range",
|
|
97
|
+
"total": "Total",
|
|
98
|
+
"outliers": "Outliers",
|
|
99
|
+
"values": "Values"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"topAxis": {
|
|
103
|
+
"hasLine": false
|
|
104
|
+
},
|
|
105
|
+
"isLegendValue": false,
|
|
106
|
+
"barThickness": 0.35,
|
|
107
|
+
"barHeight": 25,
|
|
108
|
+
"barSpace": 15,
|
|
109
|
+
"heights": {
|
|
110
|
+
"vertical": 300,
|
|
111
|
+
"horizontal": 750
|
|
112
|
+
},
|
|
113
|
+
"xAxis": {
|
|
114
|
+
"sortDates": false,
|
|
115
|
+
"anchors": [],
|
|
116
|
+
"type": "date",
|
|
117
|
+
"showTargetLabel": true,
|
|
118
|
+
"targetLabel": "Target",
|
|
119
|
+
"hideAxis": false,
|
|
120
|
+
"hideLabel": false,
|
|
121
|
+
"hideTicks": false,
|
|
122
|
+
"size": "78",
|
|
123
|
+
"tickRotation": "25",
|
|
124
|
+
"min": "",
|
|
125
|
+
"max": "",
|
|
126
|
+
"labelColor": "#333",
|
|
127
|
+
"tickLabelColor": "#333",
|
|
128
|
+
"tickColor": "#333",
|
|
129
|
+
"numTicks": "",
|
|
130
|
+
"labelOffset": 65,
|
|
131
|
+
"axisPadding": 0,
|
|
132
|
+
"target": 0,
|
|
133
|
+
"maxTickRotation": 0,
|
|
134
|
+
"showSuppressedSymbol": true,
|
|
135
|
+
"showSuppressedLine": true,
|
|
136
|
+
"dataKey": "Date",
|
|
137
|
+
"label": "X-Axis Example Label",
|
|
138
|
+
"dateParseFormat": "%d/%m/%Y",
|
|
139
|
+
"dateDisplayFormat": "%d/%m/%Y",
|
|
140
|
+
"tickWidthMax": 91,
|
|
141
|
+
"padding": 6
|
|
142
|
+
},
|
|
143
|
+
"table": {
|
|
144
|
+
"label": "Data Table",
|
|
145
|
+
"expanded": true,
|
|
146
|
+
"limitHeight": false,
|
|
147
|
+
"height": "",
|
|
148
|
+
"caption": "",
|
|
149
|
+
"showDownloadUrl": false,
|
|
150
|
+
"showDataTableLink": true,
|
|
151
|
+
"indexLabel": "",
|
|
152
|
+
"download": true,
|
|
153
|
+
"showVertical": false,
|
|
154
|
+
"dateDisplayFormat": "",
|
|
155
|
+
"show": true
|
|
156
|
+
},
|
|
157
|
+
"orientation": "vertical",
|
|
158
|
+
"color": "pinkpurple",
|
|
159
|
+
"columns": {},
|
|
160
|
+
"legend": {
|
|
161
|
+
"hide": false,
|
|
162
|
+
"behavior": "highlight",
|
|
163
|
+
"axisAlign": true,
|
|
164
|
+
"singleRow": false,
|
|
165
|
+
"colorCode": "",
|
|
166
|
+
"reverseLabelOrder": false,
|
|
167
|
+
"description": "",
|
|
168
|
+
"dynamicLegend": false,
|
|
169
|
+
"dynamicLegendDefaultText": "Show All",
|
|
170
|
+
"dynamicLegendItemLimit": 5,
|
|
171
|
+
"dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
|
|
172
|
+
"dynamicLegendChartMessage": "Select Options from the Legend",
|
|
173
|
+
"lineMode": false,
|
|
174
|
+
"verticalSorted": false,
|
|
175
|
+
"highlightOnHover": false,
|
|
176
|
+
"hideSuppressedLabels": false,
|
|
177
|
+
"seriesHighlight": [],
|
|
178
|
+
"position": "right",
|
|
179
|
+
"label": "Data Type"
|
|
180
|
+
},
|
|
181
|
+
"brush": {
|
|
182
|
+
"height": 25,
|
|
183
|
+
"active": false,
|
|
184
|
+
"data": [
|
|
185
|
+
{
|
|
186
|
+
"Date": "1/15/2016",
|
|
187
|
+
"Data 1": "1000",
|
|
188
|
+
"Data 2": "110",
|
|
189
|
+
"Data 3": "100",
|
|
190
|
+
"Data 4": "90",
|
|
191
|
+
"Monthly-Goal": "100"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"Date": "2/15/2016",
|
|
195
|
+
"Data 1": "100",
|
|
196
|
+
"Data 2": "110",
|
|
197
|
+
"Data 3": "100",
|
|
198
|
+
"Data 4": "100",
|
|
199
|
+
"Monthly-Goal": "100"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"Date": "3/15/2016",
|
|
203
|
+
"Data 1": "80",
|
|
204
|
+
"Data 2": "90",
|
|
205
|
+
"Data 3": "100",
|
|
206
|
+
"Data 4": "120",
|
|
207
|
+
"Monthly-Goal": "110"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"Date": "4/15/2016",
|
|
211
|
+
"Data 1": "80",
|
|
212
|
+
"Data 2": "90",
|
|
213
|
+
"Data 3": "110",
|
|
214
|
+
"Data 4": "120",
|
|
215
|
+
"Monthly-Goal": "110"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"Date": "5/15/2016",
|
|
219
|
+
"Data 1": "70",
|
|
220
|
+
"Data 2": "90",
|
|
221
|
+
"Data 3": "110",
|
|
222
|
+
"Data 4": "130",
|
|
223
|
+
"Monthly-Goal": "120"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"Date": "6/15/2016",
|
|
227
|
+
"Data 1": "100",
|
|
228
|
+
"Data 2": "120",
|
|
229
|
+
"Data 3": "120",
|
|
230
|
+
"Data 4": "130",
|
|
231
|
+
"Monthly-Goal": "120"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"Date": "7/15/2016",
|
|
235
|
+
"Data 1": "110",
|
|
236
|
+
"Data 2": "140",
|
|
237
|
+
"Data 3": "120",
|
|
238
|
+
"Data 4": "130",
|
|
239
|
+
"Monthly-Goal": "130"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"Date": "8/15/2016",
|
|
243
|
+
"Data 1": "110",
|
|
244
|
+
"Data 2": "130",
|
|
245
|
+
"Data 3": "120",
|
|
246
|
+
"Data 4": "140",
|
|
247
|
+
"Monthly-Goal": "130"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"Date": "9/15/2016",
|
|
251
|
+
"Data 1": "120",
|
|
252
|
+
"Data 2": "130",
|
|
253
|
+
"Data 3": "120",
|
|
254
|
+
"Data 4": "150",
|
|
255
|
+
"Monthly-Goal": "140"
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"exclusions": {
|
|
260
|
+
"active": false,
|
|
261
|
+
"keys": []
|
|
262
|
+
},
|
|
263
|
+
"palette": "qualitative-soft",
|
|
264
|
+
"isPaletteReversed": false,
|
|
265
|
+
"twoColor": {
|
|
266
|
+
"palette": "monochrome-1",
|
|
267
|
+
"isPaletteReversed": false
|
|
268
|
+
},
|
|
269
|
+
"labels": true,
|
|
270
|
+
"dataFormat": {
|
|
271
|
+
"commas": false,
|
|
272
|
+
"prefix": "",
|
|
273
|
+
"suffix": "",
|
|
274
|
+
"abbreviated": false,
|
|
275
|
+
"bottomSuffix": "",
|
|
276
|
+
"bottomPrefix": "",
|
|
277
|
+
"bottomAbbreviated": false
|
|
278
|
+
},
|
|
279
|
+
"confidenceKeys": {},
|
|
280
|
+
"visual": {
|
|
281
|
+
"border": true,
|
|
282
|
+
"accent": true,
|
|
283
|
+
"background": true,
|
|
284
|
+
"verticalHoverLine": false,
|
|
285
|
+
"horizontalHoverLine": false
|
|
286
|
+
},
|
|
287
|
+
"useLogScale": false,
|
|
288
|
+
"filterBehavior": "Filter Change",
|
|
289
|
+
"highlightedBarValues": [],
|
|
290
|
+
"series": [
|
|
291
|
+
{
|
|
292
|
+
"dataKey": "Data 2",
|
|
293
|
+
"type": "Bar",
|
|
294
|
+
"axis": "Left",
|
|
295
|
+
"tooltip": true
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"tooltips": {
|
|
299
|
+
"opacity": 90,
|
|
300
|
+
"singleSeries": false,
|
|
301
|
+
"dateDisplayFormat": ""
|
|
302
|
+
},
|
|
303
|
+
"forestPlot": {
|
|
304
|
+
"startAt": 0,
|
|
305
|
+
"colors": {
|
|
306
|
+
"line": "",
|
|
307
|
+
"shape": ""
|
|
308
|
+
},
|
|
309
|
+
"lineOfNoEffect": {
|
|
310
|
+
"show": true
|
|
311
|
+
},
|
|
312
|
+
"type": "",
|
|
313
|
+
"pooledResult": {
|
|
314
|
+
"diamondHeight": 5,
|
|
315
|
+
"column": ""
|
|
316
|
+
},
|
|
317
|
+
"estimateField": "",
|
|
318
|
+
"estimateRadius": "",
|
|
319
|
+
"shape": "",
|
|
320
|
+
"rowHeight": 20,
|
|
321
|
+
"description": {
|
|
322
|
+
"show": true,
|
|
323
|
+
"text": "description",
|
|
324
|
+
"location": 0
|
|
325
|
+
},
|
|
326
|
+
"result": {
|
|
327
|
+
"show": true,
|
|
328
|
+
"text": "result",
|
|
329
|
+
"location": 100
|
|
330
|
+
},
|
|
331
|
+
"radius": {
|
|
332
|
+
"min": 1,
|
|
333
|
+
"max": 8,
|
|
334
|
+
"scalingColumn": ""
|
|
335
|
+
},
|
|
336
|
+
"regression": {
|
|
337
|
+
"lower": 0,
|
|
338
|
+
"upper": 0,
|
|
339
|
+
"estimateField": 0
|
|
340
|
+
},
|
|
341
|
+
"leftWidthOffset": 0,
|
|
342
|
+
"rightWidthOffset": 0,
|
|
343
|
+
"showZeroLine": false,
|
|
344
|
+
"leftLabel": "",
|
|
345
|
+
"rightLabel": "",
|
|
346
|
+
"hideDateCategoryCol": false
|
|
347
|
+
},
|
|
348
|
+
"area": {
|
|
349
|
+
"isStacked": false
|
|
350
|
+
},
|
|
351
|
+
"sankey": {
|
|
352
|
+
"title": {
|
|
353
|
+
"defaultColor": "black"
|
|
354
|
+
},
|
|
355
|
+
"iterations": 1,
|
|
356
|
+
"rxValue": 0.9,
|
|
357
|
+
"overallSize": {
|
|
358
|
+
"width": 900,
|
|
359
|
+
"height": 700
|
|
360
|
+
},
|
|
361
|
+
"margin": {
|
|
362
|
+
"margin_y": 25,
|
|
363
|
+
"margin_x": 0
|
|
364
|
+
},
|
|
365
|
+
"nodeSize": {
|
|
366
|
+
"nodeWidth": 26,
|
|
367
|
+
"nodeHeight": 40
|
|
368
|
+
},
|
|
369
|
+
"nodePadding": 55,
|
|
370
|
+
"nodeFontColor": "black",
|
|
371
|
+
"nodeColor": {
|
|
372
|
+
"default": "#ff8500",
|
|
373
|
+
"inactive": "#808080"
|
|
374
|
+
},
|
|
375
|
+
"linkColor": {
|
|
376
|
+
"default": "#ffc900",
|
|
377
|
+
"inactive": "#D3D3D3"
|
|
378
|
+
},
|
|
379
|
+
"opacity": {
|
|
380
|
+
"nodeOpacityDefault": 1,
|
|
381
|
+
"nodeOpacityInactive": 0.1,
|
|
382
|
+
"LinkOpacityDefault": 1,
|
|
383
|
+
"LinkOpacityInactive": 0.1
|
|
384
|
+
},
|
|
385
|
+
"storyNodeFontColor": "#006778",
|
|
386
|
+
"storyNodeText": [],
|
|
387
|
+
"nodeValueStyle": {
|
|
388
|
+
"textBefore": "(",
|
|
389
|
+
"textAfter": ")"
|
|
390
|
+
},
|
|
391
|
+
"data": []
|
|
392
|
+
},
|
|
393
|
+
"suppressedData": [],
|
|
394
|
+
"height": "332",
|
|
395
|
+
"data": [
|
|
396
|
+
{
|
|
397
|
+
"Date": "1/15/2016",
|
|
398
|
+
"Data 1": "$1,000",
|
|
399
|
+
"Data 2": "ABC",
|
|
400
|
+
"Data 3": "100",
|
|
401
|
+
"Data 4": "90",
|
|
402
|
+
"Monthly-Goal": "100"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"Date": "2/15/2016",
|
|
406
|
+
"Data 1": "100",
|
|
407
|
+
"Data 2": "110",
|
|
408
|
+
"Data 3": "100",
|
|
409
|
+
"Data 4": "100",
|
|
410
|
+
"Monthly-Goal": "100"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"Date": "3/15/2016",
|
|
414
|
+
"Data 1": "80",
|
|
415
|
+
"Data 2": "90",
|
|
416
|
+
"Data 3": "100",
|
|
417
|
+
"Data 4": "120",
|
|
418
|
+
"Monthly-Goal": "110"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"Date": "4/15/2016",
|
|
422
|
+
"Data 1": "80",
|
|
423
|
+
"Data 2": "90",
|
|
424
|
+
"Data 3": "110",
|
|
425
|
+
"Data 4": "120",
|
|
426
|
+
"Monthly-Goal": "110"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"Date": "5/15/2016",
|
|
430
|
+
"Data 1": "70",
|
|
431
|
+
"Data 2": "90",
|
|
432
|
+
"Data 3": "110",
|
|
433
|
+
"Data 4": "130",
|
|
434
|
+
"Monthly-Goal": "120"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"Date": "6/15/2016",
|
|
438
|
+
"Data 1": "100",
|
|
439
|
+
"Data 2": "120",
|
|
440
|
+
"Data 3": "120",
|
|
441
|
+
"Data 4": "130",
|
|
442
|
+
"Monthly-Goal": "120"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"Date": "7/15/2016",
|
|
446
|
+
"Data 1": "110",
|
|
447
|
+
"Data 2": "140",
|
|
448
|
+
"Data 3": "120",
|
|
449
|
+
"Data 4": "130",
|
|
450
|
+
"Monthly-Goal": "130"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"Date": "8/15/2016",
|
|
454
|
+
"Data 1": "110",
|
|
455
|
+
"Data 2": "130",
|
|
456
|
+
"Data 3": "120",
|
|
457
|
+
"Data 4": "140",
|
|
458
|
+
"Monthly-Goal": "130"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"Date": "9/15/2016",
|
|
462
|
+
"Data 1": "120",
|
|
463
|
+
"Data 2": "",
|
|
464
|
+
"Data 3": "120",
|
|
465
|
+
"Data 4": "150",
|
|
466
|
+
"Monthly-Goal": "140"
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"visualizationType": "Bar",
|
|
470
|
+
"filters": [],
|
|
471
|
+
"validated": 4.23,
|
|
472
|
+
"dynamicMarginTop": 0,
|
|
473
|
+
"version": "4.24.4"
|
|
474
|
+
}
|
|
@@ -14,8 +14,8 @@ import { bisector } from 'd3-array'
|
|
|
14
14
|
const AreaChart = props => {
|
|
15
15
|
const { xScale, yScale, yMax, xMax, handleTooltipMouseOver, handleTooltipMouseOff, isDebug, children } = props
|
|
16
16
|
// import data from context
|
|
17
|
-
let { transformedData, config, handleLineType, parseDate, formatDate, formatNumber, seriesHighlight, colorScale, rawData } = useContext(ConfigContext)
|
|
18
|
-
const data = config.brush.active &&
|
|
17
|
+
let { transformedData, config, handleLineType, parseDate, formatDate, formatNumber, seriesHighlight, colorScale, rawData, brushConfig } = useContext(ConfigContext)
|
|
18
|
+
const data = config.brush.active && brushConfig.data?.length ? brushConfig.data : transformedData
|
|
19
19
|
|
|
20
20
|
if (!data) return
|
|
21
21
|
|