Background controls the drawing of the charts background. It is created by Chart as its child. It can be retrieved from a Chart object using the Chart.Background property.
The fill area attributes in the Background node determine how the background is drawn (see Fill Area Attributes).
The attribute FillType has the global default value of FILL_TYPE_SOLID. The attribute FillColor attribute is set to Color.White in this node.
To set the background to a solid color:
set the attribute FillType to FILL_TYPE_SOLID, and
set the attribute FillColor to the desired color.
For example the following code sets the background to pink. To view chart in color please see the online documentation.
using Imsl.Chart2D;
using System.Drawing;
public class SampleBackgroundSolid : FrameChart {
public SampleBackgroundSolid() {
Chart chart = this.Chart;
chart.Background.FillType = ChartNode.FILL_TYPE_SOLID;
chart.Background.FillColor = Color.Pink;
AxisXY axis = new AxisXY(chart);
double[] y = {4, 2, 3, 9};
new Data(axis, y);
}
public static void Main(string[] argv) {
System.Windows.Forms.Application.Run(new SampleBackgroundSolid());
}
}
To set the background to a color gradient:
set the attribute FillType to FILL_TYPE_GRADIENT, and
set the attribute Gradient to the desired color gradient specification.
For example the following code uses a yellow-to-red vertical gradient for the background setting. See Fill Area Attributes for more information on gradients.
using Imsl.Chart2D;
using System.Drawing;
public class SampleBackgroundGradient : FrameChart {
public SampleBackgroundGradient() {
Chart chart = this.Chart;
chart.Background.FillType = ChartNode.FILL_TYPE_GRADIENT;
chart.Background.SetGradient(Color.Yellow, Color.Yellow,
Color.Red, Color.Red);
AxisXY axis = new AxisXY(chart);
double[] y = {4, 2, 3, 9};
new Data(axis, y);
}
public static void Main(string[] argv) {
System.Windows.Forms.Application.Run(
new SampleBackgroundGradient());
}
}
To set the background to a color pattern:
set the attribute FillType to FILL_TYPE_PAINT, and
set the attribute FillPaint to the desired pattern.
For example the following code sets the background to yellow/orange checkerboard pattern. See Fill Area Attributes for more information on patterns.
using Imsl.Chart2D;
using System.Drawing;
public class SampleBackgroundPaint : FrameChart {
public SampleBackgroundPaint() {
Chart chart = this.Chart;
chart.Background.FillType = ChartNode.FILL_TYPE_PAINT;
Brush brush = FillPaint.Checkerboard(
24, Color.Yellow, Color.Orange);
chart.Background.SetFillPaint(brush);
AxisXY axis = new AxisXY(chart);
double[] y = {4, 2, 3, 9};
new Data(axis, y);
}
public static void Main(string[] argv) {
System.Windows.Forms.Application.Run(
new SampleBackgroundPaint());
}
}
PHONE: 713.784.3131 FAX:713.781.9260 |