Line Chart: category axis maxDivisions for int

1 Answer 288 Views
Charts General Discussions
John
Top achievements
Rank 1
Veteran
John asked on 27 Oct 2021, 05:41 PM | edited on 27 Oct 2021, 07:28 PM

Hi,

I see that the maxDivisions work for dates (category axis documentation) on the CategoryAxis, how about for ints?

My data is like this: 

[{period: 1, value: 2}, {period: 2, value 5},...]

I have a chart with about 360 "categories", using this code I still receive the below graph... How can I use divisions for the category axis of ints or is there another solution?

          <Chart>
            <ChartSeries>
              <ChartSeriesItem
                renderAs={"canvas"}
                data={curveValues}
                type="line"
                field="value"
                markers={{ visible: false }}
                categoryField="period"
              />
            </ChartSeries>
            <ChartCategoryAxis>
              <ChartCategoryAxisItem maxDivisions={30} />
            </ChartCategoryAxis>
            <ChartTooltip format="{0}" />
          </Chart>

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 29 Oct 2021, 08:56 AM

Hello John,

As stated in the documentation, maxDivisions works for dates only, but it is still possible to reduce the number of labels when using numeric values by setting the "step" property of the labels (https://www.telerik.com/kendo-react-ui/components/charts/api/ChartCategoryAxisItemProps/#toc-labels) in the ChartCategoryAxisItem:

    <ChartCategoryAxis>
      <ChartCategoryAxisItem
        maxDivisions={30}
        labels={{
          step: 15,
        }}
      />

Following is an example with the above approach:

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Charts General Discussions
Asked by
John
Top achievements
Rank 1
Veteran
Answers by
Konstantin Dikov
Telerik team
Share this question
or