[Solved] TelerikChart X Axis Major tick issue

1 Answer 12 Views
Charts
Dobo
Top achievements
Rank 1
Dobo asked on 20 Mar 2026, 11:35 AM

I have a Telerik Blazor chart with time-based data updating in real time. The X-axis labels are not aligned with the major ticks — they are showing between two ticks instead of directly on them.

I am currently using CategoryField for the time values.

How can I make the labels align with the major ticks?

Code Snippet:

<!-- Category Axis -->
<ChartCategoryAxes>
    <ChartCategoryAxis Type="ChartCategoryAxisType.Date"
                       BaseUnit="@GetBaseUnit()"
                       BaseUnitStep="@GetAutoBaseUnitStep()"
                       Min="@VisibleMin"
                       Max="@VisibleMax"
                       AxisCrossingValue="@GetCategoryAxisCrossings()"
                       Visible="@XAxisConfig.Visible"
                       Color="@XAxisConfig.AxisColor">

        <ChartCategoryAxisMajorTicks Visible="@ShowMajorTicks"
                                     Size="@XAxisConfig.MajorTickSize"
                                     Color="@XAxisConfig.MajorTickColor"
                                     Step="@MajorTickStep" />

        <ChartCategoryAxisMinorTicks Visible="@ShowMinorTicks"
                                     Size="@XAxisConfig.MinorTickSize"
                                     Color="@XAxisConfig.MinorTickColor"
                                     Step="@MinorTickStep" />

        <ChartCategoryAxisMajorGridLines Visible="@(ShowMajorTicks && XAxisConfig.ShowMajorGridLines)"
                                         Width="@XAxisConfig.MajorGridWidth"
                                         Step="@MajorTickStep"
                                         Color="@XAxisConfig.MajorGridColor"
                                         DashType="@GetDashType(XAxisConfig.MajorGridDash)" />

        <ChartCategoryAxisMinorGridLines Visible="@(ShowMinorTicks && XAxisConfig.ShowMinorGridLines)"
                                         Width="@XAxisConfig.MinorGridWidth"
                                         Step="@MinorTickStep"
                                         Color="@XAxisConfig.MinorGridColor"
                                         DashType="@GetDashType(XAxisConfig.MinorGridDash)" />

        <ChartCategoryAxisTitle Text="@(string.IsNullOrEmpty(XAxisConfig.Title) ? GetXAxisTitle() : XAxisConfig.Title)" />

        <ChartCategoryAxisLabels Format="@GetAxisLabelFormat()"
                                 Step="@(ShowMajorTicks ? MajorTickStep : 1)">
            <ChartCategoryAxisLabelsRotation Angle="@CategoryLabelRotation"
                                             Align="ChartAxisLabelsRotationAlignment.Center" />
        </ChartCategoryAxisLabels>

    </ChartCategoryAxis>
</ChartCategoryAxes>

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 20 Mar 2026, 12:32 PM

Hello Dobo,

The Chart has two types of horizontal axes:

  • Categorical - in this case, the major ticks and gridlines act as a separator between categories.
  • Numerical - in this case, the major ticks align with the axis labels.

You are currently using categorical Chart series and Axis. If you switch to numerical series and replace the categorical axis with an X axis, you will achieve the desired look.

If you can't switch the Chart series type for some reason, then you can remove the major gridlines altogether. Set

        <ChartCategoryAxis Type="@ChartCategoryAxisType.Date">
            <ChartCategoryAxisMajorGridLines Visible="false" />
        </ChartCategoryAxis>

You can also control ticks and gridlines separately if you like:

        <ChartCategoryAxis Type="@ChartCategoryAxisType.Date">
            <ChartCategoryAxisMajorGridLines Visible="true" />
            <ChartCategoryAxisMajorTicks Visible="false" />
        </ChartCategoryAxis>

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Charts
Asked by
Dobo
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or