When you zoom in into the LineGraph with Band Demo (V5.0.9) the Band exceeds the borders to the left and right, the background color of the graph doesn't.
Yes, this is by design. The "Band" is actually a GraphObj which is not constrained to the chart area by default. You can clip it to the chart area by using:
box.IsClippedToChartRect = true;
However, this will still allow the "band" to be smaller than the chart area. The best way to handle it is to use a hybrid coordinate system so that the Y coordinate of the band is in user scale units, but the X coordinate of the band is in chartfraction units. Setting the chart fraction to x1=0 and width=1.0 will make the band always equal the width of the chart rect, no matter what zoom setting you use.
For example:
BoxObj box = new BoxObj( 0.0, 100, 1.0, 30, Color.Empty, Color.FromArgb( 150, Color.LightGreen ) );
box.Location.CoordinateFrame = CoordType.XChartFractionYScale;
John
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1842985
Originator: YES
File Added: LineBand.jpg
Logged In: YES
user_id=1842985
Originator: YES
and it happens also when you zoom out...
Logged In: YES
user_id=957634
Originator: NO
Yes, this is by design. The "Band" is actually a GraphObj which is not constrained to the chart area by default. You can clip it to the chart area by using:
box.IsClippedToChartRect = true;
However, this will still allow the "band" to be smaller than the chart area. The best way to handle it is to use a hybrid coordinate system so that the Y coordinate of the band is in user scale units, but the X coordinate of the band is in chartfraction units. Setting the chart fraction to x1=0 and width=1.0 will make the band always equal the width of the chart rect, no matter what zoom setting you use.
For example:
BoxObj box = new BoxObj( 0.0, 100, 1.0, 30, Color.Empty, Color.FromArgb( 150, Color.LightGreen ) );
box.Location.CoordinateFrame = CoordType.XChartFractionYScale;
John