From 1c22b12e4bf6ea4b6f10a10fd327a3fe307274bd Mon Sep 17 00:00:00 2001 From: Ludek Novy <13610612+ludeknovy@users.noreply.github.com> Date: Sat, 11 Feb 2023 22:12:07 +0100 Subject: [PATCH] label response time distribution chart (#306) --- src/app/graphs/item-detail.ts | 50 +++++++++++++++++++ .../analyze-charts.component.ts | 4 +- .../item-detail/item-detail.component.html | 2 +- src/app/item-detail/item-detail.component.ts | 6 +-- .../label-chart/label-chart.component.html | 2 +- .../label-chart/label-chart.component.ts | 44 +++++++++++----- .../request-stats-compare.component.html | 2 +- src/app/items.service.model.ts | 8 +++ 8 files changed, 96 insertions(+), 22 deletions(-) diff --git a/src/app/graphs/item-detail.ts b/src/app/graphs/item-detail.ts index 583d1d60..3dd3c87e 100644 --- a/src/app/graphs/item-detail.ts +++ b/src/app/graphs/item-detail.ts @@ -204,6 +204,56 @@ export const customChartSettings = () => { }; }; +export const responseTimeDistribution = (data) => { + return { + chart: { + type: "column" + }, + title: { + text: "" + }, + subtitle: { + text: "" + }, + legend:{ enabled:false }, + xAxis: { + crosshair: true, + type: "category", + min: 0, + categories: data.map((value, index) => index * 100) + }, + yAxis: { + min: 0, + title: { + text: "" + } + }, + tooltip: { + shared: true, + useHTML: true, + valueSuffix: "", + valueDecimals: 0, + formatter: function () { + return `${this.y} responses were between ${this.x} and ${this.x + 100} ms`; + } + }, + plotOptions: { + column: { + pointPadding: 0, + borderWidth: 0, + groupPadding: 0, + shadow: false + } + }, + series: [{ + data, + type: "column", + id: "histogram", + name: "Response times" + }] + } +} + export const threadLineSettings: any = { color: "grey", diff --git a/src/app/item-detail/analyze-charts/analyze-charts.component.ts b/src/app/item-detail/analyze-charts/analyze-charts.component.ts index 14822e95..e36ec8cf 100644 --- a/src/app/item-detail/analyze-charts/analyze-charts.component.ts +++ b/src/app/item-detail/analyze-charts/analyze-charts.component.ts @@ -146,8 +146,8 @@ export class AnalyzeChartsComponent implements OnInit { // hide all axis this.customChartsOptions.yAxis.forEach(axis => axis.visible = false) // display only actual axis - chartSeries.forEach(serie => { - this.customChartsOptions.yAxis[serie.yAxis].visible = true + chartSeries.forEach(series => { + this.customChartsOptions.yAxis[series.yAxis].visible = true }) this.customChartsOptions.series = JSON.parse(JSON.stringify(chartSeries)); this.updateLabelChartFlag = true; diff --git a/src/app/item-detail/item-detail.component.html b/src/app/item-detail/item-detail.component.html index fcc92928..59112b67 100644 --- a/src/app/item-detail/item-detail.component.html +++ b/src/app/item-detail/item-detail.component.html @@ -310,7 +310,7 @@