1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- // DATA DEFINITION
- function getData() {
- var data = [];
- data.push({
- data: [[0, 1], [1, 4], [2, 2]]
- });
- data.push({
- data: [[0, 5], [1, 3], [2, 1]]
- });
- return data;
- }
- // ORDERED & STACKED CHART
- var orig_data = getData();
- // Add order: 0 to the existing bars
- for(var i = 0; i<orig_data.length; i++) {
- orig_data[i].bars = {
- order: 0
- };
- orig_data[i].stack = true;
- }
- orig_data.push({
- data: [[0, 4], [1, 1], [2, 3]],
- bars: {
- order: 1
- },
- stack: true
- });
- orig_data.push({
- data: [[0, 7], [1, 2], [2, 3]],
- bars: {
- order: 1
- },
- stack: true
- });
- $.plot($('#stacked-ordered-chart'), orig_data, {
- bars: {
- show: true,
- barWidth: 0.4
- }
- });
- // Don't want any logs for the working examples
- // STACKED CHART
- var d = getData();
- for(var i = 0; i<d.length; i++) {
- d[i].stack = true;
- }
- $.plot($('#stacked-chart'), d, {
- bars: {
- show: true
- }
- });
- // ORDERED CHART
- var d = getData();
- for(var i = 0; i<d.length; i++) {
- d[i].bars = {
- order: i
- }
- }
- $.plot($('#ordered-chart'), d, {
- bars: {
- show: true,
- barWidth: 0.4
- }
- });
|