Click or drag to resize
Charts

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.

The following sections contain information about charts in GemBox.Spreadsheet component:

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 sample how to create chart and select data for it using GemBox.Spreadsheet.

Chart Components

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:

Navigate to ExcelChart.Title propertyNavigate to ChartSeries.IsLegendEntryVisible propertyNavigate to ExcelChart.Legend propertyNavigate to ChartAxis.Title propertyNavigate to ChartAxis.Title propertyNavigate to ExcelChart.CategoryLabels propertyNavigate to ChartAxis.MajorGridlines propertyNavigate to ChartAxis.MajorGridlines propertyNavigate to ChartAxis.MinorGridlines propertyNavigate to ChartAxis.MinorGridlines propertyNavigate to ValueAxis.Maximum propertyNavigate to ValueAxis.Minimum propertyNavigate to ChartAxis.NumberFormat propertyNavigate to ValueAxis.MajorUnit propertyNavigate to ValueAxis.MinorUnit propertyNavigate to ChartAxis.MinorTickMarkType propertyNavigate to ChartAxis.MinorTickMarkType propertyNavigate to ChartAxis.MajorTickMarkType propertyNavigate to ChartAxis.MajorTickMarkType propertyChart Components

To view code how to set/modify chart components using GemBox.Spreadsheet, see chart components sample.

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 ExcelDrawingFormat method overloads which returns instance of FormattedExcelDrawing which contains export methods.

Note Note

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).

  • Print drawing.

  • Embed drawing into WPF application.

Note Note

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 sample 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:

Note Note

Support for these members will be added in future versions of GemBox.Spreadsheet based on customer feedback.

Preservation

Following charts types are currently not supported by GemBox.Spreadsheet API:

  • 3D charts (Column, Bar, Line, Area and Pie).

  • X Y (Scatter) charts.

  • Stock charts.

  • Surface charts.

  • Doughnut charts.

  • Bubble charts.

  • Radar charts.

Note Note

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 file format. There are even techniques to update data for preserved chart when workbook is opened in MS Excel as shown in chart preservation sample.