cancel
Showing results for 
Search instead for 
Did you mean: 

plotting multiple line series on one graph?

jhanc.11
Senior

I generated a touchgfx project and figured out the structures. I am able to change the chart and plot new data. What I don't understand is the generator it allows me to create multiple lines but I can't figure out a way two separate the data or add data for each line. It looks like in order to have multiple series on one chart I have to overlay separate charts on top of each other? If not, how do I add Data for each individual line? For instance, I created a dynamic chart. I added four lines and then asked her to generate dummy data. The chart is 800 points wide and it generated 800 points of dummy data even though I would've thought it would generate 3,200 pts. I then looked at the resulting code and I can't see any way to add Data to each line. I read some of the other posts it looks like I have to have a separate graph object. I assume I overlay those on top of each other?

Thanks, this coupled with freertos has opened up some new capabilities for our app.

4 REPLIES 4
ktrofimo
Senior III

Every line is a separate graph class member. ​I guess you are adding new points with a graph.add(value);

Check designer for a names of another lines (graph2, graph3,...?) and add values to them too, like:

graph.add(value); 
graph2.add(value);
graph3.add(value);

    dynamicGraph1Line3Painter.setColor(touchgfx::Color::getColorFromRGB(20, 151, 197));
    dynamicGraph1Line3.setPainter(dynamicGraph1Line3Painter);
    dynamicGraph1Line3.setLineWidth(2);
    dynamicGraph1.addGraphElement(dynamicGraph1Line3);
 
    dynamicGraph1Line2Painter.setColor(touchgfx::Color::getColorFromRGB(0, 0, 255));
    dynamicGraph1Line2.setPainter(dynamicGraph1Line2Painter);
    dynamicGraph1Line2.setLineWidth(2);
    dynamicGraph1.addGraphElement(dynamicGraph1Line2);

You can see in the code above the multiple lines tied to the same dynamicGraph1. I looked at every call and the only call that allows you to add data, is the:

  dynamicGraph1.addDataPoint(300.46353f);

and that you can see is to the graph, not the line. I saw other posts since asking this question that lead me to believe that you need to overlay the graphs but that can cause all kinds of issue with a frontline, or maybe opportunities, don't know. But why have multiple lines? What do you do with them? Now that I wrote that I remember someone asking about interrupted line plots but how would that solve that issue?

I'd just like this cleared up so I can move on with the GUI development. If I need to overlay them, then fine. I just don't want to waste code. One of the bin files was over 2GB and that had to be an error.

Thanks

ktrofimo
Senior III

1) Large .bin files is a result of an error in yor linker sript file: add NOLOAD attribute for RAM sections

2) dynamicGraph1.addDataPoint(300.46353f); - that is what I talking about. See class definition - you should have another members of the same type, but named dynamicGraph2 and so on. Add data to all of them simultaneously.

You can't create a single binary for code/data regions that span vastly different portions of the address map.

ie 0x08000000 vs 0x90000000, you have to break them into TWO, either the tool is smart enough to do this, or you have to do the .BIN conversion in two passes, selecting a singular region in each pass.

.HEX is better to describe sparse memory

.ELF is an OBJECT file which is already compartmentalized.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..