diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index ad6c73582f..8a1399abfd 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,16 +1,12 @@ # Change Log -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +All notable changes to this project will be documented in this file. See +[Conventional Commits](https://conventionalcommits.org) for commit guidelines. ## [0.41.61](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.60...v0.41.61) (2021-04-28) **Note:** Version bump only for package @carbon/charts - - - - # Change Log All notable changes to this project will be documented in this file. See @@ -20,34 +16,18 @@ All notable changes to this project will be documented in this file. See **Note:** Version bump only for package @carbon/charts - - - - ## [0.41.59](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.58...v0.41.59) (2021-04-27) **Note:** Version bump only for package @carbon/charts - - - - ## [0.41.58](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.57...v0.41.58) (2021-04-26) **Note:** Version bump only for package @carbon/charts - - - - ## [0.41.57](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.56...v0.41.57) (2021-04-20) **Note:** Version bump only for package @carbon/charts - - - - # Change Log All notable changes to this project will be documented in this file. See diff --git a/packages/core/src/components/essentials/tooltip-axis.ts b/packages/core/src/components/essentials/tooltip-axis.ts index a3cd584747..953d49adbb 100644 --- a/packages/core/src/components/essentials/tooltip-axis.ts +++ b/packages/core/src/components/essentials/tooltip-axis.ts @@ -63,7 +63,7 @@ export class AxisChartsTooltip extends Tooltip { label: domainLabel, value: domainValue, }, - ...(value.length === 2 + ...(Array.isArray(value) && value.length === 2 ? [ { label: 'Start', diff --git a/packages/core/src/components/graphs/area-stacked.ts b/packages/core/src/components/graphs/area-stacked.ts index 01a4380dc0..c1f943c384 100644 --- a/packages/core/src/components/graphs/area-stacked.ts +++ b/packages/core/src/components/graphs/area-stacked.ts @@ -2,13 +2,7 @@ import { Component } from '../component'; import { Tools } from '../../tools'; import * as Configuration from '../../configuration'; -import { - Roles, - ScaleTypes, - Events, - ColorClassNameTypes, - CartesianOrientations, -} from '../../interfaces'; +import { Roles, Events, ColorClassNameTypes } from '../../interfaces'; // D3 Imports import { area } from 'd3-shape'; @@ -65,7 +59,7 @@ export class StackedArea extends Component { const areas = svg .selectAll('path.area') - .data(stackedData, (d) => d[0][groupMapsTo]); + .data(stackedData, (d) => Tools.getProperty(d, 0, groupMapsTo)); // D3 area generator function this.areaGenerator = area() @@ -86,16 +80,18 @@ export class StackedArea extends Component { enteringAreas .merge(areas) - .data(stackedData, (d) => d[0][groupMapsTo]) + .data(stackedData, (d) => Tools.getProperty(d, 0, groupMapsTo)) .attr('class', 'area') .attr('class', (d) => this.model.getColorClassName({ classNameTypes: [ColorClassNameTypes.FILL], - dataGroupName: d[0][groupMapsTo], + dataGroupName: Tools.getProperty(d, 0, groupMapsTo), originalClassName: 'area', }) ) - .style('fill', (d) => self.model.getFillColor(d[0][groupMapsTo])) + .style('fill', (d) => + self.model.getFillColor(Tools.getProperty(d, 0, groupMapsTo)) + ) .attr('role', Roles.GRAPHICS_SYMBOL) .attr('aria-roledescription', 'area') .transition( @@ -119,7 +115,10 @@ export class StackedArea extends Component { this.services.transitions.getTransition('legend-hover-area') ) .attr('opacity', (d) => { - if (d[0][groupMapsTo] !== hoveredElement.datum().name) { + if ( + Tools.getProperty(d, 0, groupMapsTo) !== + hoveredElement.datum().name + ) { return Configuration.area.opacity.unselected; } diff --git a/packages/core/src/components/graphs/area.ts b/packages/core/src/components/graphs/area.ts index fee293ecc5..c8a681a652 100644 --- a/packages/core/src/components/graphs/area.ts +++ b/packages/core/src/components/graphs/area.ts @@ -106,7 +106,9 @@ export class Area extends Component { ); } - const areas = svg.selectAll('path.area').data(groupedData); + const areas = svg + .selectAll('path.area') + .data(groupedData, (group) => group.name); const chartprefix = Tools.getProperty( this.getOptions(), diff --git a/packages/core/src/components/graphs/bar-simple.ts b/packages/core/src/components/graphs/bar-simple.ts index bce4fb9fa4..c6129bb587 100644 --- a/packages/core/src/components/graphs/bar-simple.ts +++ b/packages/core/src/components/graphs/bar-simple.ts @@ -79,7 +79,7 @@ export class SimpleBar extends Bar { barWidth / 2; const x1 = x0 + barWidth; let y0, y1; - if (value.length === 2) { + if (Array.isArray(value) && value.length === 2) { y0 = this.services.cartesianScales.getRangeValue(value[0]); y1 = this.services.cartesianScales.getRangeValue( value[1], diff --git a/packages/core/src/components/graphs/bar-stacked.ts b/packages/core/src/components/graphs/bar-stacked.ts index f24bbb65e4..e1dacb9f6c 100644 --- a/packages/core/src/components/graphs/bar-stacked.ts +++ b/packages/core/src/components/graphs/bar-stacked.ts @@ -46,7 +46,7 @@ export class StackedBar extends Bar { // Update data on all bar groups const barGroups = svg .selectAll('g.bars') - .data(stackData, (d) => (d.length > 0 ? d[0][groupMapsTo] : null)); + .data(stackData, (d) => Tools.getProperty(d, 0, groupMapsTo)); // Remove elements that need to be exited // We need exit at the top here to make sure that diff --git a/packages/core/src/components/graphs/line.ts b/packages/core/src/components/graphs/line.ts index 5ea3c24b36..30ea2ef13f 100644 --- a/packages/core/src/components/graphs/line.ts +++ b/packages/core/src/components/graphs/line.ts @@ -75,7 +75,7 @@ export class Line extends Component { d ); return { - name: d[0][groupMapsTo], + name: Tools.getProperty(d, 0, groupMapsTo), data: d.map((datum) => ({ [domainIdentifier]: datum.data.sharedStackKey, [groupMapsTo]: datum[groupMapsTo], diff --git a/packages/core/src/components/graphs/scatter-stacked.ts b/packages/core/src/components/graphs/scatter-stacked.ts index 769c2d5e62..861c54b5ec 100644 --- a/packages/core/src/components/graphs/scatter-stacked.ts +++ b/packages/core/src/components/graphs/scatter-stacked.ts @@ -32,7 +32,7 @@ export class StackedScatter extends Scatter { // Update data on dot groups const circleGroups = svg .selectAll('g.dots') - .data(stackedData, (d) => d[0][groupMapsTo]); + .data(stackedData, (d) => Tools.getProperty(d, 0, groupMapsTo)); // Remove dot groups that need to be removed circleGroups.exit().attr('opacity', 0).remove(); diff --git a/packages/core/src/configuration-non-customizable.ts b/packages/core/src/configuration-non-customizable.ts index 673854abaf..aa46f22707 100644 --- a/packages/core/src/configuration-non-customizable.ts +++ b/packages/core/src/configuration-non-customizable.ts @@ -13,7 +13,7 @@ export const color = { export const area = { opacity: { - unselected: 0, + unselected: 0.05, selected: 0.4, }, }; diff --git a/packages/core/src/services/scales-cartesian.ts b/packages/core/src/services/scales-cartesian.ts index 3235f9f4ba..b9eded56ad 100644 --- a/packages/core/src/services/scales-cartesian.ts +++ b/packages/core/src/services/scales-cartesian.ts @@ -586,7 +586,7 @@ export class CartesianScales extends Service { displayData.forEach((datum) => { const value = datum[mapsTo]; - if (value.length === 2) { + if (Array.isArray(value) && value.length === 2) { allDataValues.push(value[0]); allDataValues.push(value[1]); } else { diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index f86addc0ec..97599e598c 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,16 +1,12 @@ # Change Log -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +All notable changes to this project will be documented in this file. See +[Conventional Commits](https://conventionalcommits.org) for commit guidelines. ## [0.41.61](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.60...v0.41.61) (2021-04-28) **Note:** Version bump only for package @carbon/charts-react - - - - # Change Log All notable changes to this project will be documented in this file. See @@ -20,34 +16,18 @@ All notable changes to this project will be documented in this file. See **Note:** Version bump only for package @carbon/charts-react - - - - ## [0.41.59](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.58...v0.41.59) (2021-04-27) **Note:** Version bump only for package @carbon/charts-react - - - - ## [0.41.58](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.57...v0.41.58) (2021-04-26) **Note:** Version bump only for package @carbon/charts-react - - - - ## [0.41.57](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.56...v0.41.57) (2021-04-20) **Note:** Version bump only for package @carbon/charts-react - - - - # Change Log All notable changes to this project will be documented in this file. See diff --git a/packages/vue/CHANGELOG.md b/packages/vue/CHANGELOG.md index 59ee984323..7e57ed64a9 100644 --- a/packages/vue/CHANGELOG.md +++ b/packages/vue/CHANGELOG.md @@ -7,42 +7,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline **Note:** Version bump only for package @carbon/charts-vue - - - - ## [0.41.60](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.59...v0.41.60) (2021-04-28) **Note:** Version bump only for package @carbon/charts-vue - - - - ## [0.41.59](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.58...v0.41.59) (2021-04-27) **Note:** Version bump only for package @carbon/charts-vue - - - - ## [0.41.58](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.57...v0.41.58) (2021-04-26) **Note:** Version bump only for package @carbon/charts-vue - - - - ## [0.41.57](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.56...v0.41.57) (2021-04-20) **Note:** Version bump only for package @carbon/charts-vue - - - - ## [0.41.56](https://github.com/carbon-design-system/carbon-charts/compare/v0.41.55...v0.41.56) (2021-04-16) **Note:** Version bump only for package @carbon/charts-vue