Giter Site home page Giter Site logo

Comments (5)

milosevicn avatar milosevicn commented on August 17, 2024 1

I've found a solution that works for me. Before exporting, I adjust the body zoom based on the current browser zoom level:

document.body.style.zoom = (1 / window.devicePixelRatio);

Then, I recreate the chart. This ensures that the exported chart maintains its appearance, regardless of the browser zoom level.

from amcharts4.

martynasma avatar martynasma commented on August 17, 2024

You can set minimum dimensions of the exported file:
https://www.amcharts.com/docs/v4/concepts/exporting/#Dimension_constraints

Hopefully, that helps.

from amcharts4.

milosevicn avatar milosevicn commented on August 17, 2024

Thank you for your response. While setting minimum dimensions for the exported file does help in controlling the overall size, it doesn't address the core issue I'm facing. The problem persists in maintaining the chart's appearance as it would be at 100% browser zoom, regardless of the user's actual browser zoom setting.

To provide further context, the challenge arises particularly with pie charts, where percentage labels become disproportionately large with higher browser zoom levels, leading to overlapping with the chart itself. Therefore, while controlling dimensions is helpful, it doesn't resolve the issue of maintaining the chart's visual integrity across different browser zoom levels.

Here is how my pie chart looks on 100%:
Screenshot_2

And how it looks on 250% zoom:
Screenshot_1

Unfortunately, I can't provide code for this particular chart, that's why I am trying to find solution on the example from documentation first. Later I'll be able to implement same solution in my application also.

Basically I am interested if it's possible to prevent browser zoom having any effect on chart itself, because that will automatically be a solution for exporting also.

from amcharts4.

martynasma avatar martynasma commented on August 17, 2024

In that case you may try scaling export image:
https://www.amcharts.com/docs/v4/concepts/exporting/#Scaling_images

from amcharts4.

milosevicn avatar milosevicn commented on August 17, 2024

Scaling the export image also doesn't resolve the core issue.
While it adjusts the size of the exported image, it doesn't ensure consistency with the desired appearance. I will just get the bad looking chart in a smaller dimensions.

It would be the best if it's possible to force the chart to be recreated before exporting and to be recreated as when it's 100% browser zoom, no matter how zoomed the webpage currently is.

from amcharts4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.