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

Scaling and Resizing SVG to Fit 16:9 #92

Open
Vacant0mens opened this issue Oct 9, 2023 · 0 comments
Open

Scaling and Resizing SVG to Fit 16:9 #92

Vacant0mens opened this issue Oct 9, 2023 · 0 comments

Comments

@Vacant0mens
Copy link

Vacant0mens commented Oct 9, 2023

I can't seem to find a way to scale the resulting svg file so that it could fit into a 16:9 ratio (for many monitors, full screen)

I was able to scale up the image by reassigning the zoom property of the KerykeionChartSVG class after it's initialized, like this:

my_svg = KerykeionChartSVG(first_obj=me, chart_type=chart_type, new_settings_file=my_settings_file)
my_svg.zoom = (window_width - 100) / my_svg.natal_width
my_svg.makeSVG()

And that scales up the image, but it starts losing the edges outside of the window/screen if the aspect ratio doesn't match.

I've also tried changing the basic_chart_viewBox and wide_chart_viewBox settings in my json settings file, but that just resizes the box that the svg is placed into, and makes the main chart into an oval rather than keeping it a circle.

I've used cairosvg's svg2svg function, but that doesn't seem to change anything. Even svg2png results in the same size image, or at least an image with the same aspect ratio.

I noticed that in the template, the value for svg/g/g/g/rect.height is hard coded to 546.0, but the width is part of the template transforms.

I thought one of the main advantages of SVG's was that you can scale it or resize it any direction without losing any of the graphics but having a hard-coded value for height seems to be the core of this issue.

Is there a way to tell the KerykeionChartSCG class to resize the SVG so that it fits an aspect ratio besides 4:3?

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

1 participant