Graph with muliple dynamic lines base on filter fields. Is it possible?

Let’s suppose that we have a model with the following fields:

I would like to plot a graph with as many lines as M2O_REF selected with TIMESTAMP on X and VALUE on Y.

I can do X and Y with TIMESTAMP and VALUES but the VALUES from different M2O_REF are added for each TIMESTAMP. I’d like to have different lines instead of adding values.

Is it possible do define a “line filter field” or similar on Y to get multiple lines?

If you have a limited number of M2O value, you can use as many <y> as value and for each one you set a domain to filter only the value right M2O value and a key different for each M2O value. See Views — trytond 5.3 documentation

Thanks a lot for the quick answer.

There a few M2O values but they are controlled by users and I can not hard-code them in the xml.

The solution described as I understand it will work with a Selection field where we know all the possible values ahead of time.

You may override ModelView.fields_view_get in order to construct the XML dynamically based on the values of the M2O.
In this case, you may have client cache issue when new values are created (but if it is rare enough, it may not be a problem).

Side note: I was wondering a few times if we should not have a mini templating language in the views.

That sounds like an interesting idea.