问题
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:
- Add 2 overrides, one for each value you want to display using the 'Add series override' button.
- Add a "Bars:false" option flag and a "Lines:true" for the value you want as a line.
- Be sure to use the exact opposite values for your bars ("Bars:true" & "Lines:false")
- Add a 'Y-axis: 2' to the value you want to have on the right side of your graph.
- 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