Greetings,
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.
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?
Cheers,
Joe Gorse
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
- void MainTask(void) {
- U32 NumDataItems = 500;
- U32 MaxNumDataItems = 2000;
- U32 ChartCounter = 0;
- GRAPH_DATA_Handle hData;
- GRAPH_SCALE_Handle hScale;
- WM_HWIN hGraph;
- hGraph = GRAPH_CreateEx(10, 10, 216, 106, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_GRAPH0);
- hData = GRAPH_DATA_YT_Create(GUI_DARKGREEN, NumDataItems, stripchartdata, MaxNumDataItems);
- GRAPH_AttachData(hGraph, hData);
- hScale = GRAPH_SCALE_Create(28, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 20);
- GRAPH_AttachScale(hGraph, hScale);
- /* Do something with the widget... */
- while (1) {
- GUI_Delay(20);
- GRAPH_DATA_YT_AddValue(hData, stripchartdata[ChartCounter]);
- ChartCounter = (ChartCounter + 1) % MaxNumDataItems;
- GUI_Exec();
- }
- WM_DeleteWindow(hGraph);
- }
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?
Cheers,
Joe Gorse