javascript - Is it possible to have different colored graphs in a single series in HighCharts? -
i have single series column graph x-axis datetime , y-axis constant value. show columns in different colors based on information have , possible ?
e.g. have dynamic data coming in plot graph,i use series.addpoint({x:x,y:value,extra:info}, false, false)
plot same. based on info, how can vary colors?
i pretty new javascript , highcharts. pardon limited knowledge, in right direction appreciated.
updated code:
if(type=='a') color='#7cb5ec'; else if(type=='b') color='#f45b5b'; else if(type=='c') color='#8085e9'; else if(type=='d') color='#2b908f'; else color='#e4d354'; series.addpoint({x:x,y:value,extra:info,marker:{fillcolor:color}}, false, false);
i have set colorbypoint: true
option. series.addpoint function runs in loop runs , when data.
try out following
plotoptions: { column: { colorbypoint: true } }, colors: [ '#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9', '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1' ],
update 1:
update 2:
use following code have specific color specific bar
chart.series[0].addpoint({y: math.random() * 100, color:'#659355'}, true, true);
Comments
Post a Comment