@cdc/chart 4.24.5 → 4.24.9
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 +44197 -38258
- package/examples/cases-year.json +13379 -0
- package/examples/feature/annotations/index.json +542 -0
- package/examples/gallery/bar-chart-vertical/combo-line-chart.json +76 -15
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +5 -5
- package/examples/xaxis.json +493 -0
- package/index.html +20 -10
- package/package.json +5 -4
- package/src/CdcChart.tsx +462 -172
- package/src/_stories/Chart.Legend.Gradient.tsx +19 -0
- package/src/_stories/Chart.stories.tsx +18 -171
- package/src/_stories/ChartAnnotation.stories.tsx +32 -0
- package/src/_stories/_mock/annotation_category_mock.json +473 -0
- package/src/_stories/_mock/annotation_date-linear_mock.json +530 -0
- package/{examples/feature/line/line-chart.json → src/_stories/_mock/annotation_date-time_mock.json} +150 -69
- package/src/_stories/_mock/legend.gradient_mock.json +236 -0
- package/src/_stories/_mock/line_chart_two_points_new_chart.json +128 -0
- package/src/_stories/_mock/line_chart_two_points_regression_test.json +127 -0
- package/src/_stories/_mock/lollipop.json +171 -0
- package/src/components/Annotations/components/AnnotationDraggable.styles.css +31 -0
- package/src/components/Annotations/components/AnnotationDraggable.tsx +207 -0
- package/src/components/Annotations/components/AnnotationDropdown.styles.css +14 -0
- package/src/components/Annotations/components/AnnotationDropdown.tsx +72 -0
- package/src/components/Annotations/components/AnnotationList.styles.css +45 -0
- package/src/components/Annotations/components/AnnotationList.tsx +42 -0
- package/src/components/Annotations/components/findNearestDatum.ts +138 -0
- package/src/components/Annotations/components/helpers/index.tsx +46 -0
- package/src/components/Annotations/index.tsx +13 -0
- package/src/components/AreaChart/components/AreaChart.Stacked.jsx +1 -1
- package/src/components/AreaChart/components/AreaChart.jsx +1 -1
- package/src/components/Axis/Categorical.Axis.tsx +145 -0
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +47 -44
- package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +0 -1
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +11 -14
- package/src/components/BarChart/components/BarChart.Vertical.tsx +67 -30
- package/src/components/BarChart/helpers/index.ts +91 -0
- package/src/components/BrushChart.tsx +205 -0
- package/src/components/EditorPanel/EditorPanel.tsx +1794 -403
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +320 -0
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +282 -18
- package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +43 -8
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -4
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +4 -13
- package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
- package/src/components/EditorPanel/components/panels.scss +4 -0
- package/src/components/EditorPanel/editor-panel.scss +35 -3
- package/src/components/EditorPanel/{useEditorPermissions.js → useEditorPermissions.ts} +105 -17
- package/src/components/Legend/Legend.Component.tsx +185 -194
- package/src/components/Legend/Legend.Suppression.tsx +146 -0
- package/src/components/Legend/Legend.tsx +21 -5
- package/src/components/Legend/helpers/createFormatLabels.tsx +1 -1
- package/src/components/Legend/helpers/index.ts +35 -0
- package/src/components/LegendWrapper.tsx +26 -0
- package/src/components/LineChart/LineChartProps.ts +1 -15
- package/src/components/LineChart/components/LineChart.BumpCircle.tsx +103 -0
- package/src/components/LineChart/components/LineChart.Circle.tsx +47 -8
- package/src/components/LineChart/helpers.ts +72 -14
- package/src/components/LineChart/index.tsx +117 -42
- package/src/components/LinearChart.jsx +179 -136
- package/src/components/LinearChart.tsx +1366 -0
- package/src/components/PairedBarChart.jsx +9 -9
- package/src/components/PieChart/PieChart.tsx +75 -18
- package/src/components/Sankey/index.tsx +89 -30
- package/src/components/ScatterPlot/ScatterPlot.jsx +22 -8
- package/src/components/Sparkline/components/SparkLine.tsx +2 -2
- package/src/components/ZoomBrush.tsx +90 -44
- package/src/data/initial-state.js +25 -7
- package/src/helpers/handleChartTabbing.ts +8 -0
- package/src/helpers/isConvertLineToBarGraph.ts +4 -0
- package/src/hooks/{useBarChart.js → useBarChart.ts} +2 -40
- package/src/hooks/useColorScale.ts +1 -1
- package/src/hooks/useLegendClasses.ts +68 -0
- package/src/hooks/useMinMax.ts +12 -7
- package/src/hooks/useScales.ts +58 -26
- package/src/hooks/useTooltip.tsx +135 -25
- package/src/scss/DataTable.scss +2 -1
- package/src/scss/main.scss +128 -28
- package/src/types/ChartConfig.ts +83 -10
- package/src/types/ChartContext.ts +14 -4
- package/tests-examples/helpers/testZeroValue.test.ts +30 -0
- package/LICENSE +0 -201
- package/src/components/BrushHandle.jsx +0 -17
- package/src/components/LineChart/index.scss +0 -1
- package/src/helpers/filterData.ts +0 -18
- package/src/helpers/tests/computeMarginBottom.test.ts +0 -21
- package/src/hooks/useLegendClasses.js +0 -31
- /package/src/hooks/{useReduceData.js → useReduceData.ts} +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Group } from '@visx/group'
|
|
2
|
-
|
|
3
|
-
const BrushHandle = props => {
|
|
4
|
-
const { x, height, isBrushActive } = props
|
|
5
|
-
const pathWidth = 8
|
|
6
|
-
const pathHeight = 15
|
|
7
|
-
if (!isBrushActive) {
|
|
8
|
-
return null
|
|
9
|
-
}
|
|
10
|
-
return (
|
|
11
|
-
<Group left={x + pathWidth / 2} top={(height - pathHeight) / 2}>
|
|
12
|
-
<path fill='#f2f2f2' d='M -4.5 0.5 L 3.5 0.5 L 3.5 15.5 L -4.5 15.5 L -4.5 0.5 M -1.5 4 L -1.5 12 M 0.5 4 L 0.5 12' stroke='#999999' strokeWidth='1' style={{ cursor: 'ew-resize' }} />
|
|
13
|
-
</Group>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default BrushHandle
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Line Chart Styles...
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const filterData = (filters, data) => {
|
|
2
|
-
let filteredData: any[] = []
|
|
3
|
-
|
|
4
|
-
data.forEach(row => {
|
|
5
|
-
let add = true
|
|
6
|
-
filters
|
|
7
|
-
.filter(filter => filter.type !== 'url')
|
|
8
|
-
.forEach(filter => {
|
|
9
|
-
if (row[filter.columnName] != filter.active) {
|
|
10
|
-
add = false
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
if (add) filteredData.push(row)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
return filteredData
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ChartConfig } from '../../types/ChartConfig'
|
|
2
|
-
import { Legend } from '@cdc/core/types/Legend'
|
|
3
|
-
import { computeMarginBottom } from '../computeMarginBottom'
|
|
4
|
-
|
|
5
|
-
describe('computeMarginBottom', () => {
|
|
6
|
-
it('should return correct value', () => {
|
|
7
|
-
const config = {
|
|
8
|
-
orientation: 'horizontal',
|
|
9
|
-
xAxis: { labelOffset: '10' },
|
|
10
|
-
yAxis: { label: null },
|
|
11
|
-
brush: { active: false },
|
|
12
|
-
isResponsiveTicks: true,
|
|
13
|
-
dynamicMarginTop: 20
|
|
14
|
-
}
|
|
15
|
-
const legend = { position: 'top' }
|
|
16
|
-
const currentViewport = 'md'
|
|
17
|
-
expect(computeMarginBottom(config as unknown as ChartConfig, legend as Legend, currentViewport)).toBe('0px')
|
|
18
|
-
config.yAxis.label = 'label'
|
|
19
|
-
expect(computeMarginBottom(config as unknown as ChartConfig, legend as Legend, currentViewport)).toBe('40px')
|
|
20
|
-
})
|
|
21
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
if (config.legend.position === 'bottom' && config.legend.verticalSorted) {
|
|
24
|
-
innerClasses.push('vertical-sorted')
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
containerClasses,
|
|
29
|
-
innerClasses
|
|
30
|
-
}
|
|
31
|
-
}
|
|
File without changes
|