@cdc/chart 4.25.3-6 → 4.25.3

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 (32) hide show
  1. package/dist/cdcchart-1a1724a1.es.js +4886 -0
  2. package/dist/cdcchart.js +51921 -76151
  3. package/index.html +1 -1
  4. package/package.json +2 -2
  5. package/src/CdcChart.tsx +1 -22
  6. package/src/CdcChartComponent.tsx +27 -13
  7. package/src/_stories/Chart.CI.stories.tsx +33 -0
  8. package/src/_stories/Chart.Legend.Gradient.stories.tsx +6 -0
  9. package/src/_stories/Chart.stories.tsx +0 -16
  10. package/src/_stories/_mock/bar_chart_ci_labels.json +620 -0
  11. package/src/_stories/_mock/legend_groupBy_mock.json +474 -0
  12. package/src/components/BarChart/components/BarChart.Horizontal.tsx +1 -1
  13. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +1 -1
  14. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +1 -1
  15. package/src/components/BarChart/components/BarChart.Vertical.tsx +2 -2
  16. package/src/components/EditorPanel/EditorPanel.tsx +60 -24
  17. package/src/components/EditorPanel/helpers/updateFieldRankByValue.ts +4 -3
  18. package/src/components/Legend/Legend.Component.tsx +69 -58
  19. package/src/components/Legend/Legend.tsx +3 -1
  20. package/src/components/Legend/LegendGroup/LegendGroup.styles.css +40 -0
  21. package/src/components/Legend/LegendGroup/LegendGroup.tsx +103 -0
  22. package/src/components/Legend/LegendGroup/index.tsx +3 -0
  23. package/src/components/LineChart/components/LineChart.Circle.tsx +14 -9
  24. package/src/components/LineChart/index.tsx +18 -7
  25. package/src/components/LinearChart.tsx +38 -30
  26. package/src/data/initial-state.js +1 -1
  27. package/src/helpers/dataHelpers.ts +10 -0
  28. package/src/helpers/sizeHelpers.ts +23 -0
  29. package/src/hooks/useBarChart.ts +2 -1
  30. package/src/hooks/useScales.ts +2 -8
  31. package/src/store/chart.actions.ts +1 -1
  32. package/src/types/ChartConfig.ts +2 -1
@@ -200,7 +200,8 @@ export const useBarChart = () => {
200
200
  return d[config.xAxis.dataKey] === xAxisDataValue && dynamicCategoryMatch
201
201
  }) || {}
202
202
  Object.keys(columns).forEach(colKeys => {
203
- if (series && config.columns[colKeys].series && config.columns[colKeys].series !== series) return
203
+ const colConfig = config.columns[colKeys]
204
+ if (series && colConfig.series && colConfig.series !== series && !colConfig.tooltips) return
204
205
  const formattingParams = {
205
206
  addColPrefix: config.columns[colKeys].prefix,
206
207
  addColSuffix: config.columns[colKeys].suffix,
@@ -137,14 +137,8 @@ const useScales = (properties: useScaleProps) => {
137
137
  xScale.type = scaleTypes.LINEAR
138
138
  }
139
139
  if (xAxis.type === 'categorical') {
140
- // Map items to rounded numbers if numeric, skip formatting non-numeric strings.
141
- const xAxisDataMappedRoundedItems = xAxisDataMapped.map(item => {
142
- const strItem = String(item)
143
- const parsed = parseFloat(strItem)
144
- return !isNaN(parsed) ? Math.round(parsed).toString() : strItem
145
- })
146
-
147
- xScale = composeScaleBand(xAxisDataMappedRoundedItems, [0, xMax], 1 - config.barThickness)
140
+ xScale = composeScaleBand(xAxisDataMapped, [0, xMax], 1)
141
+ xScale.type = scaleTypes.BAND
148
142
  }
149
143
  }
150
144
 
@@ -14,7 +14,7 @@ type SET_COLOR_SCALE = Action<'SET_COLOR_SCALE', Function>
14
14
  type SET_STATE_DATA = Action<'SET_STATE_DATA', object[]>
15
15
  type SET_EXCLUDED_DATA = Action<'SET_EXCLUDED_DATA', object[]>
16
16
  type SET_FILTERED_DATA = Action<'SET_FILTERED_DATA', object[]>
17
- type SET_SERIES_HIGHLIGHT = Action<'SET_SERIES_HIGHLIGHT', object>
17
+ type SET_SERIES_HIGHLIGHT = Action<'SET_SERIES_HIGHLIGHT', string[]>
18
18
  type SET_VIEWPORT = Action<'SET_VIEWPORT', string>
19
19
  type SET_DIMENSIONS = Action<'SET_DIMENSIONS', DimensionsType>
20
20
  type SET_CONTAINER = Action<'SET_CONTAINER', object>
@@ -80,7 +80,7 @@ type Exclusions = {
80
80
 
81
81
  export type Legend = CoreLegend & {
82
82
  seriesHighlight: string[]
83
-
83
+ unified: boolean
84
84
  hideSuppressionLink: boolean
85
85
  style: 'circles' | 'boxes' | 'gradient' | 'lines'
86
86
  subStyle: 'linear blocks' | 'smooth'
@@ -90,6 +90,7 @@ export type Legend = CoreLegend & {
90
90
  side: boolean
91
91
  topBottom: boolean
92
92
  }
93
+ groupBy: string
93
94
  }
94
95
 
95
96
  type Visual = {