Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
.7 bar graph overlaps grid border #573
Original author: gcph...@gmail.com (March 24, 2011 23:37:15)
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
Now the borders do not over-lap and it looks much cleaner
Original issue: http://code.google.com/p/flot/issues/detail?id=494
From drrc...@gmail.com 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.