From af3af5f0994cbe2e2efac61046faa36a933f49fc Mon Sep 17 00:00:00 2001 From: Miguel Medeiros Date: Fri, 8 Oct 2021 12:42:43 -0300 Subject: [PATCH] Fix tooltip ranges. --- .../mempool-graph/mempool-graph.component.ts | 38 ++++++++++--------- .../statistics/statistics.component.html | 4 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts index 0cd0c589e..af3093442 100644 --- a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts +++ b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts @@ -34,7 +34,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { hoverIndexSerie = 0; feeLimitIndex: number; feeLevelsOrdered = []; - chartColorsOrdered = []; + chartColorsOrdered = chartColors; inverted: boolean; constructor( @@ -85,7 +85,8 @@ export class MempoolGraphComponent implements OnInit, OnChanges { generateArray(mempoolStats: OptimizedMempoolStats[]) { const finalArray: number[][] = []; let feesArray: number[] = []; - for (let index = 37; index > -1; index--) { + + for (let index = 28; index > -1; index--) { feesArray = []; mempoolStats.forEach((stats) => { feesArray.push(stats.vsizes[index] ? stats.vsizes[index] : 0); @@ -100,9 +101,13 @@ export class MempoolGraphComponent implements OnInit, OnChanges { this.orderLevels(); const { labels, series } = this.mempoolVsizeFeesData; - const seriesGraph = series.map((value: Array, index: number) => { - if (index >= this.feeLimitIndex){ - return { + const seriesGraph = []; + const newColors = []; + for (let index = 0; index < series.length; index++) { + const value = series[index]; + if (index >= this.feeLimitIndex) { + newColors.push(this.chartColorsOrdered[index]); + seriesGraph.push({ name: this.feeLevelsOrdered[index], type: 'line', stack: 'fees', @@ -138,18 +143,18 @@ export class MempoolGraphComponent implements OnInit, OnChanges { }], }, areaStyle: { - color: chartColors[index], + color: this.chartColorsOrdered[index], opacity: 1, }, data: value - }; + }); } - }); + } this.mempoolVsizeFeesOptions = { series: this.inverted ? [...seriesGraph].reverse() : seriesGraph, hover: true, - color: this.inverted ? [...this.chartColorsOrdered].reverse() : this.chartColorsOrdered, + color: this.inverted ? [...newColors].reverse() : newColors, tooltip: { show: (window.innerWidth >= 768) ? true : false, trigger: 'axis', @@ -174,12 +179,10 @@ export class MempoolGraphComponent implements OnInit, OnChanges { const items = this.inverted ? [...params].reverse() : params; items.map((item: any, index: number) => { totalParcial += item.value; - let progressPercentage = 0; - let progressPercentageSum = 0; - progressPercentage = (item.value / totalValue) * 100; - progressPercentageSum = (totalValueArray[index] / totalValue) * 100; + const progressPercentage = (item.value / totalValue) * 100; + const progressPercentageSum = (totalValueArray[index] / totalValue) * 100; let activeItemClass = ''; - let hoverActive: number; + let hoverActive = 0; if (this.inverted) { hoverActive = Math.abs(this.feeLevelsOrdered.length - item.seriesIndex - this.feeLevelsOrdered.length); } else { @@ -198,7 +201,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { @@ -208,10 +211,10 @@ export class MempoolGraphComponent implements OnInit, OnChanges { itemFormatted.push(` - ${this.inverted ? this.feeLevelsOrdered[index] : item.seriesName} + ${item.seriesName} @@ -336,6 +339,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { } orderLevels() { + this.feeLevelsOrdered = []; for (let i = 0; i < feeLevels.length; i++) { if (feeLevels[i] === this.limitFilterFee) { this.feeLimitIndex = i; diff --git a/frontend/src/app/components/statistics/statistics.component.html b/frontend/src/app/components/statistics/statistics.component.html index df372db3f..670f3d861 100644 --- a/frontend/src/app/components/statistics/statistics.component.html +++ b/frontend/src/app/components/statistics/statistics.component.html @@ -50,7 +50,7 @@ - + 0 - {{ fee }} @@ -62,7 +62,7 @@ {{feeLevels[i - 1]}} - {{ fee }} - + {{feeLevels[i + 1]}} - {{ fee }}