@cdc/chart 4.23.4 → 4.23.6
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 +54845 -51755
- package/examples/feature/__data__/planet-example-data.json +14 -32
- package/examples/feature/__data__/planet-logaritmic-data.json +56 -0
- package/examples/feature/area/area-chart-category.json +240 -0
- package/examples/feature/bar/example-bar-chart.json +544 -22
- package/examples/feature/bar/new.json +561 -0
- package/examples/feature/bar/planet-chart-logaritmic-config.json +170 -0
- package/examples/feature/boxplot/valid-boxplot.csv +17 -0
- package/examples/feature/combo/right-issues.json +190 -0
- package/examples/feature/filters/filter-testing.json +37 -3
- package/examples/feature/forecasting/combo-forecasting.json +245 -0
- package/examples/feature/forecasting/forecasting.json +5325 -0
- package/examples/feature/forecasting/index.json +203 -0
- package/examples/feature/forecasting/random_data.csv +366 -0
- package/examples/feature/line/line-chart.json +3 -3
- package/examples/feature/test-highlight/test-highlight-2.json +789 -0
- package/examples/feature/test-highlight/test-highlight-vertical.json +561 -0
- package/examples/feature/test-highlight/test-highlight.json +100 -0
- package/examples/feature/tests-non-numerics/stacked-vertical-bar-example-nonnumerics.json +1 -2
- package/examples/gallery/bar-chart-horizontal/horizontal-highlight.json +345 -0
- package/examples/gallery/line/line.json +173 -1
- package/index.html +14 -8
- package/package.json +2 -2
- package/src/CdcChart.jsx +342 -25
- package/src/components/AreaChart.jsx +32 -40
- package/src/components/BarChart.jsx +147 -25
- package/src/components/DataTable.jsx +30 -12
- package/src/components/DeviationBar.jsx +32 -32
- package/src/components/EditorPanel.jsx +1902 -1126
- package/src/components/Forecasting.jsx +147 -0
- package/src/components/Legend.jsx +193 -243
- package/src/components/LineChart.jsx +4 -9
- package/src/components/LinearChart.jsx +263 -285
- package/src/components/Series.jsx +518 -0
- package/src/components/SparkLine.jsx +3 -3
- package/src/data/initial-state.js +24 -5
- package/src/hooks/useHighlightedBars.js +154 -0
- package/src/hooks/useMinMax.js +128 -0
- package/src/hooks/useReduceData.js +31 -57
- package/src/hooks/useRightAxis.js +8 -2
- package/src/hooks/useScales.js +196 -0
- /package/examples/feature/area/{area-chart.json → area-chart-date.json} +0 -0
|
@@ -8,7 +8,6 @@ import { Text } from '@visx/text'
|
|
|
8
8
|
import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
|
|
9
9
|
import ConfigContext from '../ConfigContext'
|
|
10
10
|
import useRightAxis from '../hooks/useRightAxis'
|
|
11
|
-
import isNumber from '@cdc/core/helpers/isNumber'
|
|
12
11
|
|
|
13
12
|
export default function LineChart({ xScale, yScale, getXAxisData, getYAxisData, xMax, yMax, seriesStyle = 'Line' }) {
|
|
14
13
|
const { colorPalettes, transformedData: data, colorScale, seriesHighlight, config, formatNumber, formatDate, parseDate, isNumber, updateConfig, handleLineType } = useContext(ConfigContext)
|
|
@@ -63,6 +62,8 @@ export default function LineChart({ xScale, yScale, getXAxisData, getYAxisData,
|
|
|
63
62
|
${yAxisTooltip}<br />
|
|
64
63
|
${xAxisTooltip}
|
|
65
64
|
</div>`
|
|
65
|
+
|
|
66
|
+
// TODO: move all instances of circleRadii to state.
|
|
66
67
|
let circleRadii = 4.5
|
|
67
68
|
|
|
68
69
|
return (
|
|
@@ -72,13 +73,7 @@ export default function LineChart({ xScale, yScale, getXAxisData, getYAxisData,
|
|
|
72
73
|
isNumber(d[seriesKey]) && (
|
|
73
74
|
<Group key={`series-${seriesKey}-point-${dataIndex}`}>
|
|
74
75
|
{/* Render legend */}
|
|
75
|
-
<Text
|
|
76
|
-
display={config.labels ? 'block' : 'none'}
|
|
77
|
-
x={xScale(getXAxisData(d))}
|
|
78
|
-
y={seriesAxis === 'Right' ? yScaleRight(getYAxisData(d, seriesKey)) : yScale(getYAxisData(d, seriesKey))}
|
|
79
|
-
fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
|
|
80
|
-
textAnchor='middle'
|
|
81
|
-
>
|
|
76
|
+
<Text display={config.labels ? 'block' : 'none'} x={xScale(getXAxisData(d))} y={seriesAxis === 'Right' ? yScaleRight(getYAxisData(d, seriesKey)) : yScale(getYAxisData(d, seriesKey))} fill={'#000'} textAnchor='middle'>
|
|
82
77
|
{formatNumber(d[seriesKey], 'left')}
|
|
83
78
|
</Text>
|
|
84
79
|
|
|
@@ -114,7 +109,7 @@ export default function LineChart({ xScale, yScale, getXAxisData, getYAxisData,
|
|
|
114
109
|
strokeOpacity={1}
|
|
115
110
|
strokeDasharray={lineType ? handleLineType(lineType) : 0}
|
|
116
111
|
defined={(item, i) => {
|
|
117
|
-
return item[
|
|
112
|
+
return item[seriesKey] !== '' && item[seriesKey] !== null && item[seriesKey] !== undefined
|
|
118
113
|
}}
|
|
119
114
|
/>
|
|
120
115
|
{config.animate && (
|