DrawRect takes integers

We can only wish screen technology continues to improve until screen resolution starts approximating that of printers, which is commonly today at a minimum of 600 dpi. We are talking over 8x, not to mention the 1200 dpi of many color printers. Our current Retina is still far away.

Until then, optical rendition will be the only game in town.

Hey I got sidetracked off my project for a bit… this is interesting discussion but slightly off my topic of making a bar chart fit the exact width of a given graphic so that there is not “deadspace” at the end.

The one suggestion is to increase a certain number of bars 1 pixel each until the “remainder” is used up.
I will try that and see how it goes. Thanks for the suggestion.

Have you tried to make your charts using other software like Excel, LibreOffice, etc. to know how they deal with this problem ?

[quote]The one suggestion is to increase a certain number of bars 1 pixel each until the “remainder” is used up.
I will try that and see how it goes. Thanks for the suggestion.[/quote]

I assume under ideal conditions, the bars should all be the same width?

If so, the

basewidth =   graphwidth \\ numberofbars

Lets say the graphwidth is 328 and the bars are 20
The base width of bar is therefore 16

If you draw 20 bars of 16 wide, there is an 8 pixel gap, which you can know in advance using:

gap = graphwidth mod basewidth //= 8

So 8 of the bars need an extra pixel

You can distribute that extra pixel while drawing using MOD a number of ways
heres one possible


dim occurs as integer
dim used as integer
occurs = numberofbars / gap

for x = 0 to bars-1

if x mod occurs  = 0   and used <> gap then
used = used +1
g.fillrect   startx,starty, endx + basewidth +1, endy
else
g.fillrect   startx,starty, endx + basewidth, endy
end if

next

Thanks for the details but I had already coded that based on [quote=264511:@Thom McGrath]Thom McGrath’s response.[/quote]

Excellent help fellas.

I got it working like a champ… and it looks great!
Have a fabulous weekend.