Using the demo (https://docs.telerik.com/kendo-ui/knowledge-base/timeline-using-range-bars) as a base, each has a unique ID. I have adjusted the data in the datasource to only use two different colors. The demo turns off the legend. But I need a legend to indicate what the colors on my chart mean. Turning on the legend (for both the demo and for mine) has two separate issues.
1) The legend contains a separate entry for each individual bar rather than combining them (either by category field or (prefered) the color).
2) The color in the legend doesn't match the color of the bar.
Here is the creation of my chart:
$("#LDP_chart").kendoChart({
dataSource: {
data: cdata.results,
group: {
field: "id",
dir: "asc"
}
},
series: [{
type: "rangeBar",
fromField: "from",
toField: "to",
categoryField: "key",
name: "#: group.items[0].seriesName #",
colorField: "color",
spacing: -1
}],
valueAxis: {
name: "value",
min: new Date(startDate + " 00:00").getTime() / 1000,
max: new Date(endDate + " 23:59:59").getTime() / 1000,
majorUnit: 24 * 60 * 60,
majorGridLines: {
color: "black"
},
labels: {
template: "#= kendo.toString(new Date(value * 1000), 'ddd MM/dd') #",
rotation: "auto"
}
},
categoryAxis: {
name: "category"
},
legend: {
visible: true,
position: 'bottom'
},
});
Google isn't helping me here. I did find an article saying #2 isn't possible because the legend isn't using colorField parameter of the datasource, but that was pretty dated.