Connect categoryField in series to categories in category-axis

0 Answers 110 Views
Charts
Andrey
Top achievements
Rank 1
Andrey asked on 07 Mar 2022, 11:16 AM

Hi all!

I would like to connect values from series-item to categories in category-axis-item.

But it doesn't work together.

What I want: https://prnt.sc/HjCWlDLbjJy8

What i have: https://prnt.sc/eyDunF-lvGew

But data on each screenshots is same.

I need to use const categories - all months of the year. But i have big array of values per day.

May you help me with that? How can i reach that?

Big thanks!

Svet
Telerik team
commented on 10 Mar 2022, 09:45 AM

Hi Andrey,

Thank you for the provided screenshots. But I will need some more details to better understand the overtaken approach. Could you please provide the used sample data set and the Chart markup? If the data is sensitive, please send some mock data. Thank you in advance.

I am looking forward to your reply.

Andrey
Top achievements
Rank 1
commented on 12 Mar 2022, 08:26 AM

Hi, Svet! Thnak you for reply!

My data looks like:

const data = [{value: 123, date: new Date('2022-01-01')}, {value: 222, date: new Date('2022-01-02}, {value: 333, date: new Date('2022-01-03')....., {value: 412, date: new Date('2022-02-28')];

data.length = 60;

My category array consist of 12 dates from 01.01.2022 to 01.12.2022.

Svet
Telerik team
commented on 16 Mar 2022, 01:58 PM

Hi Andrey,

Thank you for the provided additional details.

I see that actual Dates are a part of the Chart data. If these Dates are used by the category axis of the chart, then the axis will be split into time intervals that are automatically calculated by the chart. Please see the following article on this behavior of the chart:

https://www.telerik.com/kendo-angular-ui/components/charts/elements/axes/#toc-displaying-time-series

In order to disable that behavior of the Chart please set the axis type to "category":

      <kendo-chart>
        <kendo-chart-category-axis>
            <kendo-chart-category-axis-item type="category">
            </kendo-chart-category-axis-item>
        </kendo-chart-category-axis>
...
      </kendo-chart>

I hope that helps. Feel free to write back in case any further information is required on this case.

No answers yet. Maybe you can help?

Tags
Charts
Asked by
Andrey
Top achievements
Rank 1
Share this question
or