Skip to main content
Associate II
August 24, 2023
Question

multiple data line Dynamic Graph

  • August 24, 2023
  • 1 reply
  • 2718 views

Hello, I'm using a dynamic graph for a project. Can I display 2 different sets of data on this graph? Using 2 separate graphs doesn't solve my problem since I need them to be on the same graph.

This topic has been closed for replies.

1 reply

Osman SOYKURT
Technical Moderator
August 24, 2023

Hello @amorftor,

Do you mean you want to use only one graph widget? or do you want to show one graph?
With touchgfx, you can easily show multiple sets of data in one graph, but you must use multiple graph widgets (as they're only matching with 1 set of data). For example, with the graph example we provide in TouchGFX, I copied the graph widget and modified it a little bit in the code to make it look like this :

OsmanSOYKURT_0-1692889993316.png

Let me know if it's what you want to realize.

Osman SOYKURTST Software Developer | TouchGFX
amorftorAuthor
Associate II
August 24, 2023

I wanted to show only 1 widget. Normally, I show the data using 2 graphs, but when I need to autoscale on the y-axis, the ratios of the 2 graphs change and I can't get proper results.

Osman SOYKURT
Technical Moderator
August 25, 2023

Hello @amorftor ,

I see. Then I would use the autoscale for only one of the 2 graphs, and the other one should use the scale defined by the first one using the getScale() and setScale() functions. For the range of your second graph, you should also use the range of your first graph using the getGraphRange() and setGraphRange() functions. In that way, you could draw only one graph with 2 sets of data that have the same scale and range.

Osman SOYKURTST Software Developer | TouchGFX