jquery - flot side by side stack bar -



jquery - flot side by side stack bar -

is possible have side side bar chart mixed stacked bar using flot?

similar jqplot question here: jqplot side side stacked bar chart

tried using both 1 side side runs , if disable side side, stacked bar works perfectly.

image similar : http://peltiertech.com/utility/pix/clusterstackchart.png

sample code wrote is: http://jsfiddle.net/wagbt/ (comment out order: x property , you'll see them switch)

$(document).ready(function () { drawchart(); }); function generateseries(added) { var info = []; var start = 100 + added; var end = 500 + added; (i = 1; <= 20; i++) { var d = math.floor(math.random() * (end - start + 1) + start); data.push([i, d]); start++; end++; } homecoming data; } function drawchart() { var dataa = generateseries(100); var datab = generateseries(100); var datac = generateseries(100); var ds = new array(); var info = [ { label: "data1", data: dataa, bars: { show: true, barwidth: 0.2, order: 1, linewidth: 2 } }, { label: "data2", data: datab, bars: { show: true, barwidth: 0.2, order: 2, linewidth: 2 } }, { label: "data3", data: datac, bars: { show: true, barwidth: 0.2, order: 3, linewidth: 2 } } ]; var options = { series: { stack: true }, xaxis: { }, grid: { backgroundcolor: { colors: ["#fff", "#fff"] } } }; var plot = $.plot($("#placeholder"), data, options); }

add bars options...

var options = { series: { stack: true }, xaxis: { }, grid: { backgroundcolor: { colors: ["#fff", "#fff"] } }, bars:{ // show bars width of .4 show: true, barwidth: .4 } };

and massage info format...

var info = [ // series [ // first series (q1) [0,100], // pens q1 n america [0.4,120], // pencils q1 n america [1,130], // pens q1 europe [1.4,140], // pencils q1 europe [2,150], // pens q1 asia [2.4,200], // pencils q1 asia ], [ // sec series (q2) [0,100], [0.4,200], [1,200], [1.4,200], [2,200], [2.4,200], ], [ // 3rd series (q3) [0,100], [0.4,200], [1,200], [1.4,200], [2,200], [2.4,200], ], [ // 4th series (q4) [0,100], [0.4,200], [1,200], [1.4,200], [2,200], [2.4,200], ] ]

and works this: http://jsfiddle.net/wagbt/2/

i made update labels series, , on axes: http://jsfiddle.net/wagbt/3/

jquery charts stack flot

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -