TouchGFX Graph widget inside custom container
Hi ,
I'm using 4.10 library version , I've downloaded the Graph widget from https://github.com/touchgfx/touchgfx-open-repository/tree/master/widgets/Graph .
Updated Graph::Setup function as recommended in repository .
I've created custom container named baseContainer which contains some common, to whole application ,values .So I'm also wanted to add Graph representation from ADC readings (ADC readings works , because I've added another field to container which displays the ADC readings once per second)
I've placed the Graph widget source code to "\gui\src\common" and headers to "gui\include\gui\common" ,I'v added instance of Graph to my container and initialized as follows :
void baseContainer::initialize()
{
baseContainerBase::initialize();
graph.setXY(46,201);
graph.setup(220,250,Color::getColorFrom24BitRGB(111, 156, 233));
graph.setRange(0, 220, 0, 250);
graph.setLineWidth(5);
graph_insert_index = 0;
graph_insert_period = graph.getRangeRight() / 22 ; // debugging
add(graph);
}The aim is to display the graph in bottom left corner on 800x480 screen .
The background color of the screen is RGB(16, 20, 40) ;
The update of the graph is as follows :
void baseContainer::periodicRefresh(CONT_DATA_STRUCT adc_data)
{
Unicode::snprintf(txtCurrPressBuffer, TXTCURRPRESS_SIZE, "%d", adc_data.internal_pressure);
// Unicode::snprintf(txtCurrPressBuffer, TXTCURRPRESS_SIZE, "%d", 0);
txtCurrPress.invalidate();
boxBatProg.setValue(adc_data.bettery_percentage);
boxBatProg.invalidate();
if((graph_insert_index % graph_insert_period) == 0)
{
graph.addValue(graph_insert_index,adc_data.bettery_percentage);
}
graph_insert_index = ((graph_insert_index + 1) % graph.getRangeRight());
graph.invalidate();
}the other values : boxBatProg and txtCurrentPressure updated good . The debugger showed that periodicRefresh function is reached .
The problem is that graph is not showed at all :no dots ,no lines ,nothing . Just background.
The Graph::NUMBER_OF_POINTS is set to 25 . Also , my IAR compiler , complained about line 325 of AbstractGraph.cpp file (void AbstractGraph::invalidateLineFromIndex(int index)) ,that numPointsUsed variable is undefined ,so I've fixed it to numPoints .
Best Regards ,
