Introduction
  Welcome
  The Web Reporting Solution
  What is ExcelWriter?
  Features and Benefits
  New in This Version  V4
  Requirements
  Edition Differences
  Frequently Asked Questions
  Troubleshooting

Quick Start
  Creating Your First Spreadsheet
  Adding a Formula
  Adding Formatting
  Importing from a Database

Features In Depth
  Addressing Cells
  Setting Values
  Output Options
  Adding Charts
  Reading an Existing Spreadsheet
  Modifying an Existing Spreadsheet
  The Range Object
  Template Spreadsheets
  How to Use Templates
  ExcelApp.Open vs. ExcelTemplate
  Using ExcelTemplate with PivotTables
  Templates and Charts
  Reliable Spreadsheet Download  V4
  Page Setup
  Formatting Headers & Footers
  Protecting your Worksheet
  Multilingual Support  V4
  XML Import

HotCell Technology  V4
  What is HotCell Technology?
  Upload Example
  Advanced POST Example
  Advanced Upload Example

Programmer's Reference
  Object Model
      ExcelTemplate Object
      ExcelApplication Object
         3DProperties Object
         Area Object
         Axis Object
         Cells Object
         Cell Object
         Charts Object
         Chart Object
         ChartFrame Object
         Font Object
         Line Object
         PageSetup Object
         Pictures Object
         Picture Object
         Range Object
         SeriesCollection Object
         Series Object
         Style Object
         Worksheets Object
         Worksheet Object
  Formula Functions
  Formula Calculation Operators
  Formatting Codes
  Chart Codes

Installation
  Quick Installation
  Configuring IIS
  Security Considerations

External Links
  ExcelWriter Home Page
  Technical Support
  ExcelWriter Demos
  SoftArtisans Home Page
  E-mail General Questions
  E-mail Technical Support
  Legal Information

Object Model ExcelApplication ExcelTemplate Worksheets Worksheet Cells Cell Range Style Font Charts
Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area Pictures Picture PageSetup


The Chart Object (IChart)

The Chart object represents a single chart in a Charts collection.

To create a Chart object, use Charts.Add, as in the following example.

Set Chart = charts.add(1,3,3,0,15,7)

Chart Methods and Properties

Chart Methods and Properties
AutoScale*

If AutoScale is set to True, Excel will automatically resize a chart's text when the chart is resized. If AutoScale is set to False, Excel will not automatically scale a chart's text.

Set Chart = Charts.add(0,3,3,0,15,7)
chart.autoscale = false
chart.categoryaxis.title = "Category Axis"
Set Font14 = xlw.CreateFont
Font14.size = 14
chart.categoryaxis.title.textfont = Font14
		

Top

BopPopGapSize*

Sets or returns the size of the gap between,

Note: Excel 95 does not support this feature.

By default, BopPopGapSize is set to 50% of the width of the second pie, or of the bar. The following example increases the gap size to 100%.

chart.BopPopGapSize = 100
	

Top

BopPopSecondPieSize*

Sets or returns the size of the second pie in a pie of pie chart. By default, BopPopSecondPieSize is set to 50% of the first pie. The following example increases the second pie's size to 75% of the first pie's size.

chart.BopPopSecondPieSize = 75
		

Note: Excel 95 does not support this feature.

Top

BopPopSplitType*

Sets or returns how data will be split in the bar of a bar of pie chart, or second pie of a pie of pie chart. Use BopPopSplitType in conjunction with BopPopSplitValue. Assign BopPopSplitType by name or number, according to the following table.

NameNumber  Definition
saxlsBopPopPosition  0    The bar or second pie will contain the chart's last n data points, where n is the value assigned to BopPopSplitValue.
saxlsBopPopValue  1    The bar or second pie will contain all data points with values less than n, where n is the value assigned to BopPopSplitValue.
saxlsBopPopPercent  2    The bar or second pie will contain data points with values less than n% of the total data series in the chart, where n is the value assigned to BopPopSplitValue.
saxlsBopPopCustom  3    The bar or second pie is customizable. To customize, drag data points between plot areas.

Note: Excel 95 does not support this feature.

Example: The following will generate a pie of pie chart, with the second pie containing the last 2 data points.

set chart = ws.Charts.Add(saxlsPieChart,2,3,0,15,7) 
chart.BopPopSplitType = saxlsBopPopPosition
chart.BopPopSplitValue = 2
		

Top

BopPopSplitValue*

Sets or returns a value that determines which of a chart's data points will be included in the bar of a bar of pie chart, or second pie of a pie of pie chart. BopPopSplitValue represents a data point value, data point position, or data point percentage, depending on the value of BopPopSplitType.

If BopPopSplitType = BopPopSplitValue represents
saxlsBopPopPosition          The number of last data points that will be included in the bar or second pie. For example, if BopPopSplitValue is set to 3, the bar or second pie will contain the last 3 data points in the pie's data series.
saxlsBopPopValueThe value of a data point. Only data points with values less than this value will be included in the bar or second pie. For example, if BopPopSplitValue is set to 15, the bar or second pie will contain all data points with values less than 15.
saxlsBopPopPercentA data point's percentage value. Only data points with a percentage less than this value will be included in the bar or second pie. For example, if BopPopSplitValue is set to 40, the bar or second pie will contain all data points with percentage values less than 40%.

Note: Excel 95 does not support this feature.

Example: The following will generate a pie of pie chart, with the second pie containing all data points that equal less than 40% of the total data series.

set chart = ws.Charts.Add(saxlsPieChart,2,3,0,15,7) 
chart.BopPopSplitType = saxlsBopPopPercent
chart.BopPopSplitValue = 40
		

Top

CategoryAxis

Returns an Axis object, representing the chart's X axis. The properties of CategoryAxis are, AxisCrossesMidCategory, AxisLine, LabelFont, LabelPosition, MajorGridline, MajorIncrement, MajorTickType, MinorGridline, MinorIncrement, MinorTickType, Number, Title, ValuesInReverseOrder, Wall3D, and Wall3DBorder.

chart.categoryaxis.title = "Category Axis"
		

Top

ChartArea

Returns a ChartFrame object, representing the chart area in the worksheet. ChartArea is the area defined by
Charts.Add, that is, the entire area within the worksheet assigned to the chart. The properties of ChartArea are, Area, Border, HasShadow, Height, Text, TextFont, TextHorizontalAlignment, TextRotationAngle, TextVerticalAlignment, Width, X, and Y.

The following example demonstrates applying a shadow effect to the ChartArea border.

chart.chartarea.hasshadow = true
		

Top

DataTable*

Returns a ChartFrame object, representing a chart's data table. The properties of DataTable are, Area, Border, HasShadow, Height, Text, TextFont, TextHorizontalAlignment, TextRotationAngle, TextVerticalAlignment, Width, X, and Y.

Note: Excel 95 does not support this feature.

The following example demonstrates applying a horizontal stripe pattern to a chart's data table.

chart.datatable.area.pattern = 5
		
See also, ShowDataTable.

Top

DataTableHasHorizontalBorders*

When set to True, the chart's data table will display horizontal grid lines. DataTableHasHorizontalBorders is set to True by default. To hide horizontal grid lines, use,

chart.DataTableHasHorizontalBorders = false
		
See also, ShowDataTable. Note: Excel 95 does not support this feature.

Top

DataTableHasVerticalBorders*

When set to True, the chart's data table will display vertical grid lines. DataTableHasVerticalBorders is set to True by default. To hide vertical grid lines, use,

chart.DataTableHasVerticalBorders = false
		
See also, ShowDataTable. Note: Excel 95 does not support this feature.

Top

DataTableShowsSeriesKeys*

When set to True, the chart's data table will include legend keys next to the series titles. DataTableShowsSeriesKeys is set to True by default. To hide legend keys, use,

chart.DataTableShowsSeriesKeys = false
		
See also, ShowDataTable. Note: Excel 95 does not support this feature.

Top

FillSurfaceArea

Determines whether the surface area of a Surface chart (type 5), will be filled or appear transparent. FillSurfaceArea is set to 1 (enabled) by default. To display a transparent surface area, set FillSurfaceArea to 0, as follows.

chart.fillsurfacearea = 0
		

Top

Legend

Returns a ChartFrame object, representing the chart legend. The properties of Legend are, Area, Border, HasShadow, Height, Text, TextFont, TextHorizontalAlignment, TextRotationAngle, TextVerticalAlignment, and Width.

The following example demonstrates applying a horizontal stripe pattern to the legend box.

chart.legend.area.pattern = 5
		

Top

LegendLocation

Determines the position of the legend in relation to the chart's plot area. LegendLocation has six possible values. Assign LegendLocation by name or number, according to the following table.

saxlsObjectBottom0
saxlsObjectCorner1
saxlsObjectTop2
saxlsObjectRight (default)3
saxlsObjectLeft4
saxlsObjectNotDocked7

Note: LegendLocation and the pair of Chartframe properties Height and Width are mutually exclusive. Use either LegendLocation or Height and Width.

The following will display the legend to the left of the chart's plot area.

chart.legendlocation = 4
		

Top

LegendVertical

Displays the legend vertically, when set to True. LegendVertical is set to True by default. To display the legend
horizontally, set LegendVertical to False, as follows.

chart.legendvertical = false
		

Top

Move

Moves the chart to a specified location. Move takes four parameters that determine the new position of the chart in the worksheet:

chart.move UpperLeftColumn, UpperLeftRow, LowerRightColumn, LowerRightRow

To re-position your chart at upper-left corner J9 and lower-right corner V16, use,

chart.move 10,9,22,16
		

Top

PlotArea

Returns a ChartFrame object, representing the chart's plot area, that is, the area of the chart itself. The properties of PlotArea are, Area, Border, HasShadow, Height, Text, TextFont, TextHorizontalAlignment, TextRotationAngle, TextVerticalAlignment, Width, X, and Y.

The following example applies a diagonal stripe pattern to the plot area.

chart.plotarea.area.pattern = 7
		

Top

RectangularCorner

Determines whether the chart area will be sharp-cornered or round-cornered. By default, RectangularCorner is set to 0, and chart area corners are angular. For round corners, set RectangularCorner to 1, as follows.

chart.RectangularCorner = 1
		

Top

SeriesCollection

Returns a SeriesCollection object representing the set of data series in the chart. The methods and properties of SeriesCollection are, Add, CategoryData, and Item.

Top

SetChartType

Sets the chart's type and subtype. SetChartType takes two parameters:

chart.SetChartType ChartType, Subtype
		

Consult Chart Codes to select ChartType (pie, column, etc.) and SubType. The following example will produce a 3-D column chart.

chart.SetChartType 0,6
		

Top

ShowDataTable*

When set to True, will display a data table in place of the category axis' tick mark labels, in some chart types. A data table displays the data from which the chart was generated.

Note: Excel 95 does not support this feature.

Example:

chart.showdatatable = true
		

Top

ShowHorizontal

When set to True, will display columns horizontally, that is, will convert a column chart to a bar chart. ShowHorizontal is False by default. To set ShowHorizontal to True, use,

chart.showhorizontal = true
		

Top

ShowLegend

When set to True, displays the chart legend. When set to False, hides the chart legend. ShowLegend is True by default. To set ShowLegend to False, use,

chart.showlegend = false
		

Top

ShowValueAsPercent

When set to True, displays ValueAxis values as percents. ShowValueAsPercent is False by default. To enable ShowValueAsPercent, use,

chart.showvalueaspercent = true
		

Top

SizeOfCenterHole*

Sets or retrieves the size of the center hole of a doughnut chart. By default, SizeOfCenterHole is set to 20% of the doughnut size. The following example demonstrates setting the hole size to 50%.

chart.sizeofcenterhole = 50
		

Top

SliceDistanceFromCenter

For exploded pie charts. Sets or returns the distance of slices from the chart's center. SliceDistanceFromCenter is set to 20 by default. The following will set SliceDistanceFromCenter to 100.

chart.slicedistancefromcenter = 100
		

Top

SpaceBetweenBars

Sets or retrieves the space between data series bars. SpaceBetweenBars is 0 by default. The following example demonstrates setting SpaceBetweenBars to 50.

chart.SpaceBetweenBars = 50
		

Top

SpaceBetweenCategories

Sets or retrieves the space between categories in column and bar charts. The following example demonstrates setting SpaceBetweenCategories to 50.

chart.SpaceBetweenCategories = 50
		

Top

StackDisplayedValues

Stacks series values, when set to True.

The following example demonstrates enabling StackDisplayedValues.

chart.StackDisplayedValues = true
		

Top

Subtype

Returns the chart's subtype code. For a list of chart subtypes and their codes, see Chart Codes.

The following example demonstrates retrieving a chart's subtype code.

ChartSubtype = chart.subtype
		

Top

Title

Returns a ChartFrame object, representing the chart's title. The properties of Title are, Area, Border, HasShadow, Height, Text, TextFont, TextHorizontalAlignment, TextRotationAngle, TextVerticalAlignment, Width, X, and Y.

The following example demonstrates applying a horizontal stripe pattern to the title frame.

chart.title.area.pattern = 5
		

Top

Type

Returns the chart's type code. For a list of chart types and their codes, see Chart Codes.

The following example demonstrates retrieving a chart's type code.

ChartType = chart.type
		

Top

ValueAxis

Returns an Axis object, representing the chart's Y axis. The properties of ValueAxis are, AxisLine, CategoryAxisCrossMaxValue, CategoryCrossingValue, LabelFont, LabelPosition, LogarithmicScale, MajorGridline, MajorIncrement, MajorTickType, MaxValue, MinorGridline, MinorIncrement, MinorTickType, MinValue, Number, Title, ValuesInReverseOrder, Wall3D, and Wall3DBorder.

The following example demonstrates setting a title for the value axis.

chart.valueaxis.title = "Value Axis"
		

Top

View3D

Returns a 3DProperties object representing the properties of a three-dimensional chart. The properties of View3D are, ChartDepth, DistanceFromEyeToChart, ElevationAngle, PlotVolumeHeight, RotationAngle, SeriesGapDepth, Show3D, Stack3DColumns, UseAutoScaling, UsePerspectiveTransform, and ZAxis.

To set a View3D object, use,

set View3D = chart.view3d
		

Top

*This feature is not available in ExcelWriterSE, ExcelWriterLE, and ExcelWriterFree.


Object Model ExcelApplication ExcelTemplate Worksheets Worksheet Cells Cell Range Style Font Charts
Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area Pictures Picture PageSetup


Copyright © 2003, SoftArtisans, Inc.