Fix x-axis bugs
This commit is contained in:
parent
ee4bb5e336
commit
7494952661
|
|
@ -48,7 +48,7 @@ function SupplyVsDemandChart({
|
||||||
const f = S_of_R;
|
const f = S_of_R;
|
||||||
const from = 0;
|
const from = 0;
|
||||||
const to = 4 * R0;
|
const to = 4 * R0;
|
||||||
const steps = 100;
|
const steps = 100 + 1; // Add 1 for the ticks to match
|
||||||
const step = (to - from) / steps;
|
const step = (to - from) / steps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -72,7 +72,8 @@ function SupplyVsDemandChart({
|
||||||
const keyVertical = "Supply (tokens) / Reserve (DAI)";
|
const keyVertical = "Supply (tokens) / Reserve (DAI)";
|
||||||
|
|
||||||
const data = [];
|
const data = [];
|
||||||
for (let x = from; x <= to; x += step) {
|
for (let i = 0; i < steps; i++) {
|
||||||
|
const x = from + step * i;
|
||||||
data.push({
|
data.push({
|
||||||
[keyHorizontal]: x,
|
[keyHorizontal]: x,
|
||||||
[keyVertical]: f(x)
|
[keyVertical]: f(x)
|
||||||
|
|
@ -119,8 +120,7 @@ function SupplyVsDemandChart({
|
||||||
>
|
>
|
||||||
<CartesianGrid strokeDasharray="3 3" />
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
<XAxis
|
<XAxis
|
||||||
interval={"preserveStartEnd"}
|
interval={24}
|
||||||
ticks={getLinspaceTicks(data.map(d => d[keyHorizontal]), 4)}
|
|
||||||
dataKey={keyHorizontal}
|
dataKey={keyHorizontal}
|
||||||
tickFormatter={formatter}
|
tickFormatter={formatter}
|
||||||
unit={unit}
|
unit={unit}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue