Barchart scaling not aligned
See original GitHub issueThe bar chart seems not to scale correct with multiple data series.
Using Latest Chartjs master and Blazor on server-side app.
BarDataset<double> _barDataSet3 = new BarDataset<double>
{
Label = "A",
BackgroundColor = ColorUtil.RandomColorString(),
BorderWidth = 0,
HoverBackgroundColor = ColorUtil.RandomColorString(),
HoverBorderColor = ColorUtil.RandomColorString(),
HoverBorderWidth = 1,
BorderColor = "#ffffff"
};
_barChartConfig.Data.Labels.AddRange(new[] { "A"});
_barDataSet3.Add(2.6);
_barChartConfig.Data.Datasets.Add(_barDataSet3);
BarDataset<double> _barDataSet4 = new BarDataset<double>
{
Label = "B",
BackgroundColor = ColorUtil.RandomColorString(),
BorderWidth = 0,
HoverBackgroundColor = ColorUtil.RandomColorString(),
HoverBorderColor = ColorUtil.RandomColorString(),
HoverBorderWidth = 1,
BorderColor = "#ffffff"
};
_barChartConfig.Data.Labels.AddRange(new[] { "B" });
_barDataSet4.Add(4.5);
_barChartConfig.Data.Datasets.Add(_barDataSet4);
Config code:
_barChartConfig = new BarConfig
{
Options = new BarOptions
{
Title = new OptionsTitle
{
Display = true,
Text = "Simple Bar Chart"
},
Scales = new BarScales
{
XAxes = new List<CartesianAxis>
{
new BarCategoryAxis
{
BarPercentage = 0.5,
BarThickness = BarThickness.Flex
}
},
YAxes = new List<CartesianAxis>
{
new BarLinearCartesianAxis
{
Ticks = new LinearCartesianTicks
{
BeginAtZero = true
}
}
}
}
}
};
Link to illustrate the issue: https://i.stack.imgur.com/7O8Cu.png
Hope it is enough information.
SO Link: https://stackoverflow.com/questions/62204374/chartsjs-blazor-barchart-not-alinged
/Thomas
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Stacked bar chart results in misaligned bars
I'm using Chart.js with angular charts. I have the stacked property set accordingly with: stacked: true , yet the bars do not align...
Read more >Recharts, Barchart not aligning bars correctly : r/reactjs
I'm completely new to recharts and liking it so far but I have a weird issue where my bars are not aligned right...
Read more >FCC: D3 Bar Chart X-Axis not aligned with data - JavaScript
The problem is your x-axis is a linear scale (plain numbers) when the data is time (years, quarters). The tests for the bar...
Read more >Bar chart vertical alignment and scaling
I'm having problems with the vertical alignment of my bar chart. I started using a single xbar chart for my data, but it...
Read more >How to fix width of row header in Bar Chart
Hey all,. I'm facing an issue with row headers in the bar charts in my dashboard. I created a dashboard showing 3 bar...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for the feedback, i will try on SO. I created this: https://codepen.io/tsgrau/pen/QWyNQwN
Closing this due to inactivity. Please respond if this issue should be reopened.