A minimal WIDGET_GraphYT.c compatible with GUI Builder

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • A minimal WIDGET_GraphYT.c compatible with GUI Builder


    I am having some difficulty getting any variant of the GRAPH widget to draw to the screen on the Windows VS emulator except for the WIDGET_GraphYT.c demo file. I have tried copying relevant drawing routines and whatever code looked relevant to me to a separate minimal GUI Builder generated file with a Graph widget, but have not had any success getting it to display data.

    From the manual, I created a file around this minimal code below with a static array "stripchartdata" of length 2000 with I16 data between 0 and 100.

    C Source Code

    1. void MainTask(void) {
    2. U32 NumDataItems = 500;
    3. U32 MaxNumDataItems = 2000;
    4. U32 ChartCounter = 0;
    5. GRAPH_DATA_Handle hData;
    6. GRAPH_SCALE_Handle hScale;
    7. WM_HWIN hGraph;
    8. hGraph = GRAPH_CreateEx(10, 10, 216, 106, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_GRAPH0);
    9. hData = GRAPH_DATA_YT_Create(GUI_DARKGREEN, NumDataItems, stripchartdata, MaxNumDataItems);
    10. GRAPH_AttachData(hGraph, hData);
    12. GRAPH_AttachScale(hGraph, hScale);
    13. /* Do something with the widget... */
    14. while (1) {
    15. GUI_Delay(20);
    16. GRAPH_DATA_YT_AddValue(hData, stripchartdata[ChartCounter]);
    17. ChartCounter = (ChartCounter + 1) % MaxNumDataItems;
    18. GUI_Exec();
    19. }
    20. WM_DeleteWindow(hGraph);
    21. }
    Display All

    Nothing draws to the screen.

    I have confirmed that hGraph, hData, and hScale are successfully defined. GRAPH_DATA_YT_AddValue() is getting real data.

    Does it need a special drawing handler/callback function which I am neglecting? What am I missing?

    Joe Gorse
  • Hello Joe,

    Your data should be equal to the data used in the sample. Otherwise you might have to reconfigure the GRAPH widget. The GRAPH widget should be configured according to the desired range of data. For detailed information on how to configure the GRAPH widget, please refer to the chapter "Widgets" in the emWin user manual.

    Best regards,
  • Adrian,

    Do you mean MaxNumDataItems and NumDataItems? I have tried several obvious combinations of values for those two variables, but without success. I have integrated ToneL's code for the Y-axis range into a minimized version of the demo code and it works well. I cannot get a GUI Builder variant to show anything. I have read the GRAPH Widget section front to back about 3 times now and I don't see what I'm missing.

    I suspect some kind of subtle layering issue or some other seemingly innocuous detail escaping my limited perception.

    If you have any suggestions or experience with the GRAPH widget that you'd like to share, or recommendations for how to go about debugging it, that would be most helpful.

  • Hello Joe,

    I did not mean the number of items. I meant the data range. For instance if your data ranges from 0 - 100, the GRAPH widget should not be configured to show data between 200 - 300. Of course in this case no graph will be shown.

    Please understand that due to a missing support contract, I am not able to help you configure the GRAPH widget. Of course detailed information on how to do this can be found in the emWin user manual.

    Best regards,