Skip to content

Commit

Permalink
Fix hidden axes for charts (carbon-design-system#701)
Browse files Browse the repository at this point in the history
* fix: fix render skeleton for charts

* fix: update condition for skeleton

Co-authored-by: Fei <fei-fei.zheng@ibm.com>
  • Loading branch information
Fei Z and Fei authored Jul 15, 2020
1 parent f17fc60 commit ca6270b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/axes/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export class Axis extends Component {

// we don't need to show axes on empty state and on skeleton state
// because the Skeleton component draws them
if (isDataEmpty || isDataLoading) {
if (isDataLoading) {
container.attr("opacity", 0);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/graphs/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ export class Skeleton extends Component {
});
svg.attr("width", width).attr("height", height);

const isDataEmpty = this.model.isDataEmpty();
const isDataLoading = Tools.getProperty(
this.model.getOptions(),
"data",
"loading"
);

// display a skeleton if there is no chart data or the loading flag is set to true
if (isDataEmpty || isDataLoading) {
if (isDataLoading) {
this.renderSkeleton(isDataLoading);
} else {
this.removeSkeleton();
Expand Down

0 comments on commit ca6270b

Please sign in to comment.