@cdc/chart 4.24.10 → 4.24.12-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdcchart.js +35019 -34301
- 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 +126 -14
- package/examples/feature/tests-date-exclusions/date-exclusions-config.json +372 -12
- package/examples/private/DEV-8850-2.json +493 -0
- package/examples/private/DEV-9822.json +574 -0
- package/examples/private/DEV-9840.json +553 -0
- package/examples/private/DEV-9850-3.json +461 -0
- package/examples/private/chart.json +1084 -0
- package/examples/private/ci_formatted.json +202 -0
- package/examples/private/ci_issue.json +3016 -0
- package/examples/private/completed.json +634 -0
- package/examples/private/dem-data-long.csv +20 -0
- package/examples/private/dem-data-long.json +36 -0
- package/examples/private/demographic_data.csv +157 -0
- package/examples/private/demographic_data.json +2654 -0
- package/examples/private/demographic_dynamic.json +443 -0
- package/examples/private/demographic_standard.json +560 -0
- package/examples/private/ehdi.json +29939 -0
- package/examples/private/test.json +493 -0
- package/index.html +10 -7
- package/package.json +2 -2
- package/src/CdcChart.tsx +132 -152
- package/src/_stories/Chart.Anchors.stories.tsx +31 -0
- package/src/_stories/Chart.CustomColors.stories.tsx +19 -0
- package/src/_stories/Chart.DynamicSeries.stories.tsx +34 -0
- package/src/_stories/Chart.Legend.Gradient.stories.tsx +42 -1
- package/src/_stories/Chart.stories.tsx +37 -6
- package/src/_stories/ChartAxisLabels.stories.tsx +4 -1
- 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/{examples/feature/area/area-chart-date-city-temperature.json → src/_stories/_mock/area_chart_stacked.json} +125 -27
- 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/src/_stories/_mock/line_chart_dynamic_ci.json +493 -0
- package/src/_stories/_mock/line_chart_non_dynamic_ci.json +522 -0
- package/{examples/feature/scatterplot/scatterplot.json → src/_stories/_mock/scatterplot_mock.json} +62 -92
- package/src/_stories/_mock/short_dates.json +288 -0
- package/src/_stories/_mock/suppression_mock.json +1549 -0
- package/src/components/AreaChart/components/AreaChart.Stacked.jsx +15 -3
- package/src/components/Axis/Categorical.Axis.tsx +2 -2
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +46 -37
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +43 -9
- package/src/components/BarChart/components/BarChart.Vertical.tsx +53 -47
- package/src/components/BarChart/helpers/getBarData.ts +28 -0
- package/src/components/BarChart/helpers/index.ts +1 -2
- package/src/components/BarChart/helpers/tests/getBarData.test.ts +74 -0
- package/src/components/BoxPlot/BoxPlot.tsx +131 -0
- package/src/components/BoxPlot/helpers/index.ts +54 -0
- package/src/components/BrushChart.tsx +23 -26
- package/src/components/EditorPanel/EditorPanel.tsx +117 -139
- 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 +122 -56
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -2
- package/src/components/EditorPanel/useEditorPermissions.ts +20 -2
- package/src/components/Legend/Legend.Component.tsx +11 -12
- package/src/components/Legend/Legend.tsx +16 -16
- package/src/components/Legend/helpers/getLegendClasses.ts +59 -0
- package/src/components/Legend/helpers/index.ts +2 -1
- package/src/components/Legend/tests/getLegendClasses.test.ts +115 -0
- package/src/components/LineChart/components/LineChart.Circle.tsx +1 -1
- package/src/components/LineChart/helpers.ts +49 -43
- package/src/components/LineChart/index.tsx +135 -83
- package/src/components/LinearChart.tsx +196 -181
- package/src/components/PieChart/PieChart.tsx +7 -1
- package/src/components/Sankey/components/ColumnList.tsx +19 -0
- package/src/components/Sankey/components/Sankey.tsx +479 -0
- package/src/components/Sankey/helpers/getSankeyTooltip.tsx +33 -0
- package/src/components/Sankey/index.tsx +1 -492
- package/src/components/Sankey/sankey.scss +22 -21
- package/src/components/Sankey/types/index.ts +1 -1
- package/src/components/Sankey/useSankeyAlert.tsx +60 -0
- package/src/components/ScatterPlot/ScatterPlot.jsx +20 -4
- package/src/data/initial-state.js +7 -12
- package/src/helpers/countNumOfTicks.ts +57 -0
- package/src/helpers/getQuartiles.ts +15 -18
- package/src/hooks/useMinMax.ts +44 -16
- package/src/hooks/useReduceData.ts +43 -10
- package/src/hooks/useScales.ts +90 -35
- package/src/hooks/useTooltip.tsx +59 -50
- package/src/scss/DataTable.scss +5 -0
- package/src/scss/main.scss +6 -20
- 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
- package/src/hooks/useLegendClasses.ts +0 -72
|
@@ -3,7 +3,7 @@ import React, { useContext } from 'react'
|
|
|
3
3
|
// VisX library imports
|
|
4
4
|
import * as allCurves from '@visx/curve'
|
|
5
5
|
import { Group } from '@visx/group'
|
|
6
|
-
import { LinePath, Bar, SplitLinePath } from '@visx/shape'
|
|
6
|
+
import { LinePath, Bar, SplitLinePath, AreaClosed } from '@visx/shape'
|
|
7
7
|
import { Text } from '@visx/text'
|
|
8
8
|
|
|
9
9
|
// CDC core components
|
|
@@ -17,6 +17,7 @@ import useRightAxis from '../../hooks/useRightAxis'
|
|
|
17
17
|
import { filterCircles, createStyles, createDataSegments } from './helpers'
|
|
18
18
|
import LineChartCircle from './components/LineChart.Circle'
|
|
19
19
|
import LineChartBumpCircle from './components/LineChart.BumpCircle'
|
|
20
|
+
import isNumber from '@cdc/core/helpers/isNumber'
|
|
20
21
|
|
|
21
22
|
// Types
|
|
22
23
|
import { type ChartContext } from '../../types/ChartContext'
|
|
@@ -38,7 +39,7 @@ const LineChart = (props: LineChartProps) => {
|
|
|
38
39
|
} = props
|
|
39
40
|
|
|
40
41
|
// prettier-ignore
|
|
41
|
-
const { colorScale, config, formatNumber, handleLineType,
|
|
42
|
+
const { colorScale, config, formatNumber, handleLineType, parseDate, seriesHighlight, tableData, transformedData, updateConfig, brushConfig,clean } = useContext<ChartContext>(ConfigContext)
|
|
42
43
|
const { yScaleRight } = useRightAxis({ config, yMax, data: transformedData, updateConfig })
|
|
43
44
|
if (!handleTooltipMouseOver) return
|
|
44
45
|
|
|
@@ -51,53 +52,51 @@ const LineChart = (props: LineChartProps) => {
|
|
|
51
52
|
data = clean(brushConfig.data)
|
|
52
53
|
tableD = clean(brushConfig.data)
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
const xPos = d => {
|
|
57
|
+
return xScale(getXAxisData(d)) + (xScale.bandwidth ? xScale.bandwidth() / 2 : 0)
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
return (
|
|
55
61
|
<ErrorBoundary component='LineChart'>
|
|
56
62
|
<Group left={Number(config.runtime.yAxis.size)}>
|
|
57
63
|
{' '}
|
|
58
64
|
{/* left - expects a number not a string */}
|
|
59
65
|
{(config.runtime.lineSeriesKeys || config.runtime.seriesKeys).map((seriesKey, index) => {
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const seriesAxis = seriesData
|
|
63
|
-
|
|
66
|
+
const seriesData = config.runtime.series.find(item => item.dataKey === seriesKey)
|
|
67
|
+
const lineType = seriesData.type
|
|
68
|
+
const seriesAxis = seriesData.axis || 'left'
|
|
69
|
+
const displayArea =
|
|
64
70
|
legend.behavior === 'highlight' || seriesHighlight.length === 0 || seriesHighlight.indexOf(seriesKey) !== -1
|
|
65
|
-
|
|
66
|
-
// styles for preliminary Data items
|
|
67
|
-
let styles = createStyles({
|
|
68
|
-
preliminaryData: config.preliminaryData,
|
|
69
|
-
data: tableD,
|
|
70
|
-
stroke: colorScale(config.runtime.seriesLabels[seriesKey]),
|
|
71
|
-
strokeWidth: seriesData[0].weight || 2,
|
|
72
|
-
handleLineType,
|
|
73
|
-
lineType,
|
|
74
|
-
seriesKey
|
|
75
|
-
})
|
|
71
|
+
|
|
76
72
|
const suppressedSegments = createDataSegments(
|
|
77
73
|
tableData,
|
|
78
74
|
seriesKey,
|
|
79
75
|
config.preliminaryData,
|
|
80
76
|
config.xAxis.dataKey
|
|
81
77
|
)
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
return xScale(getXAxisData(d)) + (xScale.bandwidth ? xScale.bandwidth() / 2 : 0)
|
|
85
|
-
}
|
|
78
|
+
const isSplitLine =
|
|
79
|
+
config?.preliminaryData?.filter(pd => pd.style && !pd.style.includes('Circles')).length > 0
|
|
86
80
|
|
|
81
|
+
const _data = seriesData.dynamicCategory
|
|
82
|
+
? data.filter(d => d[seriesData.dynamicCategory] === seriesKey)
|
|
83
|
+
: data
|
|
84
|
+
const _seriesKey = seriesData.dynamicCategory ? seriesData.originalDataKey : seriesKey
|
|
85
|
+
const circleData = filterCircles(config?.preliminaryData, tableD, _seriesKey)
|
|
87
86
|
return (
|
|
88
87
|
<Group
|
|
89
|
-
key={`series-${seriesKey}`}
|
|
88
|
+
key={`series-${seriesKey}-${index}`}
|
|
90
89
|
opacity={
|
|
91
90
|
legend.behavior === 'highlight' &&
|
|
92
91
|
seriesHighlight.length > 0 &&
|
|
93
|
-
seriesHighlight.indexOf(
|
|
92
|
+
seriesHighlight.indexOf(_seriesKey) === -1
|
|
94
93
|
? 0.5
|
|
95
94
|
: 1
|
|
96
95
|
}
|
|
97
96
|
display={
|
|
98
97
|
legend.behavior === 'highlight' ||
|
|
99
98
|
(seriesHighlight.length === 0 && !legend.dynamicLegend) ||
|
|
100
|
-
seriesHighlight.indexOf(
|
|
99
|
+
seriesHighlight.indexOf(_seriesKey) !== -1
|
|
101
100
|
? 'block'
|
|
102
101
|
: 'none'
|
|
103
102
|
}
|
|
@@ -113,12 +112,9 @@ const LineChart = (props: LineChartProps) => {
|
|
|
113
112
|
onMouseOut={handleTooltipMouseOff}
|
|
114
113
|
onClick={e => handleTooltipClick(e, data)}
|
|
115
114
|
/>
|
|
116
|
-
{
|
|
115
|
+
{_data.map((d, dataIndex) => {
|
|
117
116
|
return (
|
|
118
|
-
d[
|
|
119
|
-
d[seriesKey] !== '' &&
|
|
120
|
-
d[seriesKey] !== null &&
|
|
121
|
-
isNumber(d[seriesKey]) && (
|
|
117
|
+
isNumber(d[_seriesKey]) && (
|
|
122
118
|
<React.Fragment key={`series-${seriesKey}-point-${dataIndex}`}>
|
|
123
119
|
{/* Render label */}
|
|
124
120
|
{config.labels && (
|
|
@@ -126,13 +122,13 @@ const LineChart = (props: LineChartProps) => {
|
|
|
126
122
|
x={xPos(d)}
|
|
127
123
|
y={
|
|
128
124
|
seriesAxis === 'Right'
|
|
129
|
-
? yScaleRight(getYAxisData(d,
|
|
130
|
-
: yScale(getYAxisData(d,
|
|
125
|
+
? yScaleRight(getYAxisData(d, _seriesKey))
|
|
126
|
+
: yScale(getYAxisData(d, _seriesKey))
|
|
131
127
|
}
|
|
132
128
|
fill={'#000'}
|
|
133
129
|
textAnchor='middle'
|
|
134
130
|
>
|
|
135
|
-
{formatNumber(d[
|
|
131
|
+
{formatNumber(d[_seriesKey], 'left')}
|
|
136
132
|
</Text>
|
|
137
133
|
)}
|
|
138
134
|
|
|
@@ -142,10 +138,10 @@ const LineChart = (props: LineChartProps) => {
|
|
|
142
138
|
dataIndex={dataIndex}
|
|
143
139
|
circleData={circleData}
|
|
144
140
|
tableData={tableData}
|
|
145
|
-
data={
|
|
141
|
+
data={_data}
|
|
146
142
|
d={d}
|
|
147
143
|
config={config}
|
|
148
|
-
seriesKey={
|
|
144
|
+
seriesKey={_seriesKey}
|
|
149
145
|
displayArea={displayArea}
|
|
150
146
|
tooltipData={tooltipData}
|
|
151
147
|
xScale={xScale}
|
|
@@ -163,10 +159,10 @@ const LineChart = (props: LineChartProps) => {
|
|
|
163
159
|
dataIndex={dataIndex}
|
|
164
160
|
tableData={tableData}
|
|
165
161
|
circleData={circleData}
|
|
166
|
-
data={
|
|
162
|
+
data={_data}
|
|
167
163
|
d={d}
|
|
168
164
|
config={config}
|
|
169
|
-
seriesKey={
|
|
165
|
+
seriesKey={_seriesKey}
|
|
170
166
|
displayArea={displayArea}
|
|
171
167
|
tooltipData={tooltipData}
|
|
172
168
|
xScale={xScale}
|
|
@@ -188,7 +184,7 @@ const LineChart = (props: LineChartProps) => {
|
|
|
188
184
|
dataIndex={0}
|
|
189
185
|
mode='HOVER_POINTS'
|
|
190
186
|
circleData={circleData}
|
|
191
|
-
data={
|
|
187
|
+
data={_data}
|
|
192
188
|
config={config}
|
|
193
189
|
seriesKey={seriesKey}
|
|
194
190
|
displayArea={displayArea}
|
|
@@ -203,78 +199,134 @@ const LineChart = (props: LineChartProps) => {
|
|
|
203
199
|
)}
|
|
204
200
|
</>
|
|
205
201
|
{/* SPLIT LINE */}
|
|
206
|
-
{
|
|
202
|
+
{isSplitLine ? (
|
|
207
203
|
<>
|
|
208
204
|
<SplitLinePath
|
|
209
|
-
curve={allCurves[seriesData
|
|
210
|
-
segments={
|
|
205
|
+
curve={allCurves[seriesData.lineType]}
|
|
206
|
+
segments={_data.map(d => [d])}
|
|
211
207
|
segmentation='x'
|
|
212
208
|
x={d => xPos(d)}
|
|
213
209
|
y={d =>
|
|
214
210
|
seriesAxis === 'Right'
|
|
215
|
-
? yScaleRight(getYAxisData(d,
|
|
216
|
-
: yScale(Number(getYAxisData(d,
|
|
211
|
+
? yScaleRight(getYAxisData(d, _seriesKey))
|
|
212
|
+
: yScale(Number(getYAxisData(d, _seriesKey)))
|
|
217
213
|
}
|
|
218
|
-
styles={
|
|
214
|
+
styles={createStyles({
|
|
215
|
+
preliminaryData: config.preliminaryData,
|
|
216
|
+
data: tableD,
|
|
217
|
+
stroke: colorScale(config.runtime.seriesLabels[seriesKey]),
|
|
218
|
+
strokeWidth: seriesData.weight || 2,
|
|
219
|
+
handleLineType,
|
|
220
|
+
lineType,
|
|
221
|
+
seriesKey
|
|
222
|
+
})}
|
|
219
223
|
defined={(item, i) => {
|
|
220
224
|
return item[seriesKey] !== '' && item[seriesKey] !== null && item[seriesKey] !== undefined
|
|
221
225
|
}}
|
|
222
226
|
/>
|
|
223
227
|
|
|
224
228
|
{suppressedSegments.map((segment, index) => {
|
|
225
|
-
return (
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
229
|
+
return Object.entries(segment.data).map(([key, value]) => {
|
|
230
|
+
return (
|
|
231
|
+
<LinePath
|
|
232
|
+
key={index}
|
|
233
|
+
data={value}
|
|
234
|
+
x={d => xPos(d)}
|
|
235
|
+
y={d =>
|
|
236
|
+
seriesAxis === 'Right'
|
|
237
|
+
? yScaleRight(getYAxisData(d, seriesKey))
|
|
238
|
+
: yScale(Number(getYAxisData(d, seriesKey)))
|
|
239
|
+
}
|
|
240
|
+
stroke={colorScale(config.runtime.seriesLabels[seriesKey])}
|
|
241
|
+
strokeWidth={seriesData[0]?.weight || 2}
|
|
242
|
+
strokeOpacity={1}
|
|
243
|
+
shapeRendering='geometricPrecision'
|
|
244
|
+
strokeDasharray={handleLineType(segment.style)}
|
|
245
|
+
defined={(item, i) => {
|
|
246
|
+
return item[seriesKey] !== '' && item[seriesKey] !== null && item[seriesKey] !== undefined
|
|
247
|
+
}}
|
|
248
|
+
/>
|
|
249
|
+
)
|
|
250
|
+
})
|
|
245
251
|
})}
|
|
246
252
|
</>
|
|
247
253
|
) : (
|
|
248
254
|
<>
|
|
255
|
+
{/* Confidence Interval Band */}
|
|
256
|
+
{config.confidenceKeys &&
|
|
257
|
+
config.series.map((seriesData, seriesKey) => {
|
|
258
|
+
if (seriesData.dynamicCategory) {
|
|
259
|
+
// Get unique categories from the data
|
|
260
|
+
const uniqueCategories = [...new Set(data.map(d => d[seriesData.dynamicCategory]))]
|
|
261
|
+
|
|
262
|
+
return uniqueCategories.map((category, categoryIndex) => {
|
|
263
|
+
const categoryData = data.filter(d => d[seriesData.dynamicCategory] === category)
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<AreaClosed
|
|
267
|
+
key={`area-closed-${seriesKey}-${categoryIndex}`}
|
|
268
|
+
data={categoryData}
|
|
269
|
+
x={d => xPos(d)}
|
|
270
|
+
y0={d => yScale(d[config.confidenceKeys.lower])} // Lower bound of the confidence interval
|
|
271
|
+
y1={d => yScale(d[config.confidenceKeys.upper])} // Upper bound of the confidence interval
|
|
272
|
+
opacity={0.5}
|
|
273
|
+
fill={colorScale(category)} // Optional: Color based on category
|
|
274
|
+
yScale={yScale}
|
|
275
|
+
curve={allCurves[seriesData.lineType as keyof typeof allCurves]}
|
|
276
|
+
/>
|
|
277
|
+
)
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Default behavior for non-dynamic categories
|
|
282
|
+
return (
|
|
283
|
+
<AreaClosed
|
|
284
|
+
key={`area-closed-${seriesKey}`}
|
|
285
|
+
data={data}
|
|
286
|
+
x={d => xPos(d)}
|
|
287
|
+
y0={d => yScale(d[config.confidenceKeys.lower])}
|
|
288
|
+
y1={d => yScale(d[config.confidenceKeys.upper])}
|
|
289
|
+
opacity={0.5}
|
|
290
|
+
fill={colorScale(
|
|
291
|
+
config.runtime.seriesLabels
|
|
292
|
+
? config.runtime.seriesLabels[seriesData.dataKey]
|
|
293
|
+
: seriesData.dataKey
|
|
294
|
+
)}
|
|
295
|
+
yScale={yScale}
|
|
296
|
+
curve={allCurves[seriesData.lineType as keyof typeof allCurves]}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
})}
|
|
300
|
+
|
|
249
301
|
{/* STANDARD LINE */}
|
|
250
302
|
<LinePath
|
|
251
|
-
curve={allCurves[seriesData
|
|
303
|
+
curve={allCurves[seriesData.lineType]}
|
|
252
304
|
data={
|
|
253
305
|
config.visualizationType == 'Bump Chart'
|
|
254
|
-
?
|
|
306
|
+
? _data
|
|
255
307
|
: config.xAxis.type === 'date-time' || config.xAxis.type === 'date'
|
|
256
|
-
?
|
|
308
|
+
? _data.sort((d1, d2) => {
|
|
257
309
|
let x1 = getXAxisData(d1)
|
|
258
310
|
let x2 = getXAxisData(d2)
|
|
259
311
|
if (x1 < x2) return -1
|
|
260
312
|
if (x2 < x1) return 1
|
|
261
313
|
return 0
|
|
262
314
|
})
|
|
263
|
-
:
|
|
315
|
+
: _data
|
|
264
316
|
}
|
|
265
317
|
x={d => xPos(d)}
|
|
266
318
|
y={d =>
|
|
267
319
|
seriesAxis === 'Right'
|
|
268
|
-
? yScaleRight(getYAxisData(d,
|
|
269
|
-
: yScale(Number(getYAxisData(d,
|
|
320
|
+
? yScaleRight(getYAxisData(d, _seriesKey))
|
|
321
|
+
: yScale(Number(getYAxisData(d, _seriesKey)))
|
|
270
322
|
}
|
|
271
323
|
stroke={colorScale(config.runtime.seriesLabels[seriesKey])}
|
|
272
|
-
strokeWidth={seriesData
|
|
324
|
+
strokeWidth={seriesData.weight || 2}
|
|
273
325
|
strokeOpacity={1}
|
|
274
326
|
shapeRendering='geometricPrecision'
|
|
275
327
|
strokeDasharray={lineType ? handleLineType(lineType) : 0}
|
|
276
328
|
defined={(item, i) => {
|
|
277
|
-
return item[
|
|
329
|
+
return item[_seriesKey] !== '' && item[_seriesKey] !== null && item[_seriesKey] !== undefined
|
|
278
330
|
}}
|
|
279
331
|
/>
|
|
280
332
|
</>
|
|
@@ -288,11 +340,11 @@ const LineChart = (props: LineChartProps) => {
|
|
|
288
340
|
cx={xPos(item.data)}
|
|
289
341
|
cy={
|
|
290
342
|
seriesAxis === 'Right'
|
|
291
|
-
? yScaleRight(getYAxisData(item.data,
|
|
292
|
-
: yScale(Number(getYAxisData(item.data,
|
|
343
|
+
? yScaleRight(getYAxisData(item.data, _seriesKey))
|
|
344
|
+
: yScale(Number(getYAxisData(item.data, _seriesKey)))
|
|
293
345
|
}
|
|
294
346
|
r={item.size}
|
|
295
|
-
strokeWidth={seriesData
|
|
347
|
+
strokeWidth={seriesData.weight || 2}
|
|
296
348
|
stroke={colorScale ? colorScale(config.runtime.seriesLabels[seriesKey]) : '#000'}
|
|
297
349
|
fill={
|
|
298
350
|
item.isFilled
|
|
@@ -309,13 +361,13 @@ const LineChart = (props: LineChartProps) => {
|
|
|
309
361
|
{config.animate && (
|
|
310
362
|
<LinePath
|
|
311
363
|
className='animation'
|
|
312
|
-
curve={allCurves[seriesData
|
|
313
|
-
data={
|
|
364
|
+
curve={allCurves[seriesData.lineType]}
|
|
365
|
+
data={_data}
|
|
314
366
|
x={d => xPos(d)}
|
|
315
367
|
y={d =>
|
|
316
368
|
seriesAxis === 'Right'
|
|
317
|
-
? yScaleRight(getYAxisData(d,
|
|
318
|
-
: yScale(Number(getYAxisData(d,
|
|
369
|
+
? yScaleRight(getYAxisData(d, _seriesKey))
|
|
370
|
+
: yScale(Number(getYAxisData(d, _seriesKey)))
|
|
319
371
|
}
|
|
320
372
|
stroke='#fff'
|
|
321
373
|
strokeWidth={3}
|
|
@@ -331,9 +383,9 @@ const LineChart = (props: LineChartProps) => {
|
|
|
331
383
|
{showLineSeriesLabels &&
|
|
332
384
|
(config.runtime.lineSeriesKeys || config.runtime.seriesKeys).map(seriesKey => {
|
|
333
385
|
let lastDatum
|
|
334
|
-
for (let i =
|
|
335
|
-
if (
|
|
336
|
-
lastDatum =
|
|
386
|
+
for (let i = _data.length - 1; i >= 0; i--) {
|
|
387
|
+
if (_data[i][seriesKey]) {
|
|
388
|
+
lastDatum = _data[i]
|
|
337
389
|
break
|
|
338
390
|
}
|
|
339
391
|
}
|
|
@@ -341,7 +393,7 @@ const LineChart = (props: LineChartProps) => {
|
|
|
341
393
|
return <></>
|
|
342
394
|
}
|
|
343
395
|
return (
|
|
344
|
-
<
|
|
396
|
+
<Text
|
|
345
397
|
x={xPos(lastDatum) + 5}
|
|
346
398
|
y={yScale(getYAxisData(lastDatum, seriesKey))}
|
|
347
399
|
alignmentBaseline='middle'
|
|
@@ -352,7 +404,7 @@ const LineChart = (props: LineChartProps) => {
|
|
|
352
404
|
}
|
|
353
405
|
>
|
|
354
406
|
{config.runtime.seriesLabels[seriesKey] || seriesKey}
|
|
355
|
-
</
|
|
407
|
+
</Text>
|
|
356
408
|
)
|
|
357
409
|
})}
|
|
358
410
|
</Group>
|