1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | (function () { Flotr.ExampleList.add({ key : 'basic-bar-stacked', name : 'Stacked Bars', callback : bars_stacked }); Flotr.ExampleList.add({ key : 'basic-stacked-horizontal', name : 'Stacked Horizontal Bars', args : [true], callback : bars_stacked, tolerance : 5 }); function bars_stacked (container, horizontal) { var d1 = [], d2 = [], d3 = [], graph, i; for (i = -10; i < 10; i++) { if (horizontal) { d1.push([Math.random(), i]); d2.push([Math.random(), i]); d3.push([Math.random(), i]); } else { d1.push([i, Math.random()]); d2.push([i, Math.random()]); d3.push([i, Math.random()]); } } graph = Flotr.draw(container,[ { data : d1, label : 'Serie 1' }, { data : d2, label : 'Serie 2' }, { data : d3, label : 'Serie 3' } ], { legend : { backgroundColor : '#D2E8FF' // Light blue }, bars : { show : true, stacked : true, horizontal : horizontal, barWidth : 0.6, lineWidth : 1, shadowSize : 0 }, grid : { verticalLines : horizontal, horizontalLines : !horizontal } }); } })(); |