1.3k views
in GUI Development by
Hello. I'm trying to make something like "Climatic Cabinet" demo using Graph. And i can't figure out how to add more then 1 line. Thanks.

1 Answer

+1 vote
by
 
Best answer

Hello,

if you are talking about something like the "Climatic Cabinet" demo, then it might be better to work with the class Charts::LineChart instead of the class Charts::Graph.

A good starting point for working with the class Charts::LineChart is the example "ChartsDemo". If you prefer working with the class Charts::Graph, then have a look into the example "WaveformGenerator".

If your question "how to add more then 1 line" means, how to show several graphs within one diagramm, then you can place several Graph objects over each other - everyone is displaying one curve. In this case, the background color and the grid lines of all overlapping charts should be set to transparent.

I hope this answers your question.

The following example (taken from the "Vehicle Data Logger" demo application) shows this idea:

 

by

Hello Sazna,

here is modified example PulseOximeterDemoWithDots2 which is now updating the graph as soon as new data is incoming. It is done by using the DataObserver that is registered as soon as the DataStorage is assigned.

Each time a new data value is added to the data storage, the graph will be invalidated and updated.

But anyhow, this implementation shows the challenges of a "live graph" - you have to handle many different use cases, e.g. what happens on the left border when new data comes in, what happens on the right border, what happens while the user scrolls the content, ... But this is beyond this example.

I hope this helps.

Best regards,
Manfred.

by
Hi Manfred,

I have checked the live update by using following code

// Get the context information associated to the event
var Application::Measurements context =
  (Application::Measurements )MeasureDataSystemEventHandler.Context;

  trace context.pHValue;
  Application::Device.pHStorage.AddData( context.pHValue );
 Graph1.DataStorage = Application::Device.pHStorage;

It's worked, but your implementation looks like an effective way. I will follow that one. Thank you for your help.

Regards,

Sazna.
by
Hi Manfred,

For the graph I have implemented Zoom option by using two simple touch handlers. When I simulate it is working fine. But when I flash it to the board which is NXP i.MX 1170 - PXP, it doesn't work. Could you please explain me why it's didn't work?

Regards,

Sazna.
by
Please let us try to avoid endless discussion threads with no relation to the origin topic.

For new topics please open a new question with a new description. Otherwise it is completely worthless for others.

Thanks,
Manfred.
by
Ok Sure.

Regards,

Sazna.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...