Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a method to fit the width of a graph to the viewer's Width #353

Open
wvdvegt opened this issue Jul 21, 2023 · 5 comments
Open

Is there a method to fit the width of a graph to the viewer's Width #353

wvdvegt opened this issue Jul 21, 2023 · 5 comments

Comments

@wvdvegt
Copy link

wvdvegt commented Jul 21, 2023

Is there a method to fit the width of a graph to the viewer's Width and leave the aspect ratio as is (so a Fit to Width option). I need it for readability purposes.

Now, by default, the graph seems to be made completely visible while maintaining the aspect ratio. Now I have to zoom in/out everytime i load/create a graph.

@levnach
Copy link
Contributor

levnach commented Jul 22, 2023

What viewer do you use?

@wvdvegt
Copy link
Author

wvdvegt commented Jul 22, 2023

Using informs so I think it's the gdi one.

@levnach
Copy link
Contributor

levnach commented Jul 22, 2023

There is proprety GViewer.ZoomF that can set the scale. Also have a look at GViewer.ShowGroup(), and GViewer.ShowBBox(). The latter can zoom in on anything on the graph.

@wvdvegt
Copy link
Author

wvdvegt commented Jul 24, 2023

ZoomF I already found, but what i want is to fit the with of the bounding box to be the width of the viewer (so only the width and derive the height from the graph width & aspect ratio).

Currently the code fits the whole graph to the viewer which in my case results in a narrow stripe containing the graph in the middle of the viewer.

This is what i get:
image

And this is how i would like it (preferable with a vertical scrollbar):
image

@levnach
Copy link
Contributor

levnach commented Jul 24, 2023

Have you looked at

public void ShowBBox(Core.Geometry.Rectangle bb) {
? I think this method will work for you. You need to call it with bb having the width and the top-left taken from the geometry graph bounding box. The height you need to calculate from the aspect ratio of the client rectangle.
I do not remember why there is no scrollbar. Probably it can be enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants