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

Handling responsive design: updating JSON config after initiation #1751

Open
flaming-cl opened this issue Oct 7, 2024 · 3 comments
Open
Labels

Comments

@flaming-cl
Copy link

flaming-cl commented Oct 7, 2024

We are handling desktop and mobile design for pie charts with V5 JSON config.

If possible, would you please let us know how to update the settings (layout) and the position of the piechart/legend, after initiated the chart?

horizontal
vertical

CodePen (initiated with horizontal. Exploring a solution to change the chart to vertical and adjust the chart/legend position, when the window is resized to mobile size)
https://codepen.io/flaming-cl/pen/dyxXRQX

@martynasma
Copy link
Collaborator

You may use a Responsive` theme:
https://www.amcharts.com/docs/v5/concepts/responsive/

@flaming-cl
Copy link
Author

flaming-cl commented Nov 3, 2024

https://www.amcharts.com/docs/v5/concepts/responsive/

Thanks @martynasma,

We are using itemContainer to customize our own legend.
Do you know how I can get the itemContainer instance and set their x/y and update the width/height of the pieSeries?

responsive.addRule({
  relevant: am5themes_Responsive.widthM,
  applying: function() {
    chart.set("layout", root.verticalLayout);
   //  how to set legend item container
  },
});

Screenshot 2024-11-03 at 4 48 23 PM

codePen: https://codepen.io/flaming-cl/pen/dyxXRQX?editors=1010

@martynasma
Copy link
Collaborator

responsive.addRule({
  name: "Container",
  tags: ["legend", "item", "itemcontainer"],
  relevant: am5themes_Responsive.widthM,
  settings: {
    // ...
  }
});

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

No branches or pull requests

2 participants