saulyasar
saulyasar

Reputation: 815

kendo chart grouping error

I have bar chart with grouping dynamic data. I'm getting data from database with no problem I put my data screenshot below

When i want to bind data on chart i'm grouping data I have data in [Jan,Feb,April] But chart just shows April on x-axis??? Its grouping wrong and put data wrong place

Here my js code

var stocksDataSource = new kendo.data.DataSource({
    data: myDearData,

    group: {
        field: "MshStok"
    },

    sort: {
        field: "TotalPurchase",
        dir: "desc"
    }
});
$("#yearly-stock-prices").kendoChart({
    dataSource: stocksDataSource,
    theme: "flat",
    autoBind: false,

    seriesDefaults: {
        type: "area",
        overlay: {
            gradient: "none"
        },
        markers: {
            visible: false
        },
        majorTickSize: 0,
        opacity: .8
    },

    series: [{
        field: "TotalPurchase"
    }],


    valueAxis: {
        line: {
            visible: true
        },

        labels: {
            template: "#= ChangeFormatMoney(value) #",
            skip: 2,
            step: 2,
            color: "#727f8e"
        }
    },

    categoryAxis: {
        field: "Months",

        labels: {
            format: "MMM",
            color: "#727f8e"
        },

        line: {
            visible: true
        },

        majorTicks: {
            visible: false
        },

        majorGridLines: {
            visible: false
        }
    },

    tooltip: {
        visible: true,
        template: "#= series.name # - #= ChangeFormatMoney(value) #"
    },

    legend: {
        visible: true
    }
});

Do you have any idea for this?

Thanks

datarecord

chart

Upvotes: 1

Views: 538

Answers (1)

ezanker
ezanker

Reputation: 24738

See final entry here: http://www.telerik.com/forums/strange-behaviour-in-category-assignment-grouping-for-charts-bug

Try defining your category field in the series object (series.categoryAxis) instead of the categoryAxis (categoryAcis.field):

series: [{
    field: "TotalPurchase",
    categoryField: "Months"
}],

DEMO

Upvotes: 2

Related Questions