Each data series belongs to a certain chart area. By default, this is a ChartArea object returned by Chart.ChartArea . You can change its properties or create new chart areas, add them to the collection returned by Chart.ChartAreas and assign data series to them.
Creating a Chart Area
If you need to create a new chart area, use its constructor that accepts the parent Chart object.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=90
Setting Up Axes
ChartArea contain primary and secondary X and Y axes. Each axis is represented by an Axis object that contains a number of properties controlling its look.
Axes of a chart are created automatically and you can access them via the AxisX , AxisY , AxisX2 , AxisY2 properties of the ChartArea object. You do not need to create Axis objects directly.
See the WorkingWithAxes topic to learn more about axes.
Setting Background
You can set up the ChartArea background by setting its background color or image.
Background Color
Use the BackColor property to set the background color of the chart area. If you want to make the background color gradient, set the GradientType property to a value different from GradientType.None and set the GradientBackColor property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=3
Background Image
The ChartType background image is represented by a BackImage object that can be get or set using the BackImage property.
The BackImage class provides several properties necessary to set up the background image. They include the path or URL to the image file, background transparent color and image position that is represented by the ImagePosition class. ImagePosition allows setting different types of image alignment including specifying custom position by setting a position rectangle.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=92
Setting a Custom Palette
You can specify a custom palette that is used by the chart area when drawing data series. Use the ColorPalette property that accepts or returns an array of colors serving as the palette.
There's also a possibility of specyfing a predefined palette. Set the PaletteType property to one of the PaletteType enumeration values. The default value is PaletteType.Aspose1.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=9
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=20
3D
ChartArea allows representing data series in 3D mode. To enable this option, set the IsThreeD property to true. ChartArea also provides other related properties to set up 3D view (all of them are valid only when 3D mode is on).
3D Depth
Get or set visual depth of a 3D chart using the ThreeDDepth property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=65
Perspective
Get or set a value that controls the 3D perspective of the chart using the Perspective property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=37
Angles
You can specify a 3D rotation angle in degrees around the X-axis or Y-axis using the AngleX and AngleY properties, respectively. The default value for the X-axis angle is 60 degrees and for the Y-axis angle is 30 degrees.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=93
Light Style
Get or set the type of 3D scene lighting using the LightStyle property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=37
3D Frame Width
Get or set a value that represents 3D frame width using the ThreeDFrameWidth property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=65
Clustered Mode
When the chart is 3D, you can display it in clustered mode. To achieve that, set the Cluster property to true. You can also set the relative width of the clusters using the ClusterWidthRate property. The default value of this property is 0.8F and the valid range is 0 < ClusterWidthRate <= 1.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=38
Setting a Legend Box
Each ChartArea may have a corresponding legend box represented by a LegendBox object that is returned or set using the ChartArea.LegendBox property.
The LegendBox class provides a couple of properties necessary for setting up a legend box. See the WorkingWithLegendBox topic for more details.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=1
Adding Titles
ChartArea may contain one or more titles each of which is represented by the Title class. This class provides several properties that declare its appearance. See the WorkingWithTitles topic for more information.
To add a chart title, create a new Title object, specify its properties, and add to the collection returned by the Titles property.
To remove a chart title, use one of the appropriate Titles collection methods.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=86
Setting a Position
Set the position of the chart area using the Position property. The units are pixels.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=77
Setting a Margin
You can make the margin of the chart area by setting the IsMargin property to true and control its value using the Margin property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=76
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=2
Controlling Transparence
You can control the transparency of the chart drawing using the Transparence property. The value of 1 indicates 100% transparency, the value of 255 indicates 0% transparency (solid colors).
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=15
Setting a Name
You can get or set the name of the chart using the Name property.
Example
http://www.aspose.com/Products/Aspose.Chart/Demos/CodeChart.aspx?GalleryItemId=90
Code Sample
[C#]
// Creating chart area
ChartArea chartArea = new ChartArea(chart);
// Setting background color
chartArea.BackColor = Color.Bisque;
// Setting custom palette
chartArea.PaletteType = PaletteType.HighContrast;
// Setting 3D mode
chartArea.IsThreeD = true;
// Setting transparence
chartArea.Transparence = 100;
// Setting name
chartArea.Name = "I'm a cool chart area";
[VB .NET]
' Creating chart area
Dim chartArea As ChartArea = New ChartArea(chart)
' Setting background color
chartArea.BackColor = Color.Bisque
' Setting custom palette
chartArea.PaletteType = PaletteType.HighContrast
' Setting 3D mode
chartArea.IsThreeD = True
' Setting transparence
chartArea.Transparence = 100
' Setting name
chartArea.Name = "I'm a cool chart area"
Clarifies working with axes.
10/28/2005 10:05:07 AM - -83.217.194.222
Clarifies working with legend box.
10/28/2005 10:39:47 AM - -83.217.194.222
Clarifies working with titles.
10/28/2005 10:49:18 AM - -83.217.194.222