I'm attempting to display two series on a single line chart in KendoUI.
The dates in the series don't match (that is, series two starts after series one, and finishes before series one). KendoUI however renders both series starting from the beginning of the chart.
I've created a simple jsfiddle to demonstrate the issue, summarised here:
HTML:
<div id="chart" />
CSS:
#chart
{
width: 400px;
height: 280px;
}
JS:
$(function () {
var dataSource = new kendo.data.DataSource({
data: [
{ series: 'Series 1', date: new Date(2013, 04, 01), count: 1 },
{ series: 'Series 1', date: new Date(2013, 04, 02), count: 3 },
{ series: 'Series 1', date: new Date(2013, 04, 03), count: 5 },
{ series: 'Series 1', date: new Date(2013, 04, 04), count: 3 },
{ series: 'Series 1', date: new Date(2013, 04, 05), count: 1 },
{ series: 'Series 2', date: new Date(2013, 04, 02), count: 5 },
{ series: 'Series 2', date: new Date(2013, 04, 03), count: 3 },
{ series: 'Series 2', date: new Date(2013, 04, 04), count: 5 }
],
group: {
field: 'series'
},
sort: {
field: 'date',
dir: 'asc'
},
schema: {
model: {
fields: {
date: {
type: 'date'
}
}
}
}
});
dataSource.read();
$('#chart').kendoChart({
title: {
text: 'Date Demonstration'
},
dataSource: dataSource,
seriesDefaults: {
type: 'line'
},
series: [{
field: 'count',
data: []
}],
valueAxis: {
line: {
visible: false
},
labels: {
step: 2,
template: function (value) {
return value.value % 1 === 0 ? value.value : ' ';
}
}
},
categoryAxis: {
field: 'date',
type: 'date',
labels: {
template: function (value) {
return value.value.getDate();
}
}
},
legend: {
position: 'bottom'
}
});
});
The graph should have the second series starting at '2', instead it starts at '1'.
Anyone have any idea on how to fix this? Is this a bug in KendoUI?