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

Series Data lines up with categories

3 Answers 64 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Kieren
Top achievements
Rank 1
Kieren asked on 06 Jul 2013, 11:48 AM
Hi

My fundamental understanding was that series data should line up with categories. This chart renders to that logic:
function createChart() {
               $("#chart").kendoChart({
                   title: {
                       text: "Units sold"
                   },
                   seriesDefaults: {
                       width: 2,
                       markers: {
                           visible: false,
                       },
                       overlay: {
                           gradient: null
                       }
                   },
                   series: [{
                       type: "area",
                       transitions: false,
                       width: 2,
                       data: [
                           150, 200, 50
                       ]
                   }],
                   valueAxis: {
                       labels: {
                           visible: true
                       },
                       line: {
                           visible: false
                       }
                   },
                   categoryAxis: {
                       categories: [
                           new Date("2012/02/01 00:00:00"),
                           new Date("2012/02/10 00:00:00"),
                           new Date("2012/02/20 00:00:00")
                       ],
                       baseUnitStep: "auto",
                       autoBaseUnitSteps: {
                           days: [1]
                       }
                   }
               });
 
           }
But:
The dates aren't aligned to series?

And, if you change this date:
new Date("2012/02/10 00:00:00") TO new Date("2012/02/02 00:00:00"),

The chart renders 200 as the value for 2012/02/01?

Just wondering if I could get a bit of an explanation for what I'm seeing.

Thanks
Kieren

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Jul 2013, 11:27 AM
Hello,

Please try with the below code snippet.

function createChart() {
               $("#chart").kendoChart({
                   title: {
                       text: "Units sold"
                   },
                   seriesDefaults: {
                       width: 2,
                       markers: {
                           visible: false,
                       },
                       overlay: {
                           gradient: null
                       }
                   },
                   series: [{
                       type: "area",
                       transitions: false,
                       width: 2,
                       data: [
                           150, 200, 50
                       ]
                   }],
                   valueAxis: {
                       labels: {
                           visible: true
                       },
                       line: {
                           visible: false
                       }
                   },
                   categoryAxis: {
                       categories: [
                           new Date("2012/02/01 00:00:00"),
                           new Date("2012/02/02 00:00:00"),
                           new Date("2012/02/20 00:00:00")
                       ],
                       baseUnit: "days",
                       autoBaseUnitSteps: {
                           days: [1]
                       }
                   }
               });
           }

baseUnit: "days"

Please check below demo for more info.
http://demos.kendoui.com/dataviz/area-charts/date-axis.html

Thanks.
Jayesh Goyani
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Jul 2013, 11:28 AM
Hello,

Please changed baseUnitStep: "auto" code with baseUnit: "days".

Please check below demo for more info.
http://demos.kendoui.com/dataviz/area-charts/date-axis.html

Thanks.
Jayesh Goyani
0
Iliana Dyankova
Telerik team
answered on 09 Jul 2013, 03:17 PM
Hi,

@Kieren
The illustrated outcome is caused by baseUnitStep: "auto". As an explanation:
  • When using this configuration the step will be automatically calculated depending on the data;
  • By design when used date axis the data is aggregated for a particular period.
In your particular example the baseUnit is two days and the aggregated data show 200 for the first period. I hope this information helps.

@Jayesh 
I am not quite sure if I understand what your question is. Could you please elaborate a bit more - probably I am missing something. Thank you in advance for your cooperation.

Regards,
Iliana Nikolova
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
Kieren
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Iliana Dyankova
Telerik team
Share this question
or