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

Layout Configuration #156

Closed
ipax77 opened this issue Oct 17, 2020 · 2 comments · Fixed by #213
Closed

Layout Configuration #156

ipax77 opened this issue Oct 17, 2020 · 2 comments · Fixed by #213
Labels
enhancement New feature or request

Comments

@ipax77
Copy link
Contributor

ipax77 commented Oct 17, 2020

Adding Layout Configuration to BaseConfigOptions.

Which charts does this feature request apply to?

all charts

Describe the solution you'd like

                Options = new PieOptions
                {
                    Layout = new Layout() {
                        Padding = new Padding()
                        {
                            top = 50,
                            left = 50,
                            right = 50,
                            bottom = 50
                        }
                    },
                    Responsive = true,
                    ...
                }

JavaScript equivalent

            options: {
                layout: {
                    padding: {
                        left: 50,
                        right: 50,
                        top: 50,
                        bottom: 50
                    }
                },
                responsive: true,
                ...
           }

Describe alternatives you've considered

Setting global chart layout with JavaScript in Chart.defaults.global.layout

Additional context

image

@ipax77 ipax77 added the enhancement New feature or request label Oct 17, 2020
ipax77 added a commit to ipax77/ChartJs.Blazor that referenced this issue Oct 17, 2020
@Joelius300
Copy link
Contributor

Joelius300 commented Oct 17, 2020

Thank you for the issue. We should definitely add that.

I'll take a look at your PR when I get time. Since I'm in the final phase of releasing 2.0, this might be released in 2.1 or so.

For now the workaround should be fine but if you want a C#-only solution, you can subclass your PieOptions and add a property named Layout. You can make it of type object and then assign an annonymous object or go the typed way (which results in more code obviously). Both will be serialized and should yield the correct result (untested).

@akirayamamoto
Copy link
Collaborator

I will create a PR to cherry-pick this commit. What do you think? cc @mariusmuntean

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

Successfully merging a pull request may close this issue.

3 participants