Filled line graph with emwin - no create handle function for vertical line or filled polygon

  • Hi,

    I'm struggling with how to plot a filled line graph using emWin widget.
    I know that there is no ready to use widget for a filled graph and that this topic has been already asked in the past in this forum, here:
    How do plot a filled line graph using emWin widget?

    But I really don't understand how I can achieve the result with the suggestion provided.

    If I have the following to create a YT Graph:

    hData = GRAPH_DATA_YT_Create( ... );
    GRAPH_AttachData(hGraph, hData);
    GRAPH_DATA_YT_AddValue(hData, ....);

    I would like to do the same with something that for each new value, build a vertical line,
    but there is no "create" function that allows me to obtaon a handle doing something like this:

    hLine = GRAPH_LINE_Create ();

    Alternatively, I would like to make a filled polygon adding each new value,
    but still there is no "create" polygon handle like:

    hPolygon = GRAPH_POLYGON_Create ();

    Please can you help me?
    Many thanks in advance.
    Best,

    Giovanni

  • Hi,

    I guess you have already a solution, but I'll post it just in case other people have a similar problem.

    Here is the code showing how to hook into the drawing process of the GRAPH widget and fill the area under the GRAPH. You might want to improve it by searching the largest rectangular area under the GRAPH and fill it with GUI_FillRect() instead of line by line.

    You can use the switch USE_PUNCH_OUT_DEVICE fill the the area with a gradient.

    Best regards,
    Sven

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!