cancel
Showing results for 
Search instead for 
Did you mean: 

how to setRange touchGFX Graph Y Axis ?

ikassma
Senior

I am using TouchGFX with STM32F767BI and 800x480 LCD.

I made a graph with reference to Graph during TouchGFX Demo.

My problem is that I can't set the Y axis.

How can I set it up?

The data I want to display is from 0 to 120000.

void Graph::setup(int newWidth, int newHeight, int bufSize, colortype lineColor, colortype backgroundColor)
{
    setWidth(newWidth);
    setHeight(newHeight);
 
    graphLinePainter.setColor(lineColor);
    graphAreaPainter.setColor(lineColor, getHeight());
    graphDotsPainter.setColor(lineColor);
    graphDotsBackgroundPainter.setColor(backgroundColor);
 
    graphLine.setLinkedGraph(graphArea);
    graphLine.setLinkedGraph(graphDots);
    graphLine.setLinkedGraph(graphDotsBackground);
 
    graphLine.setPosition(0, 0, getWidth(), getHeight());
    graphLine.setPainter(graphLinePainter);
    graphLine.setBuffer(graphBuffer, bufSize);
    graphLine.setLineWidth(1);
    graphLine.setRange(0, 290, 6500,0);
 
    graphArea.setPainter(graphAreaPainter);
    graphArea.setLineWidth(0);
 
    graphDots.setPainter(graphDotsPainter);
    graphDots.setLineWidth(7);
    graphDots.setDotShape(0, 90);
 
    graphDotsBackground.setPainter(graphDotsBackgroundPainter);
    graphDotsBackground.setLineWidth(9);
    graphDots.setDotShape(0, 30);
 
    add(graphArea);
    add(graphLine);
    add(graphDotsBackground);
    add(graphDots);
}

This is almost the same Graph configuration as the example. I don't know how to change something.

7 REPLIES 7
Martin KJELDSEN
Chief III

Hi,

You specify the "range" of your values in the graphline.setRange() function.

/Martin

but it is not working.

Tell me what you mean by "not working" - The height of the graph will be the same, but the amount of values you can provide, the range, will be 0 to 120000.

/Martin

It is a problem when the following data is output from Demo Code.

int32_t slope_test[290] =
{
	63,73,83,83,93,93,103,113,113,123,133,143,
	153,173,183,193,213,233,243,263,283,313,333,363,
	383,413,433,463,493,523,553,593,623,663,693,733,
	783,833,883,933,993,1043,1103,1163,1223,1283,1343,1413,
	1493,1573,1643,1723,1803,1883,1973,2053,2143,2233,2333,2433,
	2533,2633,2743,2853,2963,3073,3193,3313,3433,3563,3693,3823,
	3953,4083,4223,4363,4503,4643,4793,4943,5093,5243,5403,5553,
	5723,5883,6043,6213,6383,6553,6723,6903,7083,7253,7433,7613,
	7793,7973,8153,8343,8523,8703,8893,9073,9263,9453,9643,9823,
	10013,10203,10393,10583,10773,10963,11153,11343,11523,11713,11893,12083,
	12263,12443,12623,12803,12983,13153,13333,13503,13673,13843,14013,14183,
	14353,14513,14673,14833,14993,15153,15303,15453,15603,15743,15883,16023,
	16163,16303,16433,16563,16683,16813,16933,17053,17163,17283,17393,17503,
	17613,17713,17813,17913,18013,18103,18193,18283,18363,18443,18523,18593,
	18653,18723,18793,18853,18913,18973,19033,19093,19143,19203,19253,19303,
	19343,19383,19423,19463,19503,19533,19573,19603,19633,19663,19693,19713,
	19733,19753,19763,19783,19793,19813,19823,19833,19843,19843,19853,19853,
	19863,19863,19863,19863,19863,19853,19853,19843,19833,19813,19803,19783,
	19763,19743,19713,19693,19663,19633,19603,19573,19543,19503,19473,19433,
	19393,19343,19293,19243,19193,19143,19083,19033,18973,18903,18843,18773,
	18693,18623,18543,18463,18373,18293,18213,18123,18033,17943,17843,17753,
	17653,17543,17443,17333,17223,17103,16983,16863,16743,16613,16483,16353,
	16223,16083,15943,15803,15653,15513,15363,15213,15053,14903,14743,14583,
	14423,14263,14093,13923,13753,13583,13403,13233,13053,12873,12693,12503,
	12323,12133
};

graphLine.setRange(-2, 216,120000,0);

The graph is printed but not normal.

like this.

0690X00000Arff1QAB.png

Was it working with other ranges?

/Martin

hm....i tested max range 2000 it was good.