I have a chart as per below:
<SfChart Width="100%" >
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@ChartItems" XName="Area" YName="Uar" Type="ChartSeriesType.Column">
</ChartSeries>
</ChartSeriesCollection>
</SfChart>
@ChartItems is a list of SchemeGraphItem:
public class SchemeGraphItem
{
public decimal? Uar { get; set; }
public float? Area { get; set; }
public string? Uarn { get; set; }
}
This list can have many items with either the same or different Uar and/or Area - eg:
{ Uar = 100, Area = 50, Uarn = 12345 },
{ Uar = 110, Area = 50, Uarn = 12346 },
{ Uar = 150, Area = 45, Uarn = 12347 },
{ Uar = 150, Area = 40, Uarn = 12348 },
{ Uar = 150, Area = 40, Uarn = 12349 },
{ Uar = 150, Area = 40, Uarn = 12340 }
I would want to see a column for each item. Currently, these are getting collated and there is not a column for each record.
Please could you advise?
Thanks, Gar
Hi Gary,
We have analyzed your query. We suggest setting IsIndexed to true in the ChartPrimaryXAxis property to split the column chart points. We have attached a sample and screenshot for your reference. Please check with the below code snippet.
<SfChart Width="100%">
<ChartPrimaryXAxis IsIndexed="true" ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@ChartItems" XName="Area" YName="Uar" Type="ChartSeriesType.Column">
</ChartSeries>
</ChartSeriesCollection>
</SfChart> |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SplitColumnChart1538004592.zip
Screenshot:
UG: https://blazor.syncfusion.com/documentation/chart/category-axis#indexed-category-axis
Kindly revert us if you have any other concerns.
Regards,
Gopalakrishnan Veeraraghavan
Thanks, that worked perfectly.
Is it possible to always have the Y Axis start at 0?
Hi Gary,
To start the Y-axis values from zero, we suggest setting StartFromZero to true in the ChartPrimaryYAxis property. Alternatively, you can set the Minimum property to zero in the ChartPrimaryYAxis property. We have attached a sample and screenshot for your reference. Please check with the below code snippet.
<SfChart Width="100%">
<ChartPrimaryYAxis StartFromZero="true"></ChartPrimaryYAxis>
</SfChart> |
<SfChart Width="100%">
<ChartPrimaryYAxis Minimum="0"></ChartPrimaryYAxis>
</SfChart> |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SplitColumnChart_2-718596979.zip
Screenshot:
UG: https://blazor.syncfusion.com/documentation/chart/numeric-axis#range-and-interval
Kindly revert us if you have any other concerns.
Regards,
Gopalakrishnan Veeraraghavan