Charts are used to display series of numeric data in a graphical format to make it easier to understand large quantities of data and the relationship between different series of data.
Supported chart types
GemBox.Spreadsheet supports following chart types:
Additionally, GemBox.Spreadsheet supports following chart groupings:
Manipulating charts with GemBox.Spreadsheet component is easy and straightforward. See chart example how to create chart and select data for it using GemBox.Spreadsheet.
Every chart is composed of components.
All charts can have title and legend.
Some charts, for example, have axes, and others, like PieChart don't. Most charts have horizontal axis of type CategoryAxis (or DateAxis in case when categories are dates) and vertical axis of type ValueAxis, but some, like BarChart, have the opposite.
An Axis can have a title, labels, tick marks, gridlines, etc.
Following diagram outlines chart components and links each chart component to its corresponding member in GemBox.Spreadsheet API so you can easily locate each member by following the link:
To view code how to set/modify chart components using GemBox.Spreadsheet, see chart components example.
Export drawing (picture, chart, etc.)
An instance of ExcelDrawing (base class for pictures, charts, etc.) can be exported to a file or a stream, be printed or be embedded into WPF application.
To enable these operations, first drawing has to be formatted - its components must be measured and arranged. For example, chart components (chart title, axis titles, legend and axes) must be measured and arranged, before they can be rendered. This is done by calling one of the Format() method overloads which returns instance of FormattedExcelDrawing which contains export methods.
After ExcelDrawing is formatted, additional changes made on it are not propagated to FormattedExcelDrawing instance, instead, new instance should be obtained by formatting ExcelDrawing again.
FormattedExcelDrawing enables the following functionalities:
- Export drawing to PDF, XPS and image file formats.
Export can be made to a file, a stream or an ASP.NET response object (streamed to client's browser).
When exporting entire workbook or worksheet into HTML format, charts are exported as PNG images using the same functionality described in this section.
To view chart export example code, go to chart components example and set its last parameter Save to Chart.
Support level for PDF, XPS and image formats
Exporting a chart to a fixed document file format, such as PDF and XPS, and to image formats is accomplished with GemBox.Spreadsheet internal renderer that is commonly used for all formats mentioned.
This means that PDF, XPS and image formats share the same level of support for chart features, since they are all rendered in the same way.
The following list contains GemBox.Spreadsheet.Charts API members that are, currently, not supported when exporting to PDF, XPS and image formats:
- ChartGrouping fields Stacked and PercentStacked, except for ColumnChart and BarChart for which Stacked grouping is supported.
- ReverseOrder property.
- AxisLabelsPosition field High.
- MultiLevelLabels property.
Support for these members will be added in future versions of GemBox.Spreadsheet based on customer feedback.
Following charts types are currently not supported by GemBox.Spreadsheet API:
- 3D charts (Column, Bar, Line, Area and Pie).
- Stock charts.
- Surface charts.
- Doughnut charts.
- Bubble charts.
- Radar charts.
Support for these chart types will be added in future versions of GemBox.Spreadsheet based on customer feedback.
Although not supported by GemBox.Spreadsheet API, these chart types are still preserved, so you don't lose any chart when loading and saving to XLSX or XLSB file format. There are even techniques to update data for preserved chart when workbook is opened in MS Excel as shown in chart preservation example.