vegaprotocol / pennant

A charting library for Vega Console
https://pennant.vega.xyz
MIT License
25 stars 8 forks source link

Reduce gap between candles #909

Closed barnabee closed 11 months ago

barnabee commented 1 year ago

Story

As a trader I want the gaps between candles to be a as small as possible So that I can see more candles for a given interval

Acceptance Criteria

barnabee commented 1 year ago

These screenshots are all default views at the same resolution:

Screenshot 2023-08-24 at 13 01 23 Screenshot 2023-08-24 at 13 03 11 Screenshot 2023-08-24 at 13 03 38 Screenshot 2023-08-24 at 13 06 41
JonRay15 commented 1 year ago

I would like to also point out I dont like the new colours...

Osthumus commented 1 year ago
Screenshot 2023-08-24 at 13 01 23

The volume section is way bigger than necessary and not aesthetic. Also the colour saturation seems to be too high (not sure if that's a bad thing).

barnabee commented 1 year ago

I was making some screenshots today— I think it'd be great for the initial chart setup to perhaps look something like this (all supported already, just setting zoom and sizes and what's enabled), thoughts?

Screenshot 2023-08-29 at 16 19 15
Osthumus commented 1 year ago

Yes, looks much cleaner. Current size of indicator is too chunky and overwhelming. User can change it anyways if they wanted bigger size.

barnabee commented 1 year ago

See these examples for the candle/bar spacing issue in Pennant. In short, candles should be a fixed spacing apart (looks like 1 or 2 pixels?) regardless of zoom, but Pennant grows the gaps as it grows the bars.

Screenshot 2023-08-29 at 23 31 35 Screenshot 2023-08-29 at 23 30 30
JonRay15 commented 12 months ago

Barney requested to widen the starting gap slightly ... @macqbat can do this with a param.

JonRay15 commented 11 months ago

Re-opening this until we get the full fix in

JonRay15 commented 11 months ago

I think after review with Barney the conclusion is what we actually need is:

Can we achieve this?

macqbat commented 11 months ago

I think after review with Barney the conclusion is what we actually need is:

  • A max gap when zoomed in
  • A min gap when zoomed out
  • Linear scaling based on zoom in between

Can we achieve this?

I've added new param which determines max gap in pixels (default 2px). Next to the previous parameter, which determines the size of the space in relation to the width of the chart bar, this new one gives us possibility to fully control over dimmension of the gap. This dimmension will be always the smaller of these two. So in high zoomed in chart we will always have max only 2px (or other value given as param) and bars will stop to diverge. Since everything on candles chart are keep in time units (milisecond), pixels are not really strictly calculated, but converted to miliseconds, hence they could have not always the same dimension like pixels on the page, but difference should be not relevant