Skip to content

Commit

Permalink
fix: resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazq committed Aug 28, 2024
1 parent f4043fc commit 90ac015
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/feature/depth-chart/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class Chart extends EventEmitter {
// console.log("==size==", size);
const priceScale = scaleLinear()
.domain(priceExtent)
.range([0, this.width - 16 * size]);
.range([0, this.width - resolution * 8 * size]);

// Add dummy data points at extreme points of price range
// to ensure the chart looks symmetric
Expand Down Expand Up @@ -302,7 +302,7 @@ export class Chart extends EventEmitter {
priceScale(point[0]),
flag ? this.height - resolution * AXIS_HEIGHT : volumeScale(point[1]),
]),
16 * size,
resolution * 8 * size,
);

// TODO: Clean up this logic
Expand Down Expand Up @@ -331,7 +331,7 @@ export class Chart extends EventEmitter {
this.axis.colors = this._colors;

this.axis.update(
this.width - 16 * size,
this.width - resolution * 8 * size,
this.height,
this.prices.map((price) => priceScale(price)),
this.volumes.map((volume) =>
Expand Down
10 changes: 5 additions & 5 deletions src/feature/depth-chart/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ export class UI extends EventEmitter {
const descFmtStrs = formatTicks.sort((a, b) => b.length - a.length);
const size = descFmtStrs[0]?.length + 0.8;
// console.log("====", size);
const width = this.renderer.view.width - 16 * size;
const width = this.renderer.view.width - resolution * 8 * size;
const height = this.renderer.view.height;

// In auction mode. Curves will in general overlap
Expand Down Expand Up @@ -647,7 +647,7 @@ export class UI extends EventEmitter {
// console.log(this.volumeLabels[buyIndex]);
this.buyVolumeText.update(
this.volumeLabels[buyIndex],
this.buyVolumeText.width,
0,
Math.min(
Math.max(
this.volumes[buyIndex],
Expand All @@ -658,7 +658,7 @@ export class UI extends EventEmitter {
(resolution * this.buyVolumeText.height) / 2 -
2,
),
{ x: 0.5, y: 0.5 },
{ x: 0, y: 0.5 },
resolution,
this.colors,
);
Expand Down Expand Up @@ -713,7 +713,7 @@ export class UI extends EventEmitter {

this.sellVolumeText.update(
this.volumeLabels[sellIndex],
width - this.sellVolumeText.width,
width,
Math.min(
Math.max(
this.volumes[sellIndex],
Expand All @@ -724,7 +724,7 @@ export class UI extends EventEmitter {
(resolution * this.sellVolumeText.height) / 2 -
2,
),
{ x: 0.5, y: 0.5 },
{ x: 1, y: 0.5 },
resolution,
this.colors,
"sell",
Expand Down

0 comments on commit 90ac015

Please sign in to comment.