Skip to content

Commit 7fc69fc

Browse files
committed
fix the console error
1 parent 54c9878 commit 7fc69fc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/visual.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,17 @@ export class DualKpi implements IVisual {
491491
this.eventService.renderingStarted(options)
492492
try {
493493
const dataView: DataView = this.dataView = options.dataViews && options.dataViews[0];
494+
495+
const hasAxis = dataView?.categorical?.categories?.some(category => category.source.roles["axis"]);
496+
const hasTopValues = dataView?.categorical?.values?.some(value => value.source.roles["topvalues"]);
497+
const hasBottomValues = dataView?.categorical?.values?.some(value => value.source.roles["bottomvalues"]);
498+
494499
if (!dataView ||
495500
!dataView.metadata ||
496-
!dataView.metadata.columns) {
501+
!dataView.metadata.columns ||
502+
(!hasBottomValues && !hasTopValues) ||
503+
!hasAxis
504+
) {
497505

498506
this.displayRootElement(false);
499507

@@ -534,7 +542,7 @@ export class DualKpi implements IVisual {
534542
this.eventService.renderingFinished(options)
535543
} catch (error) {
536544
this.eventService.renderingFailed(options, error);
537-
console.error(error);
545+
console.error("Rendering error", error);
538546
}
539547
}
540548

0 commit comments

Comments
 (0)