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

Kendo UI DataViz incorrectly grouped values in chart

1 Answer 66 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Gabrielle
Top achievements
Rank 1
Gabrielle asked on 04 Nov 2013, 11:40 AM
I have strange problem when aggregating my sale data by Location and displaying it on the chart by date.I have let's say 25 Sales Amount in two locations across different dates. Location A has 10 days when minimum 1 sale happened, location B has 15 days. I want to display line graph for last month for those two locations displaying the day and the amount of the sale. The days with no sale should just interpolate.The expected result is two lines each with different days and different amount. But What I get is two lines but( each with 9 dates) always paired together. It displays incorrect day and the amount of the sale that day. The data from the server are however correct , and so is correct the graph if only one location is displayed.The problem seems to be when the two lines have different dates.here is the relevant code:

function makeChartData(transport, field){
        var chart_data = new kendo.data.DataSource({
            transport: transport,
            group: {
                field: field
            }
        });
        return chart_data;
    }
 
    var chart_data = makeChartData(transport, "Location_Name");
 
    function createSalesChart() {
        return $("#overview-chart").height(400).width(490).kendoChart({
            dataSource: chart_data,
            autoBind: false,
            seriesDefaults: { type: "line", stack: false, missingValues: "interpolate" },
            series: [
                {
                    field: "Gross_Total",
                    name: "Gross Total",
                    categoryField: "Date"
                }
            ],
            categoryAxis: {
                field: "Date",
                baseUnit: "days",
                type: "date",
                labels: {
                    dateFormats: {
                        days:"M-d"
                    },
                    step: 7
                },
 
            },
            valueAxis: {
                name: "currency",
                labels: { format: currency_prefix+"{0}"+currency_suffix },
            },
            legend: { position: "bottom" },
            tooltip: { visible: true, format: "0" },
            plotArea:{
                background: "#FFF"
            }
        });
    }

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 05 Nov 2013, 12:35 PM
Hello,

I can't be sure what the problem is without looking at the actual data. My guess is that the date format can't be parsed by the chart. This can result in a sequential (categorical) chart.
Please, test the date format using kendo.parseDate("..."). It should be able to successfully parse it.

The chart configuration itself looks fine and a simple test confirms that it's valid: http://jsbin.com/oHeKaTa/1/edit?html,output

Regards,
T. Tsonev
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
Gabrielle
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or