niyaz18 / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

.7 bar graph overlaps grid border #494

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 reported on code.google.com by gcph...@gmail.com on 24 Mar 2011 at 11:37

Attachments:

GoogleCodeExporter commented 8 years ago
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.

Original comment by olau%iol...@gtempaccount.com on 4 Apr 2011 at 10:37

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 8 May 2012 at 7:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

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.

Thanks,
Derrick

Original comment by drrc...@gmail.com on 14 Jul 2012 at 10:51