Adjusting Y Axis

Hi!

Is there a way to adjust the Y axis where when removing decimal places for small values it does not dupliacate the values.  I'm using "     <ChartPrimaryYAxis LabelFormat="n0" />" to remove the decimal places. I do not want to use interval because for larger values it creates to many entries for the Y axis.


<SfChart @ref="ProgressChart" Height="500px" Title="In Progress Work Orders" Width="100%">

    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />

    <ChartPrimaryYAxis LabelFormat="n0" />

    <ChartEvents OnPointRender="PointRender"></ChartEvents>

    <ChartTooltipSettings Enable="true"></ChartTooltipSettings>

    <ChartSeriesCollection>

        <ChartSeries DataSource="@BacklogChartData" XName="XValue" YName="YValue" Type="ChartSeriesType.Column" Fill="">

        </ChartSeries>

    </ChartSeriesCollection>

</SfChart>


Image_1484_1714129089997


1 Reply 1 reply marked as answer

GV Gopalakrishnan Veeraraghavan Syncfusion Team April 29, 2024 12:58 PM UTC

Hi Francisco,


We have analyzed your query and recommend removing the duplicate axis label when removing decimal places. This can be achieved by using the OnAxisLabelRender event in the chart sample. Please find the sample and screenshot for your reference. Kindly review the following code snippet.

public void AxisLabelEvent(AxisLabelRenderEventArgs args)

{

     if (args.Axis.Name == "PrimaryYAxis" && args.Text == AxisLabel)

     {

         args.Text = "";

     }

     else

     {

         AxisLabel = args.Text;

     }

}


Sample: https://blazorplayground.syncfusion.com/rjhJjJhkzyGBnKlW


Screenshot:

A screenshot of a computer

Description automatically generated


Documentation for OnAxisLabelRender event: https://blazor.syncfusion.com/documentation/chart/events#onaxislabelrender

Regards,

Gopalakrishnan


Marked as answer
Loader.
Up arrow icon