Dual scales on line chart

Hi there,
I would like to have dual axis scaling on line charts.
Example below

Red line ranges between 0.0 to 100.0 whereas blue line varies between 0.0 to 2.0.

I tried setting up individual ymin and ymax for each time series but it breaks the UI.
Maybe I am doing something wrong?

Can you elaborate on how what you’re trying to accomplish “breaks the UI”? See the attached image, where I’m doing something similar to what you’re describing here. My time series graph has two segments; for one of them, I am defining the Y axis with a min and max of -10 and 10, and for the other I’m using -50 and 50, and I am getting my expected result.

If you can include screenshots of all the configuration options you have in place, in addition to the graph itself, I may be able to point out where things are going wrong.

Hello sure,
I had to take screenshots in pieces, otherwise impossible to fit in one panel.
First I set the range for the red time series.


Then I set the range for the blue time series.

And this is how it looks like


Somehow it picks only the last time series.

I am still trying to figure why this doesn’t work.

I can see a few differences from your example:

  • I am using context variables
  • I am using a different label for each segment
  • I am using historical data with aggregation (can’t tell if you are using the same setup)?

I am creating a dummy example now from scratch to figure out when it stops working.

I can confirm it works on a dashboard without context variables and the integer simulator.
Adding now context variables.

Can you take screenshots of your segment configuration and the resulting block? I’m just not seeing what you are describing.

Attached are images of me doing what I think you’re describing here: Using context variables for axis labels. I’m using two different labels with two different underlying values and I am getting the expected result.

I found the reason finally.

When I use the literal Axis labels it works fine, I set them to A (first) and B (second).

but when change to context labels it confuses it.
Add the one for the first segment, still good.

Add the one for the second one and then somehow it imposes only the second segment:

The reverse is also true I set the second segment to context and then the first one to literal A and is working.

So basically I am unable to display 2 segments with 2 different context variables as their labels.
Let me know if you can repo.

I think I understand now … Though you are using two different context variables, is the underlying value of the two variables equal? It appears they both resolve to “m^3”.

To avoid cluttering the graph, we try and reduce the number of y axes if users enter two or more with the same label, and we key them by that label (which defaults to the attribute name if not provided). So if the value of one of those variables changed, I bet you’d get two different labels.

A workaround would be to include the attribute name in the label to make them different; from a user perspective this may be desirable because the unit alone may not tell the whole picture of the graph.

So if you changed your labels to “Flow_Volume ({{ctx.hf_meter.attributes.Flow_Volume.tags.units}}” and “Return_Volume ({{ctx.hf_meter.attributes.Return_Volume.tags.units}}”, you should then get two different axis labels.

Let me know if that makes sense, and thanks for the detailed info on what you were seeing.

I would never figure that out by myself, yes is working now:

Probably worth adding to the documentation before some other user will bang his head on that.