Skip to content

Commit

Permalink
release - fix(bounded area chart): update bounded area chart so bound…
Browse files Browse the repository at this point in the history
…s don't sh… (carbon-design-system#985)

* fix(bounded area chart): update bounded area chart so bounds don't show for null values

Behaviour of bounded area chart now match that of the line chart where null values are shown as a
break in the chart

fix carbon-design-system#980

* fix(area chart): update so area chart also does not display when a point is defined as null

Matches behaviour of line chart where line is not displayed for null values

Co-authored-by: Shazia Kayani <shazia.kayani@ibm.com>
  • Loading branch information
shaziajk and Shazia Kayani authored Mar 30, 2021
1 parent 7b5c79d commit 4507a9b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/core/src/components/graphs/area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ export class Area extends Component {
const { cartesianScales } = this.services;

const orientation = cartesianScales.getOrientation();
const areaGenerator = area().curve(this.services.curves.getD3Curve());
const areaGenerator = area()
.curve(this.services.curves.getD3Curve())
.defined((datum: any, i) => {
const rangeIdentifier = cartesianScales.getRangeIdentifier();
const value = datum[rangeIdentifier];
if (value === null || value === undefined) {
return false;
}
return true;
});

// Update the bound data on area groups
const groupedData = this.model.getGroupedData(this.configs.groups);
Expand Down Expand Up @@ -126,7 +135,7 @@ export class Area extends Component {
.select(
`path.${this.model.getColorClassName({
classNameTypes: [ColorClassNameTypes.STROKE],
dataGroupName: groupedData[0].name
dataGroupName: groupedData[0].name,
})}`
)
.node();
Expand Down

0 comments on commit 4507a9b

Please sign in to comment.