Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flot bar chart: bars overlapping on time axis issue

I am trying to plot expense data against time axis, and I see the data bars are overlapping if they are showing data for the same date. I was expecting the graph to show the bars asjascent to each other but that is not the case. See a sample of code at this link...

$.plot($("#placeholder"), newJson, 
{
    bars: {
        show: 1,
        barWidth: 24 * 60 * 60 * 1000 * 10
    },
    xaxis: { mode:"time" }
});

enter image description here

like image 480
Faiz Avatar asked Nov 28 '13 11:11

Faiz


People also ask

Do the bars overlaps in a bar diagram?

Overlapping bars can be used to visualize two data sets on a single chart. Similar to a simple bar chart, this chart uses horizontally aligned rectangular bars on one axis as data plots plotted against the discrete values shown on the other.

What can be wrong in a bar chart?

Mistakes with scales are among the most common graphical mistakes. A few examples include having equally spaced tick marks for uneven intervals, using too many or too few tick marks and labels, and having a bar chart without a zero baseline.

How do you overlap a bar in PowerPoint?

On the Bar chart in PowerPoint, Right click on a series ->go to Format Data Series -> Series options -> Series Overlap. When you move the handle to the right the bars overlap.

How do you make a bar graph overlap?

Overlapping Chart In ExcelStep 1: Select the cell containing the data. Step 2: Select the 'Insert' Tab from the top and select the bar chart. Step 3: Right-click on one bar and choose the “Change series chart type” option. Step 4: In the change chart dialog box, make sure the Combo category is selected.


1 Answers

Unfortunately, that isn't possible in flot without using some sort of plugin. I suggest you either use the stacking plugin to get a vertical stack, or an external plugin like orderBars.

In each of them, you add an option to each series specifying that it should be stacked/ordered. Or to the overall series options for bars if you want it to apply for everything.

$.plot($("#placeholder"), newJson, 
    {bars: { order:1, show: 1, barWidth: 24 * 60 * 60 * 1000 * 10 },
     xaxis: { mode:"time" }
});

Here's a working example: http://jsfiddle.net/ryleyb/A8yNV/7/

like image 55
Ryley Avatar answered Nov 02 '22 11:11

Ryley