cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically draw and move an axis and these labels

MFred.2
Associate III

What is the best method to dynamically draw an axis with these graduations with label. For example, I want to display a range of 4 graduations out of 100 and be able to move the axis according to a value from my application.

0690X00000DXSRXQA5.png

2 REPLIES 2
Martin KJELDSEN
Chief III

Not 100% sure what you're trying to do, but couldn't you simply use different images? That'd put the price on flash memory.

If you're trying to do something that changes dynamically The easy way is to use Box. e.g.

box.setPosition(0,0,1,20); // x=0, y=0, width=1, height=20

The more elegant approach is to override the ::draw() method in a custom widget (AxisWidget?) and simply write directly into the framebuffer - This would save some memory from not allocating Boxes. Not hard for something this simple.

But, it depends on what you're trying to do. Not quite sure what "move the axis according to a value" means - statically? dynamically? etc.

/Martin

MFred.2
Associate III

the objective is to graphically represent the position of a motorized carriage moving on a linear guide. so the position is dynamic. A fixed mark indicates the position relative to the moving axis (lines and label).

0690X00000DXSddQAH.png