How to mix bar and lines in Grafana in one chart

戏子无情 提交于 2020-01-25 06:45:13

问题


How can I display one dataseries as bar and another as a line in one graph like it is used in the last comment of: see last picture


回答1:


Short answer:

It's not possible (yet) using the Grafana UI, only by hand.

Long answer:

As far as I know there is no way of doing this using the UI switches; you'll have to use the use the "alias or regex" fields below the visualisation configuration.

Prepare your data

Before you start, make sure that your queries A and B retrieve actual data. You won't see your data otherwise and be confused why they're not showing.

Adding fields and values to the aliases

Once you are selecting the correct data you want to display, just add the following on the visualisation section of the graph at the 'alias or regex' fields:

  1. Add 2 overrides, one for each value you want to display using the 'Add series override' button.
  2. Add a "Bars:false" option flag and a "Lines:true" for the value you want as a line.
  3. Be sure to use the exact opposite values for your bars ("Bars:true" & "Lines:false")
  4. Add a 'Y-axis: 2' to the value you want to have on the right side of your graph.
  5. Optionally, you can add a "Z-index: 3" for the value that you want to have on top (I added this option to the line to make sure it's always drawing on top of the bars).

Enjoy

You should now have a nice graph with 2 types of data and visualisations in one; something like this:



来源:https://stackoverflow.com/questions/59513362/how-to-mix-bar-and-lines-in-grafana-in-one-chart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!