Jump to content

Graph axis size

Recommended Posts


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?

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites
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

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


Edited by ForTest

Share this post

Link to post
Share on other sites


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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...