Jump to content

Recommended Posts

Posted

Hi

It's not clear for me if it's possible to change dynamically the size of the graph axis.

The function gwinGraphDrawAxis seems to do that but i do not understand how should work

Can anyone provide an example?

Posted

The line size is part of the GGraphLineStyle_t struct that in turn is part of the GGraphStyle_t struct. You can change the line size in your style struct, re-apply the modified style using gwinGraphSetStyle() and then issue a redraw using gwinGraphDrawAxis(). Note that by design the axes will now be in the foreground. This means that if your plotted data covered part of the axes the axes will now be covering that part of the data. Therefore, depending on what you are doing you might want to issue a complete redraw of the graph using gwinRedraw().

Furthermore, it might be worthwhile to note that the built-in graph is usually just enough to get started and make a simple proof-of-concept. For any serious application you'll end up implementing a custom widget.

Posted (edited)
Ok, so this is the default graph style i use
How should i change it for have for example a x/y axis line size of 3 pixel?

// A graph styling
static GGraphStyle GraphStyle1 = {
		    { GGRAPH_POINT_DOT, 	2, 	Red 		},      // Point
		    { GGRAPH_LINE_SOLID,   	1, 	Red 		},      // Line
		    { GGRAPH_LINE_SOLID, 	25,	Black 		},      // X axis
		    { GGRAPH_LINE_SOLID, 	25,	Black 		},      // Y axis
		    { GGRAPH_LINE_DOT,  	5, 	Gray, 	50 	},      // X grid
		    { GGRAPH_LINE_DOT, 		5, 	Gray,   50 	},      // Y grid
		    GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS   		// Flags
};

By this way i get a x/y axis of 1 pixel

 

Edited by ForTest
Posted

Hi,

Sorry, I was giving wrong information. I was sitting in the bus and didn't check the sources which were written a long time ago...
In fact, the current implementation of the graph window doesn't offer changing the line size. You'd have to implement that yourself.

As mentioned above, when working with graphs the proper solution is usually to implement a custom widget.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...