Skip to main content
MUzhu
Associate
August 9, 2019
Solved

drawing a filled graph, with multiple colours

  • August 9, 2019
  • 5 replies
  • 1814 views

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

This topic has been closed for replies.
Best answer by Martin KJELDSEN

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

5 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
August 13, 2019

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
MUzhuAuthor
Associate
August 15, 2019

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
Principal III
August 15, 2019

That's great, Mathews!

MUzhu
MUzhuAuthor
Associate
August 21, 2019

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
Principal III
August 22, 2019

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

Best regards,

Martin