@cdc/chart 4.22.10 → 4.23.1

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 (80) hide show
  1. package/README.md +5 -5
  2. package/dist/495.js +3 -0
  3. package/dist/703.js +1 -0
  4. package/dist/cdcchart.js +723 -6
  5. package/examples/age-adjusted-rates.json +1486 -1218
  6. package/examples/box-plot-data.json +71 -0
  7. package/examples/box-plot.csv +5 -0
  8. package/examples/{private/yaxis-test.json → box-plot.json} +46 -54
  9. package/examples/case-rate-example-config.json +1 -1
  10. package/examples/covid-confidence-example-config.json +33 -33
  11. package/examples/covid-example-config.json +34 -34
  12. package/examples/covid-example-data-confidence.json +30 -30
  13. package/examples/covid-example-data.json +20 -20
  14. package/examples/cutoff-example-config.json +36 -36
  15. package/examples/cutoff-example-data.json +36 -36
  16. package/examples/date-exclusions-config.json +1 -1
  17. package/examples/dynamic-legends.json +124 -124
  18. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +191 -197
  19. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +230 -240
  20. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +239 -247
  21. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +138 -136
  22. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +79 -79
  23. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +80 -80
  24. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +67 -67
  25. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +179 -110
  26. package/examples/gallery/lollipop/lollipop-style-horizontal.json +215 -219
  27. package/examples/gallery/paired-bar/paired-bar-chart.json +195 -195
  28. package/examples/horizontal-chart.json +35 -35
  29. package/examples/horizontal-stacked-bar-chart.json +34 -34
  30. package/examples/line-chart.json +75 -75
  31. package/examples/new-data.csv +17 -0
  32. package/examples/newdata.json +90 -0
  33. package/examples/paired-bar-data.json +16 -14
  34. package/examples/paired-bar-example.json +48 -48
  35. package/examples/paired-bar-formatted.json +36 -36
  36. package/examples/planet-chart-horizontal-example-config.json +33 -33
  37. package/examples/planet-combo-example-config.json +34 -31
  38. package/examples/planet-example-config.json +35 -33
  39. package/examples/planet-example-data.json +56 -56
  40. package/examples/planet-pie-example-config.json +28 -28
  41. package/examples/stacked-vertical-bar-example.json +1 -1
  42. package/examples/temp-example-config.json +61 -54
  43. package/examples/temp-example-data.json +1 -1
  44. package/package.json +3 -2
  45. package/src/CdcChart.tsx +449 -434
  46. package/src/components/BarChart.tsx +383 -497
  47. package/src/components/BoxPlot.js +92 -0
  48. package/src/components/DataTable.tsx +182 -197
  49. package/src/components/EditorPanel.js +1068 -722
  50. package/src/components/Filters.js +131 -0
  51. package/src/components/Legend.js +286 -329
  52. package/src/components/LineChart.tsx +143 -81
  53. package/src/components/LinearChart.tsx +432 -451
  54. package/src/components/PairedBarChart.tsx +197 -213
  55. package/src/components/PieChart.tsx +105 -151
  56. package/src/components/SparkLine.js +179 -201
  57. package/src/components/useIntersectionObserver.tsx +19 -20
  58. package/src/context.tsx +3 -3
  59. package/src/data/initial-state.js +44 -17
  60. package/src/hooks/useActiveElement.js +13 -13
  61. package/src/hooks/useChartClasses.js +34 -28
  62. package/src/hooks/useColorPalette.ts +56 -63
  63. package/src/hooks/useLegendClasses.js +18 -10
  64. package/src/hooks/useReduceData.ts +64 -77
  65. package/src/hooks/useRightAxis.js +25 -0
  66. package/src/hooks/useTopAxis.js +6 -0
  67. package/src/index.html +19 -19
  68. package/src/index.tsx +13 -16
  69. package/src/scss/DataTable.scss +6 -5
  70. package/src/scss/editor-panel.scss +71 -69
  71. package/src/scss/main.scss +188 -114
  72. package/src/scss/variables.scss +1 -1
  73. package/examples/private/line-test-data.json +0 -22
  74. package/examples/private/line-test-two.json +0 -216
  75. package/examples/private/line-test.json +0 -102
  76. package/examples/private/newtest.csv +0 -101
  77. package/examples/private/shawn.json +0 -1296
  78. package/examples/private/test.json +0 -10124
  79. package/examples/private/yaxis-testing.csv +0 -27
  80. package/examples/private/yaxis.json +0 -28
@@ -1,207 +1,185 @@
1
- import React, { useContext, useEffect } from 'react';
2
-
3
- import * as allCurves from '@visx/curve';
4
- import { Group } from '@visx/group';
5
- import { LinePath } from '@visx/shape';
6
- import { Text } from '@visx/text';
7
- import { scaleLinear, scalePoint } from '@visx/scale';
8
- import { AxisBottom } from '@visx/axis';
9
- import { MarkerArrow } from '@visx/marker';
10
-
11
-
12
- import ErrorBoundary from '@cdc/core/components/ErrorBoundary';
13
-
14
- import ReactTooltip from 'react-tooltip';
15
-
16
- import useReduceData from '../hooks/useReduceData';
17
-
18
- import Context from '../context';
19
-
20
- export default function SparkLine({width: parentWidth, height: parentHeight}) {
21
-
22
- const { transformedData: data, dimensions, config, parseDate, formatDate, currentViewport, seriesHighlight, formatNumber, colorScale, handleChartAriaLabels } = useContext(Context);
23
- let width = parentWidth
24
- const { minValue, maxValue } = useReduceData(config, data)
25
-
26
- const margin = ({ top: 5, right: 10, bottom: 10, left: 10 })
27
- const height = parentHeight;
28
-
29
- const xMax = width - config.runtime.yAxis.size;
30
- const yMax = height - margin.top - 20;
31
-
32
- const getXAxisData = (d) => config.runtime.xAxis.type === 'date' ? (parseDate(d[config.runtime.originalXAxis.dataKey])).getTime() : d[config.runtime.originalXAxis.dataKey];
33
- const getYAxisData = (d, seriesKey) => d[seriesKey];
34
-
35
- let xScale;
36
- let yScale;
37
- let seriesScale;
38
- const {max:enteredMaxValue,min:enteredMinValue} = config.runtime.yAxis;
39
- const isMaxValid = Number(enteredMaxValue) >= Number(maxValue);
40
- const isMinValid = Number(enteredMinValue) <= Number(minValue);
41
-
42
- if (data) {
43
- let min = (enteredMinValue && isMinValid) ? enteredMinValue : minValue;
44
- let max = (enteredMaxValue && isMaxValid )? enteredMaxValue : Number.MIN_VALUE;
45
-
46
- if (max === Number.MIN_VALUE) {
47
- max = maxValue
48
- }
49
-
50
- //Adds Y Axis data padding if applicable
51
- if (config.runtime.yAxis.paddingPercent) {
52
- let paddingValue = (max - min) * config.runtime.yAxis.paddingPercent;
53
- min -= paddingValue;
54
- max += paddingValue;
55
- }
56
-
57
- let xAxisDataMapped = data.map(d => getXAxisData(d));
58
-
59
- if (config.runtime.horizontal) {
60
- xScale = scaleLinear({
61
- domain: [min, max],
62
- range: [0, xMax]
63
- });
64
-
65
- yScale = config.runtime.xAxis.type === 'date' ?
66
- scaleLinear({ domain: [Math.min(...xAxisDataMapped), Math.max(...xAxisDataMapped)] }) :
67
- scalePoint({ domain: xAxisDataMapped, padding: 0.5 });
68
-
69
- seriesScale = scalePoint({
70
- domain: (config.runtime.barSeriesKeys || config.runtime.seriesKeys),
71
- range: [0, yMax]
72
- });
73
-
74
- yScale.rangeRound([0, yMax]);
75
- } else {
76
- min = min < 0 ? min * 1.11 : min
77
-
78
- yScale = scaleLinear({
79
- domain: [min, max],
80
- range: [yMax - margin.bottom, margin.top]
81
- });
82
-
83
- xScale = scalePoint({
84
- domain: xAxisDataMapped,
85
- range: [margin.left, width - margin.right]
86
- });
87
-
88
- seriesScale = scalePoint({
89
- domain: (config.runtime.barSeriesKeys || config.runtime.seriesKeys),
90
- range: [0, xMax]
91
- });
92
- }
93
-
94
- }
95
-
96
- const handleSparkLineTicks = [xScale.domain()[0], xScale.domain()[xScale.domain().length - 1]];
97
-
98
- useEffect(() => {
99
- ReactTooltip.rebuild();
100
- });
101
-
102
- return (
103
- <ErrorBoundary component="SparkLine">
104
- <svg
105
- role="img"
106
- aria-label={handleChartAriaLabels(config)}
107
- width={width}
108
- height={height}
109
- className={'sparkline'}
110
- tabIndex={0}
111
- >
112
- {(config.runtime.lineSeriesKeys || config.runtime.seriesKeys).map((seriesKey, index) => (
113
- <>
114
- <Group
115
- className='sparkline-group'
116
- height={parentHeight}
117
- style={{ height: parentHeight}}
118
- top={margin.top}
119
- key={`series-${seriesKey}`}
120
- opacity={config.legend.behavior === "highlight" && seriesHighlight.length > 0 && seriesHighlight.indexOf(seriesKey) === -1 ? 0.5 : 1}
121
- display={config.legend.behavior === "highlight" || seriesHighlight.length === 0 || seriesHighlight.indexOf(seriesKey) !== -1 ? 'block' : 'none'}
122
- >
123
- {data.map((d, dataIndex) => {
124
- let yAxisTooltip = config.runtime.yAxis.label ? `${config.runtime.yAxis.label}: ${formatNumber(getYAxisData(d, seriesKey))}` : formatNumber(getYAxisData(d, seriesKey))
125
- let xAxisTooltip = config.runtime.xAxis.label ? `${config.runtime.xAxis.label}: ${d[config.runtime.xAxis.dataKey]}` : d[config.runtime.xAxis.dataKey]
126
-
127
- const tooltip = `<div>
1
+ import React, { useContext, useEffect } from 'react'
2
+
3
+ import * as allCurves from '@visx/curve'
4
+ import { Group } from '@visx/group'
5
+ import { LinePath } from '@visx/shape'
6
+ import { Text } from '@visx/text'
7
+ import { scaleLinear, scalePoint } from '@visx/scale'
8
+ import { AxisBottom } from '@visx/axis'
9
+ import { MarkerArrow } from '@visx/marker'
10
+
11
+ import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
12
+
13
+ import ReactTooltip from 'react-tooltip'
14
+
15
+ import useReduceData from '../hooks/useReduceData'
16
+
17
+ import Context from '../context'
18
+
19
+ export default function SparkLine({ width: parentWidth, height: parentHeight }) {
20
+ const { transformedData: data, dimensions, config, parseDate, formatDate, currentViewport, seriesHighlight, formatNumber, colorScale, handleChartAriaLabels } = useContext(Context)
21
+ let width = parentWidth
22
+ const { minValue, maxValue } = useReduceData(config, data)
23
+
24
+ const margin = { top: 5, right: 10, bottom: 10, left: 10 }
25
+ const height = parentHeight
26
+
27
+ const xMax = width - config.runtime.yAxis.size
28
+ const yMax = height - margin.top - 20
29
+
30
+ const getXAxisData = d => (config.runtime.xAxis.type === 'date' ? parseDate(d[config.runtime.originalXAxis.dataKey]).getTime() : d[config.runtime.originalXAxis.dataKey])
31
+ const getYAxisData = (d, seriesKey) => d[seriesKey]
32
+
33
+ let xScale
34
+ let yScale
35
+ let seriesScale
36
+ const { max: enteredMaxValue, min: enteredMinValue } = config.runtime.yAxis
37
+ const isMaxValid = Number(enteredMaxValue) >= Number(maxValue)
38
+ const isMinValid = Number(enteredMinValue) <= Number(minValue)
39
+
40
+ if (data) {
41
+ let min = enteredMinValue && isMinValid ? enteredMinValue : minValue
42
+ let max = enteredMaxValue && isMaxValid ? enteredMaxValue : Number.MIN_VALUE
43
+
44
+ if (max === Number.MIN_VALUE) {
45
+ max = maxValue
46
+ }
47
+
48
+ //Adds Y Axis data padding if applicable
49
+ if (config.runtime.yAxis.paddingPercent) {
50
+ let paddingValue = (max - min) * config.runtime.yAxis.paddingPercent
51
+ min -= paddingValue
52
+ max += paddingValue
53
+ }
54
+
55
+ let xAxisDataMapped = data.map(d => getXAxisData(d))
56
+
57
+ if (config.runtime.horizontal) {
58
+ xScale = scaleLinear({
59
+ domain: [min, max],
60
+ range: [0, xMax]
61
+ })
62
+
63
+ yScale = config.runtime.xAxis.type === 'date' ? scaleLinear({ domain: [Math.min(...xAxisDataMapped), Math.max(...xAxisDataMapped)] }) : scalePoint({ domain: xAxisDataMapped, padding: 0.5 })
64
+
65
+ seriesScale = scalePoint({
66
+ domain: config.runtime.barSeriesKeys || config.runtime.seriesKeys,
67
+ range: [0, yMax]
68
+ })
69
+
70
+ yScale.rangeRound([0, yMax])
71
+ } else {
72
+ min = min < 0 ? min * 1.11 : min
73
+
74
+ yScale = scaleLinear({
75
+ domain: [min, max],
76
+ range: [yMax - margin.bottom, margin.top]
77
+ })
78
+
79
+ xScale = scalePoint({
80
+ domain: xAxisDataMapped,
81
+ range: [margin.left, width - margin.right]
82
+ })
83
+
84
+ seriesScale = scalePoint({
85
+ domain: config.runtime.barSeriesKeys || config.runtime.seriesKeys,
86
+ range: [0, xMax]
87
+ })
88
+ }
89
+ }
90
+
91
+ const handleSparkLineTicks = [xScale.domain()[0], xScale.domain()[xScale.domain().length - 1]]
92
+
93
+ useEffect(() => {
94
+ ReactTooltip.rebuild()
95
+ })
96
+
97
+ return (
98
+ <ErrorBoundary component='SparkLine'>
99
+ <svg role='img' aria-label={handleChartAriaLabels(config)} width={width} height={height} className={'sparkline'} tabIndex={0}>
100
+ {(config.runtime.lineSeriesKeys || config.runtime.seriesKeys).map((seriesKey, index) => (
101
+ <>
102
+ <Group
103
+ className='sparkline-group'
104
+ height={parentHeight}
105
+ style={{ height: parentHeight }}
106
+ top={margin.top}
107
+ key={`series-${seriesKey}`}
108
+ opacity={config.legend.behavior === 'highlight' && seriesHighlight.length > 0 && seriesHighlight.indexOf(seriesKey) === -1 ? 0.5 : 1}
109
+ display={config.legend.behavior === 'highlight' || seriesHighlight.length === 0 || seriesHighlight.indexOf(seriesKey) !== -1 ? 'block' : 'none'}
110
+ >
111
+ {data.map((d, dataIndex) => {
112
+ let yAxisTooltip = config.runtime.yAxis.label ? `${config.runtime.yAxis.label}: ${formatNumber(getYAxisData(d, seriesKey))}` : formatNumber(getYAxisData(d, seriesKey))
113
+ let xAxisTooltip = config.runtime.xAxis.label ? `${config.runtime.xAxis.label}: ${d[config.runtime.xAxis.dataKey]}` : d[config.runtime.xAxis.dataKey]
114
+
115
+ const tooltip = `<div>
128
116
  ${yAxisTooltip}<br />
129
117
  ${xAxisTooltip}<br />
130
118
  ${config.seriesLabel ? `${config.seriesLabel}: ${seriesKey}` : ''}
131
119
  </div>`
132
120
 
133
- let circleRadii = 4.5
134
- return (
135
- <Group key={`series-${seriesKey}-point-${dataIndex}`}>
136
- <Text
137
- display={config.labels ? 'block' : 'none'}
138
- x={xScale(getXAxisData(d))}
139
- y={yScale(getYAxisData(d, seriesKey))}
140
- fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
141
- textAnchor="middle">
142
- {formatNumber(d[seriesKey])}
143
- </Text>
144
-
145
- { dataIndex + 1 !== data.length && ( (config.lineDatapointStyle === 'always show') || (config.lineDatapointStyle === 'hover') ) &&
146
- <circle
147
- key={`${seriesKey}-${dataIndex}`}
148
- r={circleRadii}
149
- cx={xScale(getXAxisData(d))}
150
- cy={yScale(getYAxisData(d, seriesKey))}
151
- fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
152
- style={{ fill: colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000' }}
153
- data-tip={tooltip}
154
- data-for={`cdc-open-viz-tooltip-${config.runtime.uniqueId}`}
155
- />
156
- }
157
- </Group>
158
- )
159
- })}
160
- <LinePath
161
- curve={allCurves.curveLinear}
162
- data={data}
163
- x={(d) => xScale(getXAxisData(d))}
164
- y={(d) => yScale(getYAxisData(d, seriesKey))}
165
- stroke={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
166
- strokeWidth={2}
167
- strokeOpacity={1}
168
- shapeRendering="geometricPrecision"
169
- marker-end={`url(#${'arrow'}--${index})`}
170
-
171
- />
172
- <MarkerArrow
173
- id={`arrow--${index}`}
174
- refX={2}
175
- size={6}
176
- marker-end={`url(#${'arrow'}--${index})`}
177
- strokeOpacity={1}
178
- fillOpacity={1}
179
- // stroke={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
180
- fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
181
- />
182
-
183
- </Group>
184
- <AxisBottom
185
- top={yMax + margin.top}
186
- hideAxisLine
187
- hideTicks
188
- scale={xScale}
189
- tickValues={ handleSparkLineTicks }
190
- tickFormat={formatDate}
191
- stroke={'black'}
192
- tickStroke={'black'}
193
- tickLabelProps={() => ({
194
- fill: 'black',
195
- fontSize: 11,
196
- textAnchor: 'middle',
197
- })}
198
-
199
- />
200
- </>
201
- ))
202
- }
203
- </svg>
204
- </ErrorBoundary>
205
-
206
- );
121
+ let circleRadii = 4.5
122
+ return (
123
+ <Group key={`series-${seriesKey}-point-${dataIndex}`}>
124
+ <Text display={config.labels ? 'block' : 'none'} x={xScale(getXAxisData(d))} y={yScale(getYAxisData(d, seriesKey))} fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'} textAnchor='middle'>
125
+ {formatNumber(d[seriesKey])}
126
+ </Text>
127
+
128
+ {dataIndex + 1 !== data.length && (config.lineDatapointStyle === 'always show' || config.lineDatapointStyle === 'hover') && (
129
+ <circle
130
+ key={`${seriesKey}-${dataIndex}`}
131
+ r={circleRadii}
132
+ cx={xScale(getXAxisData(d))}
133
+ cy={yScale(getYAxisData(d, seriesKey))}
134
+ fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
135
+ style={{ fill: colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000' }}
136
+ data-tip={tooltip}
137
+ data-for={`cdc-open-viz-tooltip-${config.runtime.uniqueId}`}
138
+ />
139
+ )}
140
+ </Group>
141
+ )
142
+ })}
143
+ <LinePath
144
+ curve={allCurves.curveLinear}
145
+ data={data}
146
+ x={d => xScale(getXAxisData(d))}
147
+ y={d => yScale(getYAxisData(d, seriesKey))}
148
+ stroke={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
149
+ strokeWidth={2}
150
+ strokeOpacity={1}
151
+ shapeRendering='geometricPrecision'
152
+ marker-end={`url(#${'arrow'}--${index})`}
153
+ />
154
+ <MarkerArrow
155
+ id={`arrow--${index}`}
156
+ refX={2}
157
+ size={6}
158
+ marker-end={`url(#${'arrow'}--${index})`}
159
+ strokeOpacity={1}
160
+ fillOpacity={1}
161
+ // stroke={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
162
+ fill={colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[seriesKey] : seriesKey) : '#000'}
163
+ />
164
+ </Group>
165
+ <AxisBottom
166
+ top={yMax + margin.top}
167
+ hideAxisLine
168
+ hideTicks
169
+ scale={xScale}
170
+ tickValues={handleSparkLineTicks}
171
+ tickFormat={formatDate}
172
+ stroke={'black'}
173
+ tickStroke={'black'}
174
+ tickLabelProps={() => ({
175
+ fill: 'black',
176
+ fontSize: 11,
177
+ textAnchor: 'middle'
178
+ })}
179
+ />
180
+ </>
181
+ ))}
182
+ </svg>
183
+ </ErrorBoundary>
184
+ )
207
185
  }
@@ -1,30 +1,29 @@
1
- import {useEffect, useState} from "react";
1
+ import { useEffect, useState } from 'react'
2
2
 
3
- export default function useIntersectionObserver(
4
- elementRef,
5
- { threshold = 0, root = null, rootMargin = "0%", freezeOnceVisible = false }
6
- ) {
7
- const [entry, setEntry] = useState<any>();
3
+ export default function useIntersectionObserver(elementRef, { threshold = 0, root = null, rootMargin = '0%', freezeOnceVisible = false }) {
4
+ const [entry, setEntry] = useState<any>()
8
5
 
9
- const frozen = entry?.isIntersecting && freezeOnceVisible;
6
+ const frozen = entry?.isIntersecting && freezeOnceVisible
10
7
 
11
- const updateEntry = ([entry]) => {
12
- setEntry(entry);
13
- };
8
+ const updateEntry = ([entry]) => {
9
+ setEntry(entry)
10
+ }
14
11
 
15
- useEffect(() => {
16
- const node = elementRef?.current;
17
- const hasIOSupport = !!window.IntersectionObserver;
12
+ useEffect(() => {
13
+ setTimeout(() => {
14
+ const node = elementRef?.current
15
+ const hasIOSupport = !!window.IntersectionObserver
18
16
 
19
- if (!hasIOSupport || frozen || !node) return;
17
+ if (!hasIOSupport || frozen || !node) return
20
18
 
21
- const observerParams = { threshold, root, rootMargin };
22
- const observer = new IntersectionObserver(updateEntry, observerParams);
19
+ const observerParams = { threshold, root, rootMargin }
20
+ const observer = new IntersectionObserver(updateEntry, observerParams)
23
21
 
24
- observer.observe(node);
22
+ observer.observe(node)
25
23
 
26
- return () => observer.disconnect();
27
- }, [elementRef, threshold, root, rootMargin, frozen]);
24
+ return () => observer.disconnect()
25
+ }, 500);
26
+ }, [elementRef, threshold, root, rootMargin, frozen])
28
27
 
29
- return entry;
28
+ return entry
30
29
  }
package/src/context.tsx CHANGED
@@ -1,5 +1,5 @@
1
- import { createContext } from 'react';
1
+ import { createContext } from 'react'
2
2
 
3
- const ConfigContext = createContext({});
3
+ const ConfigContext = createContext({})
4
4
 
5
- export default ConfigContext;
5
+ export default ConfigContext
@@ -10,26 +10,46 @@ export default {
10
10
  lollipopShape: 'circle',
11
11
  lollipopColorStyle: 'two-tone',
12
12
  visualizationSubType: 'regular',
13
- barStyle:'',
14
- roundingStyle:'standard',
15
- tipRounding:'top',
13
+ barStyle: '',
14
+ roundingStyle: 'standard',
15
+ tipRounding: 'top',
16
16
  padding: {
17
17
  left: 5,
18
18
  right: 5
19
19
  },
20
20
  yAxis: {
21
21
  hideAxis: false,
22
- displayNumbersOnBar:false,
22
+ displayNumbersOnBar: false,
23
23
  hideLabel: false,
24
24
  hideTicks: false,
25
25
  size: 50,
26
26
  gridLines: false,
27
- min:'',
28
- max:'',
27
+ min: '',
28
+ max: '',
29
+ labelColor: '#333',
30
+ tickLabelColor: '#333',
31
+ tickColor: '#333',
32
+ rightHideAxis: true,
33
+ rightAxisSize: 50,
34
+ rightLabel: '',
35
+ rightLabelOffsetSize: 0,
36
+ rightAxisLabelColor: '#333',
37
+ rightAxisTickLabelColor: '#333',
38
+ rightAxisTickColor: '#333',
39
+ numTicks: ''
40
+ },
41
+ boxplot: [],
42
+ topAxis: {
43
+ hasLine: false
29
44
  },
45
+ isLegendValue: false,
30
46
  barThickness: 0.35,
31
47
  barHeight: 25,
32
- height: 300,
48
+ barSpace: 15,
49
+ heights: {
50
+ vertical: 300,
51
+ horizontal: 750
52
+ },
33
53
  xAxis: {
34
54
  type: 'categorical',
35
55
  hideAxis: false,
@@ -38,27 +58,34 @@ export default {
38
58
  size: 75,
39
59
  tickRotation: 0,
40
60
  min: '',
41
- max:'',
61
+ max: '',
62
+ labelColor: '#333',
63
+ tickLabelColor: '#333',
64
+ tickColor: '#333',
65
+ numTicks: '',
66
+ labelOffset: 65
42
67
  },
43
68
  table: {
44
69
  label: 'Data Table',
45
70
  expanded: true,
46
- limitHeight:false,
47
- height:"",
48
- caption:""
71
+ limitHeight: false,
72
+ height: '',
73
+ caption: '',
74
+ showDownloadUrl: false
49
75
  },
50
76
  orientation: 'vertical',
51
77
  legend: {
52
78
  behavior: 'isolate',
53
79
  position: 'right',
54
- colorCode:'',
55
- reverseLabelOrder:false,
56
- description:'',
80
+ singleRow: false,
81
+ colorCode: '',
82
+ reverseLabelOrder: false,
83
+ description: '',
57
84
  dynamicLegend: false,
58
- dynamicLegendDefaultText: "Show All",
85
+ dynamicLegendDefaultText: 'Show All',
59
86
  dynamicLegendItemLimit: 5,
60
87
  dynamicLegendItemLimitMessage: 'Dynamic Legend Item Limit Hit.',
61
- dynamicLegendChartMessage: 'Select Options from the Legend',
88
+ dynamicLegendChartMessage: 'Select Options from the Legend'
62
89
  },
63
90
  exclusions: {
64
91
  active: false,
@@ -67,7 +94,7 @@ export default {
67
94
  palette: 'qualitative-bold',
68
95
  isPaletteReversed: false,
69
96
  labels: false,
70
- dataFormat: {commas:false,prefix:'',suffix:""},
97
+ dataFormat: { commas: false, prefix: '', suffix: '', abbreviated: false },
71
98
  confidenceKeys: {},
72
99
  visual: {
73
100
  border: true,
@@ -1,19 +1,19 @@
1
- import {useState, useEffect} from 'react'
1
+ import { useState, useEffect } from 'react'
2
2
  // Use for accessibility testing
3
3
  const useActiveElement = () => {
4
- const [active, setActive] = useState(document.activeElement);
4
+ const [active, setActive] = useState(document.activeElement)
5
5
 
6
- const handleFocusIn = (e) => {
7
- setActive(document.activeElement);
8
- }
6
+ const handleFocusIn = e => {
7
+ setActive(document.activeElement)
8
+ }
9
9
 
10
- useEffect(() => {
11
- document.addEventListener('focusin', handleFocusIn)
12
- return () => {
13
- document.removeEventListener('focusin', handleFocusIn)
14
- };
15
- }, [])
10
+ useEffect(() => {
11
+ document.addEventListener('focusin', handleFocusIn)
12
+ return () => {
13
+ document.removeEventListener('focusin', handleFocusIn)
14
+ }
15
+ }, [])
16
16
 
17
- return active;
17
+ return active
18
18
  }
19
- export default useActiveElement;
19
+ export default useActiveElement