Hi,
My problem is getting colored series line in line chart and the colors should come from grouped datasource,
My json looks like this:
{"Color":"#CC0000","Id":1,"Legend":"Şube","Value":46,"XAxis":"Mart"},
{"Color":"#EC6E00","Id":13,"Legend":"Bölge Müdürlüğü","Value":42,"XAxis":"Haziran"},
{"Color":"#7F7F7F","Id":29,"Legend":"Genel Müdürlük","Value":20,"XAxis":"Temmuz"}.....
And my script is:
function createChart() {
var chartDataSource = new kendo.data.DataSource({
transport: {
read: {
url: function () {
return "http://bipoc:7777/Service.svc/GetBarChart";
},
dataType: "json"
}
},
group: {
field: "Legend",
}
});
$("#chart").kendoChart({
dataSource: chartDataSource,
series: [{
type: "line"
, field: "Value"
, name: "#= group.value # "
, colorField: "Color"
, groupColor: function (item) {
var series = item.series;
series.color = series.data[item.index].Color;
}
}],
legend: {
position: "bottom"
},
valueAxis: {
labels: {
format: "${0}",
skip: 2,
step: 2
}
},
categoryAxis: {
field: "XAxis",
majorGridLines: {
visible: false
}
},
tooltip: {
visible: true,
format: "{0}%",
template: "#= series.name #: #= value #"
}
});
}
But by this way i get colored lines but boxes of the legends and tooltips retain the same with default colors (I've attached a screenshot of the result). What is wrong in my code? ANy help would be appreciated.
Thanks,
My problem is getting colored series line in line chart and the colors should come from grouped datasource,
My json looks like this:
{"Color":"#CC0000","Id":1,"Legend":"Şube","Value":46,"XAxis":"Mart"},
{"Color":"#EC6E00","Id":13,"Legend":"Bölge Müdürlüğü","Value":42,"XAxis":"Haziran"},
{"Color":"#7F7F7F","Id":29,"Legend":"Genel Müdürlük","Value":20,"XAxis":"Temmuz"}.....
And my script is:
function createChart() {
var chartDataSource = new kendo.data.DataSource({
transport: {
read: {
url: function () {
return "http://bipoc:7777/Service.svc/GetBarChart";
},
dataType: "json"
}
},
group: {
field: "Legend",
}
});
$("#chart").kendoChart({
dataSource: chartDataSource,
series: [{
type: "line"
, field: "Value"
, name: "#= group.value # "
, colorField: "Color"
, groupColor: function (item) {
var series = item.series;
series.color = series.data[item.index].Color;
}
}],
legend: {
position: "bottom"
},
valueAxis: {
labels: {
format: "${0}",
skip: 2,
step: 2
}
},
categoryAxis: {
field: "XAxis",
majorGridLines: {
visible: false
}
},
tooltip: {
visible: true,
format: "{0}%",
template: "#= series.name #: #= value #"
}
});
}
But by this way i get colored lines but boxes of the legends and tooltips retain the same with default colors (I've attached a screenshot of the result). What is wrong in my code? ANy help would be appreciated.
Thanks,