Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

MudBlazor Barchart styling

$
0
0

I am trying to use the Bar Charts in MudBlazor and have a styling issue.
There are 2 datapoint collections on the X-Axis "Cats" and "Dogs", which when displayed are at opposite ends of the X-Axis, I would like these to be either centered or left aligned on the chart.
I can not see anything in the documentation to address this.Is this possible as the current layout looks wierd?

<MudChart ChartType="ChartType.Bar" ChartSeries="@Series"           XAxisLabels="@XAxisLabels"           Width="100%" Height="350px" > </MudChart>@code {    public List<ChartSeries> Series = new List<ChartSeries>()    {        new ChartSeries() { Name = "Canada", Data = new double[] { 40, 20 } },        new ChartSeries() { Name = "Germany", Data = new double[] { 19, 24} },        new ChartSeries() { Name = "Sweden", Data = new double[] { 8, 6} },    };    public string[] XAxisLabels = { "Cats", "Dogs"};}

Screenshot

https://try.mudblazor.com/snippet/cOGTanlFnrorMOTt

The only way I have found to get the desired layout is to add empty datapoint collections at the start and end of each ChartSeries.
There must be a better way?

 public List<ChartSeries> Series = new List<ChartSeries>()    {        new ChartSeries() { Name = "Canada", Data = new double[] {0, 40, 20,0 } },        new ChartSeries() { Name = "Germany", Data = new double[] {0, 19, 24,0} },        new ChartSeries() { Name = "Sweden", Data = new double[] {0, 8, 6,0} },    };    public string[] XAxisLabels = { "","Cats", "Dogs",""};

https://try.mudblazor.com/snippet/cacTkxbPHiQYxDOM


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>