# Positive/negative bar for Vertial/Horizontal bar improvemment

I have 5 sensor stations sending data to the Blynk with the value between -150…150. I put 5 vertical bars side-by-side of each others.
When I sent value, e.g. -100 the bar was fill from the bottom.
It would be great if the bar can fill up/down around zero reference instead of from the bottom of the bar.

2 Likes

Just set your MIN & MAX accordingly.

Yes. That’s what I did today. But when I get negative value e.g. -100, the bar will draw from the bottom, not from the middle (0 is at the middle of the bar)
or when I get, e.g . +100, the bar will draw from the bottom, not from the middle where 0 is there. Something like

I understand now.

@Dmitriy I think what could work is an option to set the draw start point based on 0. That way it can work for those who want it to always start from the bottom/left (regardless of MIN/MAX) and those who want it to start from where the 0 point is (based on the MIN/MAX). Possible?

if we can set draw reference to any value, this could make it more flexible, For example, if I set draw ref. = 0, it will draw a bar to what I need.
but if I set draw ref. = MIN, it will behave as of today.
If I set draw ref. to -50, it will draw positive bar for +30 if I get value of -20
if I set draw ref.=MAX, it become flip axis

@tbdltee It turns out that with the use of two displays, end to end, we can already do what you want.

Just flip the axis of one display and tweak the MIN/MAX accordingly on both.

I am using a potentiometer to simulate your -150 to 150 sensor value

``````  Blynk.virtualWrite(V14, analogRead(2));
int val = map(analogRead(2), 0, 1023, -150, 150); // Mapped from POT
Blynk.virtualWrite(V26, val); // Upper Bar (0 to 150)
Blynk.virtualWrite(V27, val);  // Lower Bar (0 to -150)
``````

Yeap… but the vertical bar look strange because there is a text showing value in between.
Currently, I’m using 2 horizontal bar with one is -150…0 and another one is 0…150. So the overall bar look smoother and Blynk is working great.
This workaround cost me of 10 bars + 10 virtual pins instead of 5. So I suggest if Blynk can improve the bar to make it more flexible.
if you can put more than 1 bar into the same widget, you could make a kind of equalizer bar.
Hmmm… may be this is a new widget…equalizer bar