KLineChart icon indicating copy to clipboard operation
KLineChart copied to clipboard

[Bug] Canvas shapes not aligning

Open olablt opened this issue 2 years ago • 2 comments

Version

8.6.0

Steps to Reproduce

To demonstrate I modified the test file https://github.com/liihuu/KLineChart/blob/master/tests/technical-indicator-template2.html

Changed the bar color to be more clear and height to full:

const realBarHeight = barHeight
ctx.globalCompositeOperation = 'source-over'
ctx.fillStyle = 'rgba(0, 155, 69, 0.8)'

Current Behavior

You can see that sometimes the bars align perfectly but most of the time they do not:

image

Expected Behavior

All bars should have no spaces and should not overlap each other

I am coding a Volume Profile indicator and my bars do not have even spaces like in this Tradingview vs Klinecharts bars example:

image

Environment

- OS: Linux
- Browser: Firefox, Chrome
- Framework:

Any additional comments?

No response

olablt avatar Jun 28 '22 16:06 olablt

Maybe it is related to Pixel perfect rendering?

  • https://www.tradingview.com/blog/en/announcing-lightweight-charts-2-0-17910/
  • https://github.com/tradingview/lightweight-charts/issues/274
  • https://github.com/tradingview/fancy-canvas

olablt avatar Jun 29 '22 15:06 olablt

Yes, I will optimize the later version. Thank you.

liihuu avatar Jul 02 '22 15:07 liihuu