Skip to content
This repository

.7 bar graph overlaps grid border #573

dnschnur opened this Issue September 28, 2012 · 2 comments

1 participant

David Schnur
David Schnur

Original author: (March 24, 2011 23:37:15)

hi all

just started using flot and noticed in testing and in the demo that the bar graphs borders, by default, over-lap the outside border of the grid

this looks pretty ugly

i had to modify the drawBar() function with some hacks to make mine look fine:

lines 2053 threw 2055
left = .02+ x + barLeft;
right = .02+x + barRight;
bottom = .02+b;

line 2062
bottom = 1+tmp;

Now the borders do not over-lap and it looks much cleaner

Original issue:

David Schnur

From on April 04, 2011 10:37:10
Hi, if you're interested in helping out, I think the proper way to fix this is adjusting the bars with half the line width.

David Schnur

From on July 14, 2012 22:51:03

It would seem ideal to modify barLeft and barRight where they are initialized in drawBarSeries, but these use units of the x-axis. This makes it difficult to adjust for pixel differences. The units must be converted to pixels at some point however, so barring problems with fractional behavior, the fix should be relatively straightforward. Conversion is done by the p2c method. I just need to fully understand it.

The adjustments must take into account the linewidth set, as well as the bar width. But since you can set the bar width anyway, what's the point? Should flot really be scaling down all the other graphs for this reason?

One other possibility is to adjust only if the bar outline would touch the outside grid. This would render the first bar a slightly lesser width than others in the series, though, so this solution is unappealing.

You could also simply omit the offending border outline. It doesn't look too bad.

Yet another way is to offset the axis itself and leave everything else alone. This seems.. complex.

Overall, though, I don't know if dynamically adjusting the area of bar graphs is a good idea. Will work on this next week.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.