From e1f690a566001765bf12f16bf570fc4fa82c881e Mon Sep 17 00:00:00 2001 From: Ludek <13610612+ludeknovy@users.noreply.github.com> Date: Fri, 16 Apr 2021 11:23:17 +0200 Subject: [PATCH] label chart collapsable (#138) --- .../label-chart/label-chart.component.css | 7 +++++++ .../label-chart/label-chart.component.html | 11 ++++++++--- .../label-chart/label-chart.component.ts | 15 ++++++++++++--- src/index.html | 2 +- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/app/item-detail/label-chart/label-chart.component.css b/src/app/item-detail/label-chart/label-chart.component.css index c16e9ba5..8a07445f 100644 --- a/src/app/item-detail/label-chart/label-chart.component.css +++ b/src/app/item-detail/label-chart/label-chart.component.css @@ -21,3 +21,10 @@ .compare-card { margin-top: 20px;; } + +.jtl-ico-btn-light{ + color: #4b7cf3; +} +.jtl-ico-btn-light:hover{ + color: grey; +} 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 1ecc6dee..7bbba95d 100644 --- a/src/app/item-detail/label-chart/label-chart.component.html +++ b/src/app/item-detail/label-chart/label-chart.component.html @@ -3,7 +3,12 @@
Label Chart - {{labelChartMetric}} - + + + +
@@ -28,9 +33,9 @@
+ class="highchart-chart" [callbackFunction]="getInstance.bind(this)" + style="width: 100%; height: 100%; display: block;">
- 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 604b7d57..f847f3e4 100644 --- a/src/app/item-detail/label-chart/label-chart.component.ts +++ b/src/app/item-detail/label-chart/label-chart.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import * as Highcharts from 'highcharts'; import { commonGraphSettings, threadLineSettings } from 'src/app/graphs/item-detail'; @@ -11,7 +11,6 @@ export class LabelChartComponent implements OnInit { @Input() labels: Map; Highcharts: typeof Highcharts = Highcharts; - HighchartsCompare: typeof Highcharts = Highcharts; chartConstructor = 'chart'; labelChartMetric = 'Throughput'; labelCompareChartMetric; @@ -20,6 +19,8 @@ export class LabelChartComponent implements OnInit { chartKeys; seriesVisibilityToggle = true; seriesVisibilityToggleText = 'Hide all'; + chartShouldExpand = false; + chart; constructor() { } @@ -40,12 +41,20 @@ export class LabelChartComponent implements OnInit { this.updateLabelChartFlag = true; } - toggleSeriesVisibility(event) { + toggleSeriesVisibility() { this.labelChartOptions.series.map(_ => _.visible = !this.seriesVisibilityToggle); this.seriesVisibilityToggleText = this.seriesVisibilityToggle ? 'Show all' : 'Hide all'; this.seriesVisibilityToggle = !this.seriesVisibilityToggle; this.updateLabelChartFlag = true; + } + collapseChart() { + this.chartShouldExpand = !this.chartShouldExpand; + this.chart.setSize(undefined, this.chartShouldExpand ? 650 : 350); } + + getInstance(chart): void { + this.chart = chart; + } } diff --git a/src/index.html b/src/index.html index 02916d04..b5e87305 100644 --- a/src/index.html +++ b/src/index.html @@ -6,7 +6,7 @@ - +