Skip to content
Snippets Groups Projects
Commit 84dc3d3f authored by Karolína Dočkalová Burská's avatar Karolína Dočkalová Burská
Browse files

Add control output for dashboard chart display

parent 5cd05516
No related branches found
No related tags found
1 merge request!4Resolve "Indicate insufficient data"
Pipeline #211375 passed
14.0.2 Propagate insufficient data info for dashboard processing
14.0.1 Update API routes 14.0.1 Update API routes
14.0.0 Initial clustering library version 14.0.0 Initial clustering library version
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*ngIf="includeInButtonToggle" *ngIf="includeInButtonToggle"
(click)="toggleChartVisibility()"> {{buttonKeyword}} helper elbow function </button> (click)="toggleChartVisibility()"> {{buttonKeyword}} helper elbow function </button>
<div [attr.style]="'display: ' + (showChart ? 'block' : 'none')"> <div [attr.style]="'display: ' + (showChart ? 'inline-block' : 'none')">
<div id="chartDiv"></div> <div id="chartDiv"></div>
<div id="helpDiv"> <div id="helpDiv">
<b>How to use this chart?</b> <b>How to use this chart?</b>
......
...@@ -62,9 +62,7 @@ export class LineChartComponent implements OnChanges, OnInit { ...@@ -62,9 +62,7 @@ export class LineChartComponent implements OnChanges, OnInit {
checkData() { checkData() {
const isAllNothing = this.visualizationData.every((value) => value === 0 || Number.isNaN(value) || value === null); const isAllNothing = this.visualizationData.every((value) => value === 0 || Number.isNaN(value) || value === null);
if (isAllNothing) { this.insufficientData.emit(isAllNothing);
this.insufficientData.emit(true);
}
return !isAllNothing; return !isAllNothing;
} }
......
...@@ -221,7 +221,10 @@ export class ScatterPlotComponent implements OnChanges, OnInit { ...@@ -221,7 +221,10 @@ export class ScatterPlotComponent implements OnChanges, OnInit {
.data(this.data) .data(this.data)
.enter() .enter()
.append('circle') .append('circle')
.attr('cx', (d: any) => this.x(this.visualizationDataService.getX(d, this.selectedFeature)) + this.margin) .attr('cx', (d: any) => {
const x = this.x(this.visualizationDataService.getX(d, this.selectedFeature));
return Number.isNaN(x) ? this.margin : x + this.margin;
})
.attr('cy', (d: any) => this.y(this.visualizationDataService.getY(d, this.selectedFeature))) .attr('cy', (d: any) => this.y(this.visualizationDataService.getY(d, this.selectedFeature)))
.attr('r', 7) .attr('r', 7)
.style('opacity', 0.5) .style('opacity', 0.5)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
[elbowNumClusters]="elbowNumClusters" [elbowNumClusters]="elbowNumClusters"
[includeInButtonToggle]="true" [includeInButtonToggle]="true"
(viewOpen)="toggleView($event)" (viewOpen)="toggleView($event)"
(insufficientData)="checkData($event)" (insufficientData)="insufficientData($event)"
></kypo-viz-clustering-line-chart> ></kypo-viz-clustering-line-chart>
<kypo-viz-clustering-scatter-plot <kypo-viz-clustering-scatter-plot
......
...@@ -22,6 +22,7 @@ export class VisualizationsComponent implements OnInit, OnChanges { ...@@ -22,6 +22,7 @@ export class VisualizationsComponent implements OnInit, OnChanges {
@Output() viewOpen: EventEmitter<boolean> = new EventEmitter(); @Output() viewOpen: EventEmitter<boolean> = new EventEmitter();
@Output() chartIsHidden: EventEmitter<any> = new EventEmitter(); @Output() chartIsHidden: EventEmitter<any> = new EventEmitter();
hideLineData = [];
elbowNumClusters = 15; // this ensures we don't load different data after every line chart change (15 clusters should be just enough) elbowNumClusters = 15; // this ensures we don't load different data after every line chart change (15 clusters should be just enough)
lineData$: Observable<VisualizationData>; lineData$: Observable<VisualizationData>;
...@@ -78,9 +79,11 @@ export class VisualizationsComponent implements OnInit, OnChanges { ...@@ -78,9 +79,11 @@ export class VisualizationsComponent implements OnInit, OnChanges {
} }
} }
checkData(hideChart: boolean) { insufficientData(badData: boolean) {
// if we don't have enough data for sse, we should hide the remaining related // if we don't have enough data for sse, we should hide the remaining related
// charts as well, since they will also lack data for visualization // charts as well, since they will also lack data for visualization
this.chartIsHidden.emit({ hide: hideChart, features: this.selectedFeature }); this.hideLineData = this.hideLineData.filter((value) => value.feature !== this.selectedFeature);
this.hideLineData.push({ hide: badData, feature: this.selectedFeature });
this.chartIsHidden.emit(this.hideLineData);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment