Jump to content

Pixi Graphics line resolution not sharp on zoom


barrard
 Share

Recommended Posts

Hey all, 

I have a PIXI.Graphics line with about 500k points.  Draws fine, I added PIXI-Viewport for zoom and pan.  When I zoom in the line resolution is not good.

 

2 questions.

Main Question, how to fix the sharpness of the line on zoom-in

Second question, how can I limit the zoom and pan to the min and max of this line I've drawn?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for your response Ivan, sorry for my delay.  Weekend side project I don't get much time to hack on.  I realized the line was not being scaled by the same factor as the zoom.  Also, I wasn't really happy with how the Pixi-ViewPort zoom worked, as I only wanted to zoom the left and right, and keep the min and max values on the top and bottom scale.  

I ended up slicing my data according to mouse position and zoom, and then redraw the line.  It's terrible slow though at first, as I'm redrawing the line with so many points, but as the sliced data gets reduced the line redraws quicker.

 

```

drawPriceLine() {
    this.priceGfx.clear();
 
    console.log(`Draw line with ${this.allTicks.length} points`);
    //Tick line
    this.priceGfx.lineStyle(1, 0xffffff, 1);
    this.allTicks.forEach((tick, i) => {
        const x = this.xScale(tick.datetime);
        const y = this.priceScale(tick.close);
        if (i === 0) {
            this.priceGfx.moveTo(x, y);
        } else {
            this.priceGfx.lineTo(x, y);
        }
    });
}

```

Do you have any suggestions that might be more efficient?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...