@cdc/chart 1.3.4 → 4.22.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.
Files changed (75) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -5
  3. package/dist/cdcchart.js +6 -6
  4. package/examples/age-adjusted-rates.json +1486 -1218
  5. package/examples/case-rate-example-config.json +1 -1
  6. package/examples/covid-confidence-example-config.json +33 -33
  7. package/examples/covid-example-config.json +34 -34
  8. package/examples/covid-example-data-confidence.json +30 -30
  9. package/examples/covid-example-data.json +20 -20
  10. package/examples/cutoff-example-config.json +36 -34
  11. package/examples/cutoff-example-data.json +36 -36
  12. package/examples/date-exclusions-config.json +1 -1
  13. package/examples/dynamic-legends.json +125 -0
  14. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +192 -0
  15. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +231 -0
  16. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +240 -0
  17. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +137 -0
  18. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +80 -0
  19. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +81 -0
  20. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +68 -0
  21. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +111 -0
  22. package/examples/gallery/lollipop/lollipop-style-horizontal.json +216 -0
  23. package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
  24. package/examples/horizontal-chart.json +36 -33
  25. package/examples/horizontal-stacked-bar-chart.json +34 -34
  26. package/examples/line-chart.json +75 -75
  27. package/examples/paired-bar-data.json +16 -14
  28. package/examples/paired-bar-example.json +48 -46
  29. package/examples/paired-bar-formatted.json +36 -36
  30. package/examples/planet-chart-horizontal-example-config.json +33 -33
  31. package/examples/planet-combo-example-config.json +34 -29
  32. package/examples/planet-example-config.json +35 -33
  33. package/examples/planet-example-data.json +56 -56
  34. package/examples/planet-pie-example-config.json +28 -26
  35. package/examples/private/filters.json +170 -0
  36. package/examples/private/line-test-data.json +22 -0
  37. package/examples/private/line-test-two.json +210 -0
  38. package/examples/private/line-test.json +102 -0
  39. package/examples/private/new.json +48800 -0
  40. package/examples/private/shawn.json +1106 -0
  41. package/examples/private/test.json +10123 -10123
  42. package/examples/private/yaxis-test.json +133 -0
  43. package/examples/private/yaxis-testing.csv +27 -0
  44. package/examples/private/yaxis.json +28 -0
  45. package/examples/stacked-vertical-bar-example.json +228 -0
  46. package/examples/temp-example-config.json +61 -54
  47. package/examples/temp-example-data.json +1 -1
  48. package/package.json +2 -2
  49. package/src/CdcChart.tsx +370 -458
  50. package/src/components/BarChart.tsx +449 -441
  51. package/src/components/DataTable.tsx +164 -180
  52. package/src/components/EditorPanel.js +1066 -663
  53. package/src/components/Legend.js +284 -0
  54. package/src/components/LineChart.tsx +114 -63
  55. package/src/components/LinearChart.tsx +394 -358
  56. package/src/components/PairedBarChart.tsx +216 -135
  57. package/src/components/PieChart.tsx +106 -135
  58. package/src/components/SparkLine.js +184 -205
  59. package/src/components/useIntersectionObserver.tsx +27 -0
  60. package/src/context.tsx +3 -3
  61. package/src/data/initial-state.js +44 -7
  62. package/src/hooks/useActiveElement.js +13 -13
  63. package/src/hooks/useChartClasses.js +41 -0
  64. package/src/hooks/useColorPalette.ts +56 -63
  65. package/src/hooks/useLegendClasses.js +28 -0
  66. package/src/hooks/useReduceData.ts +69 -37
  67. package/src/hooks/useRightAxis.js +25 -0
  68. package/src/hooks/useTopAxis.js +6 -0
  69. package/src/index.html +54 -55
  70. package/src/index.tsx +13 -16
  71. package/src/scss/DataTable.scss +5 -4
  72. package/src/scss/editor-panel.scss +103 -71
  73. package/src/scss/main.scss +277 -38
  74. package/src/scss/variables.scss +1 -1
  75. package/src/components/BarStackVertical.js +0 -0
@@ -1,83 +1,76 @@
1
- import { useEffect, useReducer } from 'react';
1
+ import { useEffect, useReducer } from 'react'
2
2
 
3
- // constants
4
- const SEQUENTIAL = 'SEQUENTIAL';
5
- const SEQUENTIAL_REVERSE = 'SEQUENTIAL_REVERSE';
6
- export const GET_PALETTE = 'GET_PALETTE';
3
+ // constants
4
+ const SEQUENTIAL = 'SEQUENTIAL'
5
+ const SEQUENTIAL_REVERSE = 'SEQUENTIAL_REVERSE'
6
+ export const GET_PALETTE = 'GET_PALETTE'
7
7
 
8
-
9
- // types & interfaces
8
+ // types & interfaces
10
9
  interface State {
11
- readonly filteredPallets:string[]
12
- readonly filteredQualitative:string[]
13
- readonly isPaletteReversed:boolean;
14
- paletteName:string|undefined
15
- }
16
- interface Action<Palettes> {
17
- type:
18
- | 'SEQUENTIAL'
19
- | 'SEQUENTIAL_REVERSE'
20
- | 'GET_PALETTE'
21
- payload: Palettes;
22
- paletteName?:string
23
- };
10
+ readonly filteredPallets: string[]
11
+ readonly filteredQualitative: string[]
12
+ readonly isPaletteReversed: boolean
13
+ paletteName: string | undefined
14
+ }
15
+ interface Action<Palettes> {
16
+ type: 'SEQUENTIAL' | 'SEQUENTIAL_REVERSE' | 'GET_PALETTE'
17
+ payload: Palettes
18
+ paletteName?: string
19
+ }
24
20
 
25
21
  // create initial state
26
- const initialState:State = {
27
- filteredPallets: [],
28
- isPaletteReversed:false,
29
- filteredQualitative: [],
30
- paletteName:undefined
31
- };
22
+ const initialState: State = {
23
+ filteredPallets: [],
24
+ isPaletteReversed: false,
25
+ filteredQualitative: [],
26
+ paletteName: undefined
27
+ }
32
28
 
33
- function reducer<T> (state:State,action:Action<T>):State{ // <T> refers to generic type
34
- const palletNamesArr:string[] = Object.keys(action.payload); // action.payload === colorPalettes object
35
- let paletteName:string ='';
36
- switch(action.type){
29
+ function reducer<T>(state: State, action: Action<T>): State {
30
+ // <T> refers to generic type
31
+ const palletNamesArr: string[] = Object.keys(action.payload) // action.payload === colorPalettes object
32
+ let paletteName: string = ''
33
+ switch (action.type) {
37
34
  case GET_PALETTE:
38
-
39
- return {...state,paletteName:action.paletteName}
40
- case SEQUENTIAL:
41
- paletteName = state.paletteName && state.paletteName.endsWith('reverse') ? String(state.paletteName).substring(0,state.paletteName.length-7) :String(state.paletteName)
42
- const qualitative = palletNamesArr.filter((name:string)=>String(name).startsWith('qualitative') && !String(name).endsWith('reverse'))
43
- const sequential = palletNamesArr.filter((name:string)=>String(name).startsWith('sequential') && !String(name).endsWith('reverse'))
44
- return { ...state, filteredPallets: sequential,filteredQualitative:qualitative, paletteName:paletteName,isPaletteReversed:false};
35
+ return { ...state, paletteName: action.paletteName }
36
+ case SEQUENTIAL:
37
+ paletteName = state.paletteName && state.paletteName.endsWith('reverse') ? String(state.paletteName).substring(0, state.paletteName.length - 7) : String(state.paletteName)
38
+ const qualitative = palletNamesArr.filter((name: string) => String(name).startsWith('qualitative') && !String(name).endsWith('reverse'))
39
+ const sequential = palletNamesArr.filter((name: string) => String(name).startsWith('sequential') && !String(name).endsWith('reverse'))
40
+ return { ...state, filteredPallets: sequential, filteredQualitative: qualitative, paletteName: paletteName, isPaletteReversed: false }
45
41
 
46
- case SEQUENTIAL_REVERSE:
47
- paletteName = palletNamesArr.find((name:string)=> name === String(state.paletteName).concat('reverse') || name === String(state.paletteName).concat('-reverse') )
48
- const qualitativeReverse:string[] = palletNamesArr.filter((name:string)=>String(name).startsWith('qualitative') && String(name).endsWith('reverse'));
49
- const sequentialReverse:string[] = palletNamesArr.filter((name:string)=>String(name).startsWith('sequential') && String(name).endsWith('reverse'));
50
- return { ...state, filteredQualitative:qualitativeReverse, filteredPallets: sequentialReverse ,paletteName:paletteName,isPaletteReversed:true};
51
- default : return state;
42
+ case SEQUENTIAL_REVERSE:
43
+ paletteName = palletNamesArr.find((name: string) => name === String(state.paletteName).concat('reverse') || name === String(state.paletteName).concat('-reverse'))
44
+ const qualitativeReverse: string[] = palletNamesArr.filter((name: string) => String(name).startsWith('qualitative') && String(name).endsWith('reverse'))
45
+ const sequentialReverse: string[] = palletNamesArr.filter((name: string) => String(name).startsWith('sequential') && String(name).endsWith('reverse'))
46
+ return { ...state, filteredQualitative: qualitativeReverse, filteredPallets: sequentialReverse, paletteName: paletteName, isPaletteReversed: true }
47
+ default:
48
+ return state
52
49
  }
53
- };
50
+ }
54
51
 
55
52
  interface Keyable {
56
- palette:string
57
- isPaletteReversed:boolean
53
+ palette: string
54
+ isPaletteReversed: boolean
58
55
  }
59
- function init(initialState){
56
+ function init(initialState) {
60
57
  return initialState
61
58
  }
62
59
 
63
- export function useColorPalette<T,Y extends Keyable>(colorPalettes:T,configState:Y){
64
- const [state, dispatch] = useReducer(reducer, initialState,init);
65
- const {paletteName,isPaletteReversed,filteredPallets,filteredQualitative} = state
66
-
67
-
68
-
60
+ export function useColorPalette<T, Y extends Keyable>(colorPalettes: T, configState: Y) {
61
+ const [state, dispatch] = useReducer(reducer, initialState, init)
62
+ const { paletteName, isPaletteReversed, filteredPallets, filteredQualitative } = state
69
63
 
70
64
  useEffect(() => {
71
- dispatch({ type: SEQUENTIAL, payload: colorPalettes });
72
- }, []);
73
-
65
+ dispatch({ type: SEQUENTIAL, payload: colorPalettes })
66
+ }, [])
74
67
 
75
- useEffect(()=>{
76
- if(configState.isPaletteReversed){
77
- dispatch({ type: "SEQUENTIAL_REVERSE", payload: colorPalettes });
78
- return ()=> dispatch({ type: "SEQUENTIAL", payload: colorPalettes });
68
+ useEffect(() => {
69
+ if (configState.isPaletteReversed) {
70
+ dispatch({ type: 'SEQUENTIAL_REVERSE', payload: colorPalettes })
71
+ return () => dispatch({ type: 'SEQUENTIAL', payload: colorPalettes })
79
72
  }
80
- },[configState.isPaletteReversed,dispatch,colorPalettes])
73
+ }, [configState.isPaletteReversed, dispatch, colorPalettes])
81
74
 
82
- return {paletteName,isPaletteReversed,filteredPallets,filteredQualitative, dispatch}
83
- }
75
+ return { paletteName, isPaletteReversed, filteredPallets, filteredQualitative, dispatch }
76
+ }
@@ -0,0 +1,28 @@
1
+ export default function useLegendClasses(config) {
2
+ let containerClasses = ['legend-container']
3
+ let innerClasses = ['legend-container__inner']
4
+
5
+ // Legend Positioning
6
+ if (config.legend.position === "left") {
7
+ containerClasses.push('left')
8
+ }
9
+ if (config.legend.position === "bottom") {
10
+ containerClasses.push('bottom')
11
+ innerClasses.push('bottom')
12
+ }
13
+
14
+ if(config.legend.position==='bottom' && config.legend.singleRow){
15
+ innerClasses.push('single-row')
16
+ }
17
+
18
+ // Legend > Item Ordering
19
+ if (config.legend.reverseLabelOrder) {
20
+ innerClasses.push('d-flex')
21
+ innerClasses.push('flex-column-reverse')
22
+ }
23
+
24
+ return {
25
+ containerClasses,
26
+ innerClasses
27
+ }
28
+ }
@@ -1,43 +1,75 @@
1
+ function useReduceData(config, data) {
2
+ // for combo charts check all Data Series set to Bar;
3
+ const isBar = config?.series?.every(element => element?.type === 'Bar')
1
4
 
2
- function useReduceData(config,data) {
3
-
4
- const getMaxValueFromData = ()=>{
5
- let max; // will hold max number from data.
6
-
7
- if (config.visualizationType === 'Bar' && config.visualizationSubType === 'stacked') {
8
- const yTotals = data.reduce((allTotals, xValue) => {
9
- const totalYValues = config.runtime.seriesKeys.reduce((yTotal, k) => {
10
- yTotal += Number(xValue[k]);
11
- return yTotal;
12
- }, 0);
13
- allTotals.push(totalYValues);
14
- if(totalYValues > max){
15
- max = totalYValues;
16
- }
17
- return allTotals;
18
- }, [] as number[]);
19
-
20
- max = Math.max(...yTotals);
21
- } else if(config.visualizationType === 'Bar' && config.confidenceKeys && config.confidenceKeys.upper) {
22
- max = Math.max(...data.map((d) => Number(d[config.confidenceKeys.upper])));
23
- } else {
24
- max = Math.max(...data.map((d) => Math.max(...config.runtime.seriesKeys.map((key) => Number(d[key])))));
5
+ const getMaxValueFromData = () => {
6
+ let max // will hold max number from data.
7
+ if ((config.visualizationType === 'Bar' || (config.visualizationType === 'Combo' && isBar)) && config.visualizationSubType === 'stacked') {
8
+ const yTotals = data.reduce((allTotals, xValue) => {
9
+ const totalYValues = config.runtime.seriesKeys.reduce((yTotal, k) => {
10
+ yTotal += Number(xValue[k])
11
+ return yTotal
12
+ }, 0)
13
+
14
+ allTotals.push(totalYValues)
15
+ if (totalYValues > max) {
16
+ max = totalYValues
17
+ }
18
+ return allTotals
19
+ }, [] as number[])
20
+
21
+ max = Math.max(...yTotals)
22
+ } else if (config.visualizationType === 'Bar' && config.series && config.series.dataKey) {
23
+ max = Math.max(...data.map(d => Number(d[config.series.dataKey])))
24
+ } else if (config.visualizationType === 'Combo' && config.visualizationSubType === 'stacked' && !isBar) {
25
+ let total = []
26
+
27
+ if (config.runtime.barSeriesKeys && config.runtime.lineSeriesKeys) {
28
+ // get barSeries max Values added to each other
29
+ data.map(function (d, index) {
30
+ const totalYValues = config.runtime.barSeriesKeys.reduce((yTotal, k) => {
31
+ yTotal += Number(d[k])
32
+ return yTotal
33
+ }, 0)
34
+ total.push(totalYValues)
35
+ })
36
+ // get lineSeries largest values
37
+ const lineMax = Math.max(...data.map(d => Math.max(...config.runtime.lineSeriesKeys.map(key => Number(d[key])))))
38
+
39
+ const barMax = Math.max(...total)
40
+
41
+ max = Number(barMax) > Number(lineMax) ? barMax : lineMax
25
42
  }
43
+ } else {
44
+ max = Math.max(...data.map(d => Math.max(...config.runtime.seriesKeys.map(key => Number(d[key])))))
45
+ }
26
46
 
27
- return max;
28
- };
29
-
30
- const getMinValueFromData = ()=> {
31
- let min;
32
- const minNumberFromData = Math.min(...data.map((d) => Math.min(...config.runtime.seriesKeys.map((key) => Number(d[key])))));
47
+ return max
48
+ }
49
+
50
+ const getMinValueFromData = () => {
51
+ let min
52
+ const minNumberFromData = Math.min(...data.map(d => Math.min(...config.runtime.seriesKeys.map(key => Number(d[key])))))
33
53
  min = String(minNumberFromData)
34
-
35
- return min;
36
- };
37
-
38
- const maxValue = getMaxValueFromData();
39
- const minValue = getMinValueFromData()
40
- return {minValue,maxValue}
54
+
55
+ return min
56
+ }
57
+
58
+ const findPositiveNum = (): boolean => {
59
+ // loop throught provided data to find positve number in arr based on series keys.
60
+ let existPositiveValue = false
61
+ if (config.runtime.seriesKeys) {
62
+ for (let i = 0; i < config.runtime.seriesKeys.length; i++) {
63
+ existPositiveValue = data.some(d => d[config.runtime.seriesKeys[i]] >= 0)
64
+ }
65
+ }
66
+ return existPositiveValue
67
+ }
68
+
69
+ const maxValue = getMaxValueFromData()
70
+ const minValue = getMinValueFromData()
71
+ const existPositiveValue = findPositiveNum()
72
+ return { minValue, maxValue, existPositiveValue }
41
73
  }
42
74
 
43
- export default useReduceData
75
+ export default useReduceData
@@ -0,0 +1,25 @@
1
+ import { scaleLinear } from '@visx/scale'
2
+
3
+ export default function useRightAxis({ config, yMax = 0, data = [], updateConfig }) {
4
+ const hasRightAxis = config.visualizationType === 'Combo' && config.orientation === 'vertical'
5
+ const rightSeriesKeys = config.series && config.series.filter(series => series.axis === 'Right').map(key => key.dataKey)
6
+
7
+ const allRightAxisData = rightSeriesKeys => {
8
+ if (!rightSeriesKeys) return [0]
9
+ let rightAxisData = []
10
+ rightSeriesKeys.map((key, index) => {
11
+ return (rightAxisData = [...rightAxisData, ...data.map(item => Number(item[key]))])
12
+ })
13
+ return rightAxisData
14
+ }
15
+
16
+ const min = Math.min.apply(null, allRightAxisData(rightSeriesKeys))
17
+ const max = Math.max.apply(null, allRightAxisData(rightSeriesKeys))
18
+
19
+ const yScaleRight = scaleLinear({
20
+ domain: [0, max],
21
+ range: [yMax, 0]
22
+ })
23
+
24
+ return { yScaleRight, hasRightAxis }
25
+ }
@@ -0,0 +1,6 @@
1
+ export default function useTopAxis(config) {
2
+ // When to show top axis
3
+ const hasTopAxis = config.visualizationType === 'Bar' || config.visualizationType === 'Combo' || config.visualizationType === 'Line'
4
+
5
+ return { hasTopAxis }
6
+ }
package/src/index.html CHANGED
@@ -1,68 +1,67 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, shrink-to-fit=no"
8
- />
9
- <style>
10
- body {
11
- /* max-width: 1000px; */
12
- margin: 0 auto !important;
13
- display: flex;
14
- flex-direction: column;
15
- justify-content: center;
16
- }
17
- .react-container + .react-container {
18
- margin-top: 3rem;
19
- }
20
- </style>
21
- </head>
22
- <body>
23
- <!-- <div class="react-container" data-config="/examples/temp-example-config.json"></div> -->
24
3
 
25
- <!-- <select id="cove_select">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
+ <style>
8
+ body {
9
+ /* max-width: 1000px; */
10
+ margin: 0 auto !important;
11
+ display: flex;
12
+ flex-direction: column;
13
+ justify-content: center;
14
+ }
15
+
16
+ .react-container+.react-container {
17
+ margin-top: 3rem;
18
+ }
19
+ </style>
20
+ </head>
21
+
22
+ <body>
23
+ <!-- <div class="react-container" data-config="/examples/temp-example-config.json"></div> -->
24
+
25
+ <!-- <select id="cove_select">
26
26
  <option value=""">Choose An Option</option>
27
27
  <option value="Non-Hispanic White">Non-Hispanic White</option>
28
28
  <option value="Hispanic or Latino">Test 2</option>
29
29
  </select> -->
30
30
 
31
- <!-- <div class="react-container" data-config="/examples/covid-example-config.json"></div> -->
32
- <!-- <div class="react-container" data-config="/examples/cutoff-example-config.json"></div> -->
33
- <!-- <div class="react-container" data-config="/examples/covid-confidence-example-config.json"></div> -->
34
- <div class="react-container" data-config="/examples/planet-example-config.json"></div>
35
- <!-- <div class="react-container" data-config="/examples/planet-chart-horizontal-example-config.json"></div> -->
36
- <!-- <div class="react-container" data-config="/examples/planet-combo-example-config.json"></div> -->
37
- <!-- <div class="react-container" data-config="/examples/planet-pie-example-config.json"></div> -->
38
- <!-- <div class="react-container" data-config="/examples/date-exclusions-config.json"></div> -->
39
- <!--<div class="react-container" data-config="/examples/case-rate-example-config.json"></div>-->
40
- <!-- <div class="react-container" data-config="/examples/private/example-bar-chart.json"></div> -->
31
+ <div class="react-container" data-config="/examples/private/yaxis-test.json"></div>
32
+ <!-- <div class="react-container" data-config="/examples/dynamic-legends.json"></div> -->
33
+ <!-- <div class="react-container" data-config="/examples/cutoff-example-config.json"></div> -->
34
+ <!-- <div class="react-container" data-config="/examples/covid-confidence-example-config.json"></div> -->
35
+ <!-- <div class="react-container" data-config="/examples/planet-example-config.json"></div> -->
36
+ <!-- <div class="react-container" data-config="/examples/planet-chart-horizontal-example-config.json"></div> -->
37
+ <!-- <div class="react-container" data-config="/examples/planet-combo-example-config.json"></div>-->
38
+ <!-- <div class="react-container" data-config="/examples/planet-pie-example-config.json"></div>-->
39
+ <!-- <div class="react-container" data-config="/examples/date-exclusions-config.json"></div> -->
40
+ <!--<div class="react-container" data-config="/examples/case-rate-example-config.json"></div>-->
41
+ <!-- <div class="react-container" data-config="/examples/private/textelements.json"></div> -->
42
+ <!-- <div class="react-container" data-config="/examples/private/example-bar-chart.json"></div> -->
43
+ <!-- <div class="react-container" data-config="/examples/example-sparkline.json"></div> -->
44
+ <!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/bar-chart.html#examples -->
45
+
46
+ <!-- HORIZONTAL BAR CHARTS -->
47
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json"></div> -->
48
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json"></div> -->
49
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-stacked.json"></div> -->
50
+
51
+ <!-- VERTICAL BAR CHARTS -->
52
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/combo-line-chart.json"></div> -->
53
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json"></div> -->
54
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div> -->
55
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-with-confidence.json"></div> -->
56
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart.json"></div> -->
41
57
 
42
- <!-- LINE -->
43
- <!-- <div class="react-container" data-config="/examples/line-chart.json"></div> -->
44
-
45
- <!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/bar-chart.html#examples -->
46
-
47
- <!-- HORIZONTAL BAR CHARTS -->
48
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json"></div> -->
49
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json"></div> -->
50
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-stacked.json"></div> -->
58
+ <!-- LOLLIPOP CHARTS -->
59
+ <!-- <div class="react-container" data-config="/examples/gallery/lollipop/lollipop-style-horizontal.json"></div> -->
51
60
 
61
+ <!-- PAIRED BAR CHARTS -->
62
+ <!-- <div class="react-container" data-config="/examples/gallery/paired-bar/paired-bar-chart.json"></div> -->
52
63
 
53
- <!-- VERTICAL BAR CHARTS -->
54
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/combo-line-chart.json"></div> -->
55
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json"></div> -->
56
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div> -->
57
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-with-confidence.json"></div> -->
58
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart.json"></div> -->
59
-
60
- <!-- LOLLIPOP CHARTS -->
61
- <!-- <div class="react-container" data-config="/examples/gallery/lollipop/lollipop-style-horizontal.json"></div> -->
62
-
63
- <!-- PAIRED BAR CHARTS -->
64
- <!-- <div class="react-container" data-config="/examples/gallery/paired-bar/paired-bar-chart.json"></div> -->
64
+ <noscript>You need to enable JavaScript to run this app.</noscript>
65
+ </body>
65
66
 
66
- <noscript>You need to enable JavaScript to run this app.</noscript>
67
- </body>
68
67
  </html>
package/src/index.tsx CHANGED
@@ -1,21 +1,18 @@
1
- import { publish, subscribe } from '@cdc/core/helpers/events';
2
- import React from 'react';
3
- import { render } from 'react-dom';
1
+ import { publish, subscribe } from '@cdc/core/helpers/events'
2
+ import React from 'react'
3
+ import { render } from 'react-dom'
4
4
 
5
- import CdcChart from './CdcChart';
5
+ import CdcChart from './CdcChart'
6
6
 
7
- const domContainers = document.querySelectorAll('.react-container');
7
+ const domContainers = document.querySelectorAll('.react-container')
8
8
 
9
- let isEditor = window.location.href.includes('editor=true');
9
+ let isEditor = window.location.href.includes('editor=true')
10
10
 
11
- domContainers.forEach((domContainer) => {
12
- render(
11
+ domContainers.forEach(domContainer => {
12
+ render(
13
13
  <React.StrictMode>
14
- <CdcChart
15
- configUrl={domContainer.attributes['data-config'].value}
16
- isEditor={isEditor}
17
- />
18
- </React.StrictMode>,
19
- domContainer,
20
- );
21
- });
14
+ <CdcChart configUrl={domContainer.attributes['data-config'].value} isEditor={isEditor} />
15
+ </React.StrictMode>,
16
+ domContainer
17
+ )
18
+ })
@@ -7,10 +7,11 @@
7
7
  .data-table-container {
8
8
  .region-table {
9
9
  display: table;
10
-
11
- thead, tbody {
10
+
11
+ thead,
12
+ tbody {
12
13
  display: table-row-group;
13
-
14
+
14
15
  tr {
15
16
  display: table-row;
16
17
 
@@ -20,4 +21,4 @@
20
21
  }
21
22
  }
22
23
  }
23
- }
24
+ }