ilgizar / ilgizar-candlestick-panel

Grafana candlestick panel plugin
MIT License
227 stars 54 forks source link

[Feature] Set box witdth #1

Closed JamesGalt closed 6 years ago

JamesGalt commented 6 years ago

I dont know why but boxes are two wide see screenshot I'm using Grafana Version 4.6.3 (commit: 7a06a47)

capture d ecran 2018-02-22 a 00 55 20

Thanks

ilgizar commented 6 years ago

I'm develop and test on 5.0.0-beta. The plans are to create a parameter that sets the width and number of boxes.

JamesGalt commented 6 years ago

It may come from there, does 5.0.0-beta is stable enough? do you know how to migrate safely from 4.6.3 to 5.0.0? the number of boxes is not set by the groupBY time?

JamesGalt commented 6 years ago

The problem comes from the fact I use a template variable for the groupBY interval so setting box width may come handy to avoid this issue. Are you using the __$interval hard coded in the panel? You can also set the box width by dividing the width of the graph by the length of data. This would make it dynamique so it's the best way I think. (like the bar view in the graph panel)

ilgizar commented 6 years ago

5.0.0-beta is unstable. I do not recommend yet to be updated, because no return. Examples of query: open: SELECT first("open") FROM "ticker" WHERE ("market" =~ /^$market$/ AND "pair" =~ /^$pair$/) AND $timeFilter GROUP BY time($__interval) fill(linear) close: SELECT last("close") FROM "ticker" WHERE ("market" =~ /^$market$/ AND "pair" =~ /^$pair$/) AND $timeFilter GROUP BY time($__interval) fill(linear) low: SELECT min("low") FROM "ticker" WHERE ("market" =~ /^$market$/ AND "pair" =~ /^$pair$/) AND $timeFilter GROUP BY time($__interval) fill(linear) high: SELECT max("high") FROM "ticker" WHERE ("market" =~ /^$market$/ AND "pair" =~ /^$pair$/) AND $timeFilter GROUP BY time($__interval) fill(linear) volume: SELECT max("volume") FROM "ticker" WHERE ("market" =~ /^$market$/ AND "pair" =~ /^$pair$/) AND $timeFilter GROUP BY time($__interval) fill(linear)

JamesGalt commented 6 years ago

I use the same queries, but it would be great to be able to use custom intervals. so the box width should be calculated using the value in the GROUP BY time(XXX) so it adjusts by itself. Thanks

JamesGalt commented 6 years ago

Hi, Thanks, This is better but is it possible to set it dynamically (panel width / nb data points)? I don't know how it is done in the graph panel but when you select bars drawing it adjusts by itself. Thanks

ilgizar commented 6 years ago

Auto width by max data points. Candlestick width = panel width / max data points.

JamesGalt commented 6 years ago

I've seen that, but I'm talking about real auto, without setting max data points like in the graph panel

capture d ecran 2018-02-26 a 08 58 09

look at the bars they auto adapt. By the way thanks, i really appreciate the work. ;)

JamesGalt commented 6 years ago

I think in the graph panel it is related to here and there for the drawing Not sure because I'm not a javascript wizard. I mostly do Python ;)

ilgizar commented 6 years ago

Try now autowidth.

JamesGalt commented 6 years ago

Perfect !!!! 🥇

JamesGalt commented 6 years ago

Last thing to be perfect, it should be aligned with the bar graph (I think you center the box and they dont in the bar graph) see screenshot below capture d ecran 2018-02-26 a 18 35 47 Impressive work by the way