From acbd7f0bdecd67d657d77242e27599a81bba3d75 Mon Sep 17 00:00:00 2001 From: Miguel Medeiros Date: Sun, 26 Sep 2021 15:17:29 -0300 Subject: [PATCH] Fix inverted tooltip when invert chart. --- .../mempool-graph/mempool-graph.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 ed6282e1d..f7ced356d 100644 --- a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts +++ b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts @@ -162,21 +162,21 @@ export class MempoolGraphComponent implements OnInit, OnChanges { type: 'line', }, formatter: (params: any) => { - const colorSpan = (item: any) => ` + const colorSpan = (index: any) => ` - ${this.feeLevelsOrdered[item.seriesIndex]} + ${this.feeLevelsOrdered[index]} `; const totals = (values: any) => { let totalValueTemp = 0; const totalValueArrayTemp = []; - const valuesInverted = [...values].reverse(); + const valuesInverted = this.inverted ? values : [...values].reverse(); for (const item of valuesInverted) { totalValueTemp += item.value; totalValueArrayTemp.push(totalValueTemp); } return { totalValue: totalValueTemp, - totalValueArray: totalValueArrayTemp.reverse() + totalValueArray: this.inverted ? totalValueArrayTemp.reverse() : totalValueArrayTemp.reverse(), }; }; const { totalValue, totalValueArray } = totals(params); @@ -197,7 +197,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { progressPercentage = (item.value / totalValue) * 100; progressPercentageSum = (totalValueArray[index] / totalValue) * 100; let activeItemClass = ''; - if (this.hoverIndexSerie === index) { + if (this.hoverIndexSerie === item.seriesIndex) { progressPercentageText = `
${progressPercentage.toFixed(2)} @@ -216,7 +216,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { } itemFormatted.push(` - ${colorSpan(item)} + ${colorSpan(index)}