Skip to content Skip to sidebar Skip to footer

Multi-color Line

In the data, there is a object property called clr which is actually contains color information of corresponding object. I would like to draw a single line with multiple colors. Ho

Solution 1:

As mentioned here, the colorField option is supported when series.type is set to "bar", "column", "bubble", "donut", "pie", "candlestick", "ohlc" or "waterfall".

The only way to do this seems to be by creating multiple series. See fiddle: http://jsfiddle.net/53ygp9ut/2/

functioncreateChart() {
    $("#chart").kendoChart({
        xAxis: {},
        yAxis: {},
        seriesDefaults: {type:"scatterLine" },
        series: [{data:stats1, color:"blue"},
                 {data:stats2, color:"yellow"},
                 {data:stats3, color:"red"}],
    });
}

$(document).ready(createChart);

Solution 2:

Change your function to look like this, you have to tell Kendo to use the colorField:

functioncreateChart() {
    $("#chart").kendoChart({
        xAxis: {},
        yAxis: {},
        seriesDefaults: {type:"scatterLine" },
        series: [{data:stats2,colorField:"clr"}],
  })
}

Updated fiddle: http://jsfiddle.net/epvg86qu/20/

Post a Comment for "Multi-color Line"