2017-03-22 66 views

回答

1

您可以使用colorField屬性(API:http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-series.colorField

var data = [ 
    {x: "Name 1", y: 16, valueColor: "#556270"}, 
    {x: "Name 2", y: 13, valueColor: "#4ECDC4"}, 
    {x: "Name 3", y: 15, valueColor: "#C7F464"}, 
    {x: "Name 4", y: 14, valueColor: "#FF6B6B"}, 
    {x: "Name 5", y: 16, valueColor: "#C44D58"}, 
]; 


$("#chart").kendoChart({ 
    dataSource: data, 
    series: [{ 
     type: "bar", 
     field: "y", 
     categoryField: "x", 
     colorField: "valueColor"      
    }], 
}); 

DEMO

+0

怎麼做,Y中有可能插入文本?我在那裏有數據文本( – enot

+0

@enot,x和y都是文本?你怎麼知道酒吧的大小? – ezanker