diff --git a/src/app/item-detail/item-detail.component.ts b/src/app/item-detail/item-detail.component.ts
index 74e9ea15..dbfd1120 100644
--- a/src/app/item-detail/item-detail.component.ts
+++ b/src/app/item-detail/item-detail.component.ts
@@ -37,6 +37,7 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
plot: null,
extraPlotData: null,
reportStatus: null,
+ histogramPlotData: null,
hostname: null,
statistics: [],
name: null,
@@ -121,11 +122,6 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
this.overallChartOptions = {
...overallChartSettings("ms")
};
-
-
-
-
-
}
ngOnDestroy() {
diff --git a/src/app/item-detail/label-chart/label-chart.component.html b/src/app/item-detail/label-chart/label-chart.component.html
index dd788810..37a7c02b 100644
--- a/src/app/item-detail/label-chart/label-chart.component.html
+++ b/src/app/item-detail/label-chart/label-chart.component.html
@@ -22,7 +22,7 @@
-
diff --git a/src/app/item-detail/label-chart/label-chart.component.ts b/src/app/item-detail/label-chart/label-chart.component.ts
index d392517a..e0c129d0 100644
--- a/src/app/item-detail/label-chart/label-chart.component.ts
+++ b/src/app/item-detail/label-chart/label-chart.component.ts
@@ -1,9 +1,10 @@
-import { Component, Input, OnChanges, SimpleChanges } from "@angular/core";
+import { Component, Input, OnChanges, SimpleChanges, ViewChild } from "@angular/core";
import * as Highcharts from "highcharts";
-import { commonGraphSettings } from "src/app/graphs/item-detail";
+import { commonGraphSettings, responseTimeDistribution } from "src/app/graphs/item-detail";
import * as deepmerge from "deepmerge";
import { ChartLine } from "src/app/_services/item-chart.service";
import { Metrics } from "../metrics";
+import { ResponseTimePerLabelDistribution } from "../../items.service.model";
@Component({
selector: "app-label-chart",
@@ -15,17 +16,19 @@ export class LabelChartComponent implements OnChanges {
@Input() chartLines: ChartLine;
@Input() label: string;
@Input() activated: boolean;
+ @Input() histogramData: ResponseTimePerLabelDistribution[];
+ @ViewChild("labelChart") componentRef;
+
Highcharts: typeof Highcharts = Highcharts;
chartMetric = "Response Times";
- labelCompareChartMetric;
- labelChartOptions = commonGraphSettings("reqs/s");
+ labelChartOptions = commonGraphSettings("ms"); // default empty chart for rendering
updateLabelChartFlag = false;
chartKeys;
chartShouldExpand = false;
chart: Highcharts.Chart;
chartCallback;
labelCharts = new Map();
- expanded = false
+ expanded = false;
private responseTimeMetricGroup: string[];
metricChartMap = new Map([
@@ -54,19 +57,19 @@ export class LabelChartComponent implements OnChanges {
// chart expanded
if (!changes.activated?.previousValue && changes.activated?.currentValue) {
- this.setChartAggregation()
+ this.setChartAggregation();
this.getChartsKey();
+ this.setHistogramChart();
this.changeChart({ target: { innerText: this.chartMetric } });
this.chart.reflow();
- this.expanded = true
+ this.expanded = true;
}
// aggregation changed, we need to refresh the data but only for opened charts
if (changes.chartLines?.currentValue && this.expanded) {
- this.chartLines = changes.chartLines.currentValue
- this.setChartAggregation()
+ this.chartLines = changes.chartLines.currentValue;
+ this.setChartAggregation();
this.changeChart({ target: { innerText: this.chartMetric } });
}
-
}
private setChartAggregation() {
@@ -77,23 +80,40 @@ export class LabelChartComponent implements OnChanges {
const labelMetricsData = this.chartLines.labels.get(metric).find(data => data.name === this.label);
const chartSettings = this.metricChartMap.get(metric);
if (this.responseTimeMetricGroup.includes(metric)) {
- responseTimesSeries.push({ data: labelMetricsData.data, suffix: labelMetricsData.suffix, name: metric, yAxis: 0 });
+ responseTimesSeries.push({ data: labelMetricsData.data, suffix: labelMetricsData.suffix, name: metric, yAxis: 0, id: metric });
} else {
- this.labelCharts.set(metric, { ...chartSettings, series: [{ data: labelMetricsData.data, suffix: labelMetricsData.suffix, name: metric }, threadLine] });
+ this.labelCharts.set(metric, {
+ ...chartSettings,
+ series: [{ data: labelMetricsData.data, suffix: labelMetricsData.suffix, name: metric, id: metric }, threadLine]
+ });
}
});
this.labelCharts.set("Response Times", { ...commonGraphSettings("ms"), series: [...responseTimesSeries, threadLine] });
}
+ private setHistogramChart() {
+ if (this.histogramData) {
+ this.chartKeys.push("Histogram");
+ const histogram = this.histogramData.find(data => data.label === this.label);
+ this.labelCharts.set("Histogram", responseTimeDistribution(histogram.values));
+ }
+ }
+
private getChartsKey() {
this.chartKeys = Array.from(this.labelCharts.keys());
+
}
changeChart(event) {
this.chartMetric = event.target.innerText;
+ if(this.chart) {
+ this.chart.destroy();
+ this.componentRef.chart = null;
+ }
this.labelChartOptions = deepmerge(this.labelCharts.get(this.chartMetric), {});
+ console.log(this.labelChartOptions)
this.updateLabelChartFlag = true;
}
diff --git a/src/app/item-detail/request-stats/request-stats-compare.component.html b/src/app/item-detail/request-stats/request-stats-compare.component.html
index fd14e777..65e291d8 100644
--- a/src/app/item-detail/request-stats/request-stats-compare.component.html
+++ b/src/app/item-detail/request-stats/request-stats-compare.component.html
@@ -157,7 +157,7 @@