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

Series Data Field

2 Answers 262 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 20 Apr 2012, 04:25 PM
Hi,

Any ideas what I am doing wrong in second #chart2 setup as it does not render correctly (#chart1 does) for me?

works <div id="chart"></div>
doesnt? <div id="chart2"></div>

$(document).ready(function() {
    
    var datatestfield = [ { no: 1, a: 2, b: '3' },
                     { no: 5, a: 3, b: '4' },
                     { no: 40, a: 4, b: '5' }
                   ];
        
    $("#chart").kendoChart({
    title: {
         text: "Kendo Chart Example"
    },
    dataSource: { data: datatestfield},            
    series: [
        { name: "Example Series", field : "a" }
    ]
        });
    
    $("#chart2").kendoChart({
    title: {
         text: "Kendo Chart Example"
    },
    series: [
        { name: "Example Series", field : "a", data: datatestfield }
    ]
        });

});

Thanks
Matt

2 Answers, 1 is accepted

Sort by
0
Accepted
Gergo
Top achievements
Rank 1
answered on 20 Apr 2012, 09:59 PM
Hi Matthew,

I hope that I've understood correctly your problem.
As I see in chart 2 you try to specify the data property for the series, which I think is incorrect.
Here is the code which isn't correct:
series: [
       { name: "Example Series", field : "a", data: datatestfield }
   ]

I think if you move the data:datatestfiled to the datasource: {data : ... } property it will resolve the problem.

Regards,
Gergő
0
Matt
Top achievements
Rank 1
answered on 22 Apr 2012, 02:38 PM
Thanks Gergo, you are correct, do we think that a documentation update would be useful in the configuration demo section

field: String
The data field containing the series value.

to ensure that it is made clearer that the field property only acts on a supplied datasource and not on an inline array using its own data property?

Thanks
Matt
Tags
Charts
Asked by
Matt
Top achievements
Rank 1
Answers by
Gergo
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or