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

Miss alignment in grouped stacked bard #48

Open
BuddhaCodes opened this issue Jul 31, 2023 · 2 comments
Open

Miss alignment in grouped stacked bard #48

BuddhaCodes opened this issue Jul 31, 2023 · 2 comments
Assignees

Comments

@BuddhaCodes
Copy link

Hello there, I want to create a grouped/stacked Chart, similar to this one https://www.chartjs.org/docs/latest/samples/bar/stacked-groups.html when I emulate the configuration, I get the following result.
act

This is the configuration and the dataset I use
`_configBar5 = new BarChartConfig()
{
Options = new Options()
{
Interaction = new ()
{
Intersect = false
},
Plugins = new Plugins()
{
Title = new Title()
{
Display = true,
Text = "Population growth (millions)",
Font = new Font()
{
Size = 18
}
}
},
Scales = new Dictionary<string, Axis>()
{
{
Scales.XAxisId, new Axis()
{
//Stacked = true,
BeginAtZero = true,
}
},
{
Scales.YAxisId, new Axis()
{
Stacked = true,
BeginAtZero = true,
}
}
},
}
};

    _configBar5.Data.Labels.AddRange(Labels);

    List<decimal?> Grouped1 = new List<decimal?>() { 133, 221, 783, 2478 };
    List<decimal?> Grouped2 = new List<decimal?>() { 408, 547, 675, 734 };

    _configBar5.Data.Datasets.Add(new BarDataset()
        {
            Stack = new() {"One"},
            Type = "bar",
            Label = "Africa",
            Data = Grouped1,
            BackgroundColor = new List<string>() { "#3e95cd" }
        });

    _configBar5.Data.Datasets.Add(new BarDataset()
    {
        Stack = new() { "One" },
        Label = "India",
            Type = "bar",
            Data = Grouped2,
        BackgroundColor = new List<string>() { "#8e5eff" }
    });

    _configBar5.Data.Datasets.Add(new BarDataset()
        {
            Stack = new() { "Two" },
            Label = "Europe",
            Type = "bar",
            Data = Grouped1,
            BackgroundColor = new List<string>() { "#8e5ea2" }
        });`
@erossini
Copy link
Owner

erossini commented Aug 1, 2023

I have an example of StackedBar on the demo website. Let me try to recreate this one.

@BuddhaCodes
Copy link
Author

Ok, the demo at the website work perfectly, is the combination of stacked and grouped the one giving me that behaviour

@erossini erossini self-assigned this Sep 29, 2023
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