Dashboards & Visualizations

How to set values y-axis for a stacked color bar graph


Good day

I have managed to create a graph with 2 y axis values FUP which is color and AP which is the number of stacked bars. What i would want is When Ap =0 it highlights four stacked bars , when AP = 100 then 3 stacked bars, when

AP0 = 4 bars
AP100=3 bars
AP150=2 bars
AP200=1 bar

I have used the script below but it is giving me the inverse of what i want. FUP is the color which will fill the AP bars. Attached screenshot

      <query>index=sandvine sourcetype=sql subscriber_name="$subscriberid$"
      |eval chartcolor=case(subscriber_fup=200,"Red",subscriber_fup=150,"Orange",subscriber_fup=100,"Yellow",subscriber_fup=0,"Green")
      | eval chartbars=round(subscriber_ap/50)
      |timechart span=1h max(chartbars) by chartcolor</query>
      <latest>$time_range.latest$</latest>![alt text][1]
0 Karma

   | eval chartbars=if(subscriber_ap=0,4,5-round(subscriber_ap/50))
0 Karma