This is a migrated thread and some comments may be shown as answers.

Total number of categoryaxis categories

3 Answers 126 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Tonih
Top achievements
Rank 1
Tonih asked on 16 Dec 2013, 03:39 PM
Hi,

I am trying to set step numbers for the categoryaxis labels. I would like for the categoryaxis to show 7 labels no matter how many datapoints is on the chart. I figured I'd use the categoryAxis.labels.step property to do this. The chart can have up to or more than 1000 datapoints. I am using this example however there appears to be several arrays that holds data and I am not sure which container to target. How can I effectively control the number of xaxis labels no matter how many datapoints is on the chart? Thanks in advance.

Thanks,
Tonih

3 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 18 Dec 2013, 11:53 AM
Hello Tonih,

The possible workaround is to hide the major category axis then add a category axis that will show only 7 labels(based on your logic). Could you try this approach and tell me if you have questions?

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tonih
Top achievements
Rank 1
answered on 19 Dec 2013, 03:56 PM
Hi Hristo,

The problem I am having is that I do not know whicharray container to target that provides the total number of dataItems that is currently visible on the chart.  If I knew this, couldn't I just take that total number and divide it by 7 and the result will be my step number? I wouldn't need to hide anything in this scenario  right? If you view the chart in console by doing:

        var chart = $("#chart").data("kendoStockChart");
        var chartOptions = chart.options;
        console.log(chartOptions);

it is not clear which array I need to target to create this functionality.

Thanks,
Tonih
0
Hristo Germanov
Telerik team
answered on 24 Dec 2013, 09:39 AM
Hello Tonih,

The categories max that you need is in:
1) In the series.data if you use categoryField.
2) In the categoryAxis.categories if you use categoryAxis.field.

I hope this helps.

Regards,
Hristo Germanov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Tonih
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Tonih
Top achievements
Rank 1
Share this question
or