cancel
Showing results for 
Search instead for 
Did you mean: 

drawing a filled graph, with multiple colours

MUzhu
Associate II

I need to display a filled graph, where some portions of the graph needs to be displayed in different colour than the basic colour of the graph.

The graph is displayed using a canvas widget, created in touchgfx 4.10.0.

In the drawCanvasWidget function, the graph is drawn using lineTo commands. (The filled effect is created by drawing a series of vertical lines adjacent to each other). The problem is that colour of the line can not be changed in the drawCanvasWidget function as the function is const.

So, how can the part of graph be drawn in multiple colours?

A sample of the graph is in the file attached.

Regards

Mathews

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi,

You may be able to get some inspiration from the demo "TouchGFX Demo 1", application from the designer. It has some advanced graph usage where it can fill part of the graph below the line "GraphBelow.cpp". Check it out and see if it, or a part of it, fits.

/Martin

View solution in original post

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi,

You may be able to get some inspiration from the demo "TouchGFX Demo 1", application from the designer. It has some advanced graph usage where it can fill part of the graph below the line "GraphBelow.cpp". Check it out and see if it, or a part of it, fits.

/Martin

MUzhu
Associate II

Hi Martin,

Thanks for the inputs. I am going through the TouchGFX_Demo_Graph example, and it looks like, I can solve the problem by taking input from the demo.

Regards

Mathews

Martin KJELDSEN
Chief III

That's great, Mathews!

MUzhu
Associate II

Hi Martin,

I was able to implement the multi-coloured graph, by creating two graph objects, each taking care of one colour each. The idea is basically derived from the Demo_Graph example. Thanks a lot for your reference application.

Regards

Mathews

Martin KJELDSEN
Chief III

That's great to hear, Mathews. Good job!

Best regards,

Martin