Jump to content

Graph grid and axes not drawn when not cleared previously


Recommended Posts

Posted

I just compiled the graph demo for playing with it and noticed that the plots are drawn correctly, but the grids and axes are invisible. This can be fixed by calling gwinClear(gh) before doing any further init, but that's not documented and it's also missing in the demo code. So the correct init code should be

	gwinClear(gh); // <------ add this, line 80
gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2);
gwinGraphSetStyle(gh, &GraphStyle1);
gwinGraphDrawAxis(gh);

instead of

	gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2);
gwinGraphSetStyle(gh, &GraphStyle1);
gwinGraphDrawAxis(gh);

Edit: The documentation says "The graph is not automatically cleared. You must do that first by calling gwinClear()." but to me that doesn't indicate that the axes and grid won't be drawn when the graph is not cleared.

Posted

Not sure why the axis and grid are not being displayed without the clear first - they used to. This is a very old demo however and has not been checked in a long time so I will debug to see what is happening when I get a moment.

Theoretically as the screen is already clear it shouldn't be necessary to clear it again. I suspect some of the widget flags are no longer being initialised correctly.

Glad you found a work around in the mean time.

  • 9 months later...
Posted

Not to bring a thread from the dead but this solved my problem of the graph not showing. I was just testing the axis without plotting and for a split second I could see them. I put the graph in an container but didn't help till I did the clear first.

Posted

This has now been fixed in the repository.

The problem was that the window manager was delaying the initial clear (from when the graph widget was set visible) and when this clear happened it was overwriting the axis.

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...