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

Displaying calendar week number in category axis on chart

5 Answers 70 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
Vedad asked on 28 Aug 2018, 08:04 AM

Hi,

 

We recently upgraded from 2016 library to latest one. One of the widgets we are using is Chart and we have situation where we display yearly data spread through the weeks. 

In previous version we simply had categoryAxis configuration set to 

baseUnit: "weeks",
labels: {
     step: 1,
     dateFormats: {
          weeks: "cw"
     }
},
majorGridLines: {
     visible: true
},
axisCrossingValues: [0, 54]

However, after upgrading to the new version, instead of displaying week numbers (1 to 52) it simply displays cw text. 

I tried all possible things i could think of, but couldn't make it display week numbers, so I would appreciate a little help. :)

Thanks

 

 

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 30 Aug 2018, 05:03 AM
Hi,

Could you clarify in which version this used to work? 'cw' is not from the supported date formats. A possible approach to show the number is to use the weekInYear method in a template - example.

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 30 Aug 2018, 08:54 AM

Hi Daniel, thanks for your answer. 

Your suggestion works, thank you very much.

To answer your question, version that was used before is "2016.2.504". 

I replaced dateFormats from my example with template as in your suggestion and it works.

Only difference I can spot is different count of the weeks (new one with yours makes more sense to me), but everything else behaves properly. 

Thanks again and if can help clarify anything else please let me know.

 

0
Accepted
Daniel
Telerik team
answered on 31 Aug 2018, 07:58 AM
Hello again,

I am glad that the suggestion helped. I also tried to replicate the previous behavior with 2016.2.504 but the 'cw' format still does not seem to work - updated example. Is it possible that the code was patched on your side to support this format?

Regards,
Daniel
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 31 Aug 2018, 08:21 AM

Hello, I will have to dig deeper in codebase to see if someone who worked long before me did something on previous versions of library. I didn't look in Kendo lib files as it didn't make much sense to touch things there by anyone. I would personally go with override on prototype in separate file, but.. :)

 

I will post my findings, but it may take a some time since I have to finish migration first. :)

 

Thanks a lot and regards,

Vedad

0
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 13 Sep 2018, 07:37 AM

Hi Daniel, 

Sorry for slow answer, but it took me a while to catch what was a problem. Looks like someone extended library long ago so with abbreviation "CW" it basically returns date.getWeek (I presume this is predecessor of weekInYear).

Thanks for your help.

Best regards,

Vedad

Tags
Charts
Asked by
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Daniel
Telerik team
Vedad
Top achievements
Rank 1
Iron
Veteran
Iron
Share this question
or