2021-08-19 01:44 AM
I want to use graph drawing 2 line, in the MainView: : handleTickEvent () used in the graph. addDataPoint () to add data respectively?
Another requirement, line needs to be separated by some pixels, how to set.:face_with_tears_of_joy:
2021-08-19 02:22 AM
You need to add second line for DynamicGraph widget. And call addDataPoint() twice:
graph.addDataPoint( Value1 );
graph2.addDataPoint( Value2 );
2021-08-19 02:26 AM
What I want is to draw two lines in a graph. Can only one line be drawn in a graph?
dynamicGraph1.addGraphElement(dynamicGraph1Line1);
dynamicGraph1.addGraphElement(dynamicGraph1Line2);
2021-08-19 02:33 AM
You can add many lines on the same DynamicGraph in TouchGFX Designer. Use them like the first one.
Here is my test: the first graph (yellow) is sine with random noise and second one (blue) is slider value (61)
2021-08-19 02:41 AM
dynamicGraph1.addGraphElement(dynamicGraph1Line1);
dynamicGraph1.addGraphElement(dynamicGraph1Line2);
MainView: : handleTickEvent ()
{
dynamicGraph1.addDataPoint( Value1 );
}
In this way, the actual display is 2 identical lines, and it looks like one.
I wonder how to add data to different lines using graph.addDatapoint ():face_with_tears_of_joy:
2021-08-19 02:47 AM
dynamicGraph1 in your code is a line. You need another line object with different data:
MainView: : handleTickEvent ()
{
dynamicGraph1.addDataPoint( Value1 );
dynamicGraph2.addDataPoint( Value1+10 );
}
This way you will have two parallel lines with 10 points distance
2021-08-19 02:56 AM
OK, it's OK for a graph to contain a line. But WHAT I'm curious about is how do you make it possible to have multiple lines in a graph?
Another question, how to adjust the red area of line, hoping to leave some space between the old data and the new data
2021-08-19 03:05 AM
Your picture is a SINGLE graph line. This is a method of drawing large amount of data points when new data is overwrites old one in a circular buffer.
Take a note of X axis labels: 1270-1300 is an old data being replaced by new one (1300-1360)
2021-08-19 03:14 AM
Yes, how do I make Xnew = (Xold+100), keep the gap equal to 100
2021-08-19 07:16 AM
Can you draw what exactly you need on a sheet of paper?