dataSource Object|Array|kendo.data.DataSource
The data source of the chart which is used to display the series. Can be a JavaScript object which represents a valid data source configuration, a JavaScript array or an existing kendo.data.DataSource instance.
If the dataSource
option is set to a JavaScript object or array the widget will initialize a new kendo.data.DataSource instance using that value as data source configuration.
If the dataSource
option is an existing kendo.data.DataSource instance the widget will use that instance and will not initialize a new one.
Example - set dataSource as a JavaScript object
<div id="chart"></div>
<script>
$("#chart").kendoChart({
dataSource: {
data: [
{ price: 10 },
{ price: 20 }
]
},
series: [
{ field: "price" }
]
});
</script>
Example - set dataSource as a JavaScript array
<div id="chart"></div>
<script>
$("#chart").kendoChart({
dataSource: [
{ price: 10 },
{ price: 20 }
],
series: [
{ field: "price" }
]
});
</script>
Example - set dataSource as an existing kendo.data.DataSource instance
<div id="chart"></div>
<script>
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/stockdata",
dataType: "jsonp"
}
}
});
$("#chart").kendoChart({
dataSource: dataSource,
series: [
{ field: "Volume" }
]
});
</script>