ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  BoxWhiskerLayer.setDataGap(0)
Posted by Michael Opitz on Jun-10-2011 16:43
Attachments:
Hi Peter,

I tried to set the data gap of a BoxWhiskerLayer to 0, like you do in example http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=BoxWhiskerLayer+bar+gap&thread=1078362171#N1078379696

But as you can see in your example, the gap between the bars is not 0. That gets very annoying, if I want to show a lot of data points. I need to display a data point for every day in a year, but i am missing two pixels per datapoint so I see only (at most!) one pixel per data point even if my chart is 1100 pixels wide.

How do I set the bar gap to "really" be 0?

Regards,
Michael
val_per_day.PNG

  Re: BoxWhiskerLayer.setDataGap(0)
Posted by Peter Kwan on Jun-10-2011 23:12
Hi Michael,

Apart from the given bar gap, ChartDirector has 2 constraints when it determines the width of the bars:

(a) All bars must be of the integral width. If one bar is 2 pixels wide, and another bar is 3 pixels wide (50% thicker than the other), some people may find it "annoying". So it is better to ensure all bars are of the same width.

For example, if there are 300 bars, but the plot area is 700 pixels wide, there is no way that all bars can be of same width and still cover the plot area with no gap or no overlapping. For this case, if the bar gap is 0, ChartDirector will set the bar to 3 pixels (the widest possible without overlapping), and there will still be gaps.

It means if you really want the bar gap to be zero, the plot area width must be exactly divisible by the number of bars. For your case, you must set it to 3 * N, where N is the njmber of days in the year.

(b) All bars must be symmetrial along the central whisker line, otherwise some people may also find it annoying. That means if the whisker width is an odd number (like 1 pixel), the bar width must also be an odd number (1, 3, 5, 7, ...).  You can override this if you set the bar width directly using BaseBoxLayer.setBarWidth.

Hope this can help.

Regards
Peter Kwan