From 695f186e8cdddd604f16ea858f4f8862520e2d02 Mon Sep 17 00:00:00 2001 From: dreamerryao Date: Fri, 7 Jul 2023 16:28:08 +0800 Subject: [PATCH] fix(liquidity chart): fix hover display error --- src/containers/D3LiquidityHistogram.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/containers/D3LiquidityHistogram.tsx b/src/containers/D3LiquidityHistogram.tsx index 36ccb8f..bc9c598 100644 --- a/src/containers/D3LiquidityHistogram.tsx +++ b/src/containers/D3LiquidityHistogram.tsx @@ -199,11 +199,11 @@ class D3LiquidityHistogram { if (this.x(x0) > this.props.width * 0.8) { focusTextToken0 .html( - `${this.token0Symbol}: ${getPriceFromTick( + `${this.token1Symbol}: ${getPriceFromTick( x0, this.props.token0Decimal, this.props.token1Decimal - ).toFixed(6)} ${this.token1Symbol}` + ).toFixed(6)} ${this.token0Symbol}` ) .attr("x", function (d: any) { return self.x(x0) - (this.getComputedTextLength() + 5); @@ -212,14 +212,14 @@ class D3LiquidityHistogram { .attr("y", 5); focusTextToken1 .html( - `${this.token1Symbol}: ${( + `${this.token0Symbol}: ${( 1 / getPriceFromTick( x0, this.props.token0Decimal, this.props.token1Decimal ) - ).toFixed(6)} ${this.token0Symbol}` + ).toFixed(6)} ${this.token1Symbol}` ) .attr("x", function (d: any) { return self.x(x0) - (this.getComputedTextLength() + 5); @@ -229,25 +229,25 @@ class D3LiquidityHistogram { } else { focusTextToken0 .html( - `${this.token0Symbol}: ${getPriceFromTick( + `${this.token1Symbol}: ${getPriceFromTick( x0, this.props.token0Decimal, this.props.token1Decimal - )} ${this.token1Symbol}` + )} ${this.token0Symbol}` ) .attr("x", this.x(x0) + 5) .attr("text-anchor", "left") .attr("y", 5); focusTextToken1 .html( - `${this.token1Symbol}: ${( + `${this.token0Symbol}: ${( 1 / getPriceFromTick( x0, this.props.token0Decimal, this.props.token1Decimal ) - ).toFixed(6)} ${this.token0Symbol}` + ).toFixed(6)} ${this.token1Symbol}` ) .attr("x", this.x(x0) + 5) .attr("text-anchor", "left")