Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Windows
 Charting and Real-Time Graphics Tools for Windows
 Gaps/overlap between histogram bars
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TonyGrayDSI

14 Posts

Posted - 27 Jul 2005 :  13:11:28  Show Profile  Reply with Quote
I'm drawing histograms using WGBargraph. I find that even though my bar centers and widths defined in WGDefineDataSetVB should make the bars exactly adjacent to one another, when the chart is drawn there are sometimes little gaps between the bars, other times the bars overlap one another. If the user resizes the window and plays with the aspect ratio, it's possible to get both of these conditions out of the same plot, so it isn't the dataset.

Is there any way to control the scaling (pixel based scaling, for example) that would guarantee that adjacent bars always came out just touching each other?

Edited by - TonyGrayDSI on 27 Jul 2005 13:16:53

quinncurtis

1164 Posts

Posted - 27 Jul 2005 :  14:39:41  Show Profile  Reply with Quote
What you are seeing is pixel rounding, which is always going to occur when physical coordinates based on floating point numbers are translated into pixel coordinates using integers. The starting point and width of the bar is going to vary +- one pixel, depending on how it maps into the current pixel coordinate system, which is causing the effect you describe. It is going to be most notable if you try and match up the edges of the bars exactly, as you are doing. There is nothing that we can suggest that will create a perfect fit for every possible window dimension, as you describe. You are better off leaving a larger gap, 5 pixels for example, between the bars, that way changes in the bar width resulting from changes in the window size will be less noticeable.
Go to Top of Page

TonyGrayDSI

14 Posts

Posted - 27 Jul 2005 :  15:01:28  Show Profile  Reply with Quote
For histograms (as opposed to bar charts) the bars need to be exactly adjacent to be correct since the X axis represents a continuous variable. It sounds like this isn't possible, too bad.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07