javascript - Auto-Generate Color in Flot not working -
when add new series chart dynamically same initial colour applied, should generate new color per documentation doesnt, bug or doing wrong?
i using flot 0.8.2.
update: saw this, might related:flot 0.8.2 line chart - color bug
var serie1 ={label:"test",data:[[12,123],[15,125]]}; var serie2 ={label:"jonas",data:[[12,125],[15,123]]}; var flot = $.plot($("#container"),[serie1]); var alldata = flot.getdata(); alldata.push(serie2); flot.setdata(alldata); flot.setupgrid(); flot.draw();
yeah, that's little bit of bug if use flot in way. when use setdata()
add second series, flot won't add new color because starts again beginning of automated color array used first series. (i add more details bug ticket opened.)
if use flot = $.plot($("#container"), [serie1, serie2]);
instead normal behavior want.
alternatively can specify colors in data like
var serie1 = { label: "test", data: [[12, 123], [15, 125]], color: 0 }; var serie2 = { label: "jonas", data: [[12, 125], [15, 123]], color: 1 };
Comments
Post a Comment