Table of Contents

ExcelChart Class

Information for a chart inside a sheet or an object.

Syntax

Namespace: FlexCel.Core

public abstract class ExcelChart: IEmbeddedObjects

Methods

Name Description
AddAutoShape Adds an autoshape to an existing embedded chart. Note that the coordinates for the shape are in chart coords, meaning that only row1, row2, col1 and col2 are used, and they represent the percentage in 1/4000 of the coordinate.
So 0 means the top and left of the parent chart, and 4000 means the bottom and right of the parent chart.
AddImage Overloaded
AddImage(TUIImage, TImageProperties)
AddImage(Byte[], TImageProperties)
AddImage(Stream, TImageProperties)
AddImage(String, TImageProperties)
AddImage(Byte[], TXlsImgType, TImageProperties)
AddImage(Stream, TXlsImgType, TImageProperties)
AddImageAlternate Adds an image to the active sheet.
Currently this method is only needed for SVG images, since SVG images are stored as both PNG and SVG inside the xlsx file. This method allows you to supply both images.
AddSeries Adds a series to the chart.
AddSubchart Adds a new subchart to the existing chart. Note that if the current active subchart is empty, this method will not add a new subchart, but replace the empty one. In that case, SubchartCount won't change.

This method only works in xlsx files, not xls.
ClearImage Overloaded
ClearImage(Int32)
ClearImage(Int32, Boolean, String)
DeleteImage Overloaded
DeleteImage(Int32)
DeleteImage(Int32, Boolean, String)
DeleteObject Overloaded
DeleteObject(Int32)
DeleteObject(Int32, String)
DeleteSeries Deletes the series at position index.
GetBubbleSeries Returns the bubble definition for a series when in a bubble chart.

GetChartAxis Returns the axis information for this chart. Note that this might be more than one, if the chart has a secondary axis.
GetChartLegend Information about the Legend of the chart.
GetDataLabels Returns all the labels for the chart. Note that Axis have their labels defined inside their own definition.
GetDataLabelsRange Returns the range of cells for a "Label Contains: " "Value from Cells" option in the labels.
Note that for this to work, you also need to use the string [CELLRANGE] in the label definition.
GetImage Returns an image and its type.
Note that for SVG images, xlsx files store both a PNG and SVG image. In those cases, for backward compatibility reasons, this method will return the PNG image. To get the SVG, call GetImageAlternate
GetImageAlternate Returns an image and its type. Currently this method is the same as GetImage for all images except SVG.
For SVG images, xlsx files store both a PNG and SVG image. In those cases, this method will return the SVG image. To get the PNG, call GetImage
GetImageProperties Overloaded
GetImageProperties(Int32)
GetImageProperties(Int32, Boolean, String)
GetObjectProperties An object embedded inside a chart.
GetSeries Returns a series definition.
GetSeriesInSubchart Returns a series definition for a given subchart. Note: This method only works in xlsx files.
GetShapeLinkedCell Returns the cell that is linked to the shape or image. If the object isn't linked, this method will return null.
Note that when you change the value in the cell linked to this object, the value of the object will change.
Also note that this method applies to shapes like a rectangle or circle, or an image. Objects like a combobox won't be reported by this method.
GetTitle Returns the title of the chart.
GetTrendline Gets a trendline for a chart. This method is only implemented for xlsx charts.
HasImageAlternate Returns true if the image has an alternate representation. This currently happens only with SVG images, which have a PNG base and an SVG alternate. If the image has an alternate, you can get the data with GetImageAlternate
ImageIndexTo​Object​Path Returns the absolute object path for an image, given an image index. Note that this method can be slow if there are many objects in the file.
Whenever possible, prefer the methods that take directly an imageIndex instead of converting the imageIndex to an objectPath.
RemoveChartLegend Removes the Legend from the chart.
SeriesInSubchart Returns the number of series on each subchart. Note that this property only works in xlsx files: In xls files it will always return 0.
SetBubbleSeries Sets a Series value. Note that for xlsx charts, this will change the **data range** and the **options** of the series. If you only want to change the data range, pass null options to the method.
SetChartAxis Sets the options for either the primary or secondary pair of axis.
SetChartLegend Sets the legend properties.
SetChartOptions Sets the chart options of a specific subchart inside the chart. Note that while a chart can have multiple subcharts inside (for example one pie subchart and one line subchart), normally there is only one subchart and so the SubchartPos parameter is normally 1.
SetDataLabels Changes the labels for the chart. You should always get the values with GetDataLabels, modify them, and change them back with this method.
SetDataLabelsRange Sets the range of cells for a "Label Contains: " "Value from Cells" option in the labels.
Note that for this to work, you also need to use the string [CELLRANGE] in the label definition.
SetObjectText Overloaded
SetObjectText(Int32, String, String)
SetObjectText(Int32, String, TRichString)
SetObjectText(Int32, String, TDrawingRichString)
SetSeries Sets a Series value. Note that for xlsx charts, this will change the **data range** and the **options** of the series. If you only want to change the data range, pass null options to the method.
SetSeriesInSubchart Sets a Series value. Note that for xlsx charts, this will change the **data range** and the **options** of the series. If you only want to change the data range, pass null options to the method.
SetShapeLinkedCell Links the shape or image to a cell, if the shape can be linked. To unlink the cell, make linkedCell null.
Note that this method applies to shapes like a rectangle or a circle, or an image, not to the link of a forms object like a combobox or a radiobutton.
SetTitle Sets the title of the chart. This method is only implemented for xlsx charts.
SetTrendline Gets a trendline for a chart. This method is only implemented for xlsx charts.

Properties

Name Description
Background Returns the chart background if there is one defined, or null if there is none.
BackWall The wall at the back of a 3D-chart
Chart3DOptions Returns the 3D options for the chart, or null if the chart isn't 3D.
ChartOptions Returns the type of chart and the options specific for that kind of chart.
There might be more than one ChartOptions returned, since you can mix more than one type of chart on a simple chart. (One for each series). You need to look at the series ChartOptionsIndex to know to which one it refers.
DefaultAxisFont Returns the default font for Axis in the chart that do not have a font defined.
DefaultAxisTitleFont Returns the default font for Axis title in the chart that do not have a font defined.
DefaultFont Returns the default font for all text in the chart that do not have a font defined.
DefaultLabelFont Returns the default font for all labels in the chart that do not have a font defined.
DefaultTitleFont Returns the default font for Title in the chart that do not have a font defined.
Floor The floor in a 3D-chart.
ImageCount The number of images in the chart.
IsXlsxChart Returns true if the chart is defined inside an xlsx file instead of xls. While both charts in xls and xlsx files are mostly compatible, some behaviors can change depending on what type of chart this is. For example, if the first series in an xls chart is pie, it won't draw gridlines even if the second isn't. In xlsx charts, if another series is not pie, Excel will draw the gridlines.
ObjectCount The number of objects that are embedded inside this chart.
PlotArea Returns or sets the plot area definition for the chart. Note: Setting the plot area only works in xlsx files.
PlotEmptyCells Defines how null cells will be plotted on the chart.
SeriesCount Returns the count of series on this chart.
ShowDataInHidden​Rows​AndCols Defines if hidden rows and columns will be used when plotting values.
SideWall The wall next to the y-axis in a 3D-chart.
Style This is a number between 1 and 48 which defines many standard properties for the chart, like the default line width for the series or the legend.
The default style is 2.
SubchartCount A chart can have multiple subcharts inside: For example one bar chart and one pie chart.
This method returns how many subcharts you have inside the main chart. Note that this property only works in xlsx files: In xls files it will always return 1.