OpenXLSX 1.9.1
Loading...
Searching...
No Matches
OpenXLSX::XLChart Class Referencefinal

#include <XLChart.hpp>

Inheritance diagram for OpenXLSX::XLChart:
OpenXLSX::XLXmlFile

Public Member Functions

 XLChart ()
 Constructor.
 
 XLChart (XLXmlData *xmlData)
 Constructor from XLXmlData.
 
 XLChart (const XLChart &other)=default
 Copy Constructor.
 
 XLChart (XLChart &&other) noexcept=default
 Move Constructor.
 
 ~XLChart ()=default
 Destructor.
 
XLChartoperator= (const XLChart &other)=default
 Copy Assignment Operator.
 
XLChartoperator= (XLChart &&other) noexcept=default
 Move Assignment Operator.
 
XLChartSeries addSeries (const XLWorksheet &wks, const XLCellRange &values, std::string_view title="", std::optional< XLChartType > targetChartType=std::nullopt, bool useSecondaryAxis=false)
 Add a data series to the chart.
 
XLChartSeries addSeries (const XLWorksheet &wks, const XLCellRange &values, const XLCellRange &categories, std::string_view title="", std::optional< XLChartType > targetChartType=std::nullopt, bool useSecondaryAxis=false)
 
XLChartSeries addSeries (std::string_view valuesRef, std::string_view title="", std::string_view categoriesRef="", std::optional< XLChartType > targetChartType=std::nullopt, bool useSecondaryAxis=false)
 
XLChartSeries addBubbleSeries (std::string_view xValRef, std::string_view yValRef, std::string_view sizeRef, std::string_view title="")
 Add a bubble chart series with explicit X, Y, and size ranges.
 
XLChartSeries addBubbleSeries (const XLWorksheet &wks, const XLCellRange &xValues, const XLCellRange &yValues, const XLCellRange &sizes, std::string_view title="")
 
void setTitle (std::string_view title)
 Set the chart title.
 
void setStyle (uint8_t styleId)
 Set the built-in chart style ID (1–48).
 
void setLegendPosition (XLLegendPosition position)
 Set the legend position or hide it.
 
XLAxis xAxis () const
 Get the X-axis (typically bottom category axis).
 
XLAxis yAxis () const
 Get the Y-axis (typically left value axis).
 
XLAxis axis (std::string_view position) const
 
void setShowDataLabels (bool showValue, bool showCategory=false, bool showPercent=false)
 Configure the display of data labels on the chart.
 
void setSeriesSmooth (uint32_t seriesIndex, bool smooth)
 Set whether a specific series should be rendered with a smooth line.
 
void setSeriesMarker (uint32_t seriesIndex, XLMarkerStyle style)
 Set the marker style for a specific series.
 
void setGapWidth (uint32_t percent)
 Set the gap width between bar/column clusters.
 
void setOverlap (int32_t percent)
 Set the overlap between bars/columns within a cluster.
 
void setHoleSize (uint8_t percent)
 Set the size of the hole in a doughnut chart.
 
void setRotation (uint16_t x, uint16_t y, uint16_t perspective=30)
 Set the rotation of a 3D chart.
 
void setPlotAreaColor (std::string_view hexRGB)
 Fill the chart plot area with a solid color.
 
void setChartAreaColor (std::string_view hexRGB)
 Fill the outermost chart space background with a solid color.
 
- Public Member Functions inherited from OpenXLSX::XLXmlFile
 XLXmlFile ()=default
 Default constructor.
 
std::string xmlData (XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const
 Method for getting the XML data represented by the object.
 
 XLXmlFile (XLXmlData *xmlData)
 Constructor. Creates an object based on the xmlData input.
 
 XLXmlFile (const XLXmlFile &other)=default
 Copy constructor. Default implementation used.
 
 XLXmlFile (XLXmlFile &&other) noexcept=default
 Move constructor. Default implementation used.
 
 ~XLXmlFile ()=default
 Destructor. Default implementation used.
 
bool valid () const
 check whether class is linked to a valid XML file
 
XLXmlFileoperator= (const XLXmlFile &other)=default
 The copy assignment operator. The default implementation has been used.
 
XLXmlFileoperator= (XLXmlFile &&other) noexcept=default
 The move assignment operator. The default implementation has been used.
 
XLDocumentparentDoc ()
 This function provides access to the parent XLDocument object.
 
const XLDocumentparentDoc () const
 This function provides access to the parent XLDocument object.
 
XMLDocumentxmlDocument ()
 This function provides access to the underlying XMLDocument object.
 
const XMLDocumentxmlDocument () const
 This function provides access to the underlying XMLDocument object.
 
std::string getXmlPath () const
 Retrieve the path of the XML data in the .xlsx zip archive via m_xmlData->getXmlPath.
 

Friends

class XLDocument
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXLSX::XLXmlFile
void setXmlData (std::string_view xmlData)
 Provide the XML data represented by the object.
 
std::string relationshipID () const
 This function returns the relationship ID (the ID used in the XLRelationships objects) for the object.
 
- Protected Attributes inherited from OpenXLSX::XLXmlFile
XLXmlDatam_xmlData {nullptr}
 

Constructor & Destructor Documentation

◆ XLChart() [1/4]

OpenXLSX::XLChart::XLChart ( )
inline

Constructor.

◆ XLChart() [2/4]

OpenXLSX::XLChart::XLChart ( XLXmlData xmlData)
explicit

Constructor from XLXmlData.

Parameters
xmlDatathe source XML data

◆ XLChart() [3/4]

OpenXLSX::XLChart::XLChart ( const XLChart other)
default

Copy Constructor.

Parameters
otherThe object to be copied

◆ XLChart() [4/4]

OpenXLSX::XLChart::XLChart ( XLChart &&  other)
defaultnoexcept

Move Constructor.

◆ ~XLChart()

OpenXLSX::XLChart::~XLChart ( )
default

Destructor.

Member Function Documentation

◆ addBubbleSeries() [1/2]

XLChartSeries OpenXLSX::XLChart::addBubbleSeries ( const XLWorksheet wks,
const XLCellRange xValues,
const XLCellRange yValues,
const XLCellRange sizes,
std::string_view  title = "" 
)

◆ addBubbleSeries() [2/2]

XLChartSeries OpenXLSX::XLChart::addBubbleSeries ( std::string_view  xValRef,
std::string_view  yValRef,
std::string_view  sizeRef,
std::string_view  title = "" 
)

Add a bubble chart series with explicit X, Y, and size ranges.

Parameters
xValRefCell reference for X values (e.g. "Sheet1!$A$2:$A$10").
yValRefCell reference for Y values.
sizeRefCell reference for bubble sizes.
titleOptional series name.

◆ addSeries() [1/3]

XLChartSeries OpenXLSX::XLChart::addSeries ( const XLWorksheet wks,
const XLCellRange values,
const XLCellRange categories,
std::string_view  title = "",
std::optional< XLChartType targetChartType = std::nullopt,
bool  useSecondaryAxis = false 
)

◆ addSeries() [2/3]

XLChartSeries OpenXLSX::XLChart::addSeries ( const XLWorksheet wks,
const XLCellRange values,
std::string_view  title = "",
std::optional< XLChartType targetChartType = std::nullopt,
bool  useSecondaryAxis = false 
)

Add a data series to the chart.

Parameters
valuesRefA cell reference to the data values (e.g. "Sheet1!$B$1:$B$10")
titleA literal string or cell reference for the series name.
categoriesRefA cell reference for the X-axis categories.

◆ addSeries() [3/3]

XLChartSeries OpenXLSX::XLChart::addSeries ( std::string_view  valuesRef,
std::string_view  title = "",
std::string_view  categoriesRef = "",
std::optional< XLChartType targetChartType = std::nullopt,
bool  useSecondaryAxis = false 
)

◆ axis()

XLAxis OpenXLSX::XLChart::axis ( std::string_view  position) const

◆ operator=() [1/2]

XLChart & OpenXLSX::XLChart::operator= ( const XLChart other)
default

Copy Assignment Operator.

◆ operator=() [2/2]

XLChart & OpenXLSX::XLChart::operator= ( XLChart &&  other)
defaultnoexcept

Move Assignment Operator.

◆ setChartAreaColor()

void OpenXLSX::XLChart::setChartAreaColor ( std::string_view  hexRGB)

Fill the outermost chart space background with a solid color.

Parameters
hexRGBSix-character hex color.

◆ setGapWidth()

void OpenXLSX::XLChart::setGapWidth ( uint32_t  percent)

Set the gap width between bar/column clusters.

Parameters
percentGap expressed as a percentage of bar width (0–500, default 150).

◆ setHoleSize()

void OpenXLSX::XLChart::setHoleSize ( uint8_t  percent)

Set the size of the hole in a doughnut chart.

Parameters
percentHole size as a percentage of the chart diameter (1–90, default 75).

◆ setLegendPosition()

void OpenXLSX::XLChart::setLegendPosition ( XLLegendPosition  position)

Set the legend position or hide it.

◆ setOverlap()

void OpenXLSX::XLChart::setOverlap ( int32_t  percent)

Set the overlap between bars/columns within a cluster.

Parameters
percentOverlap in percent (−100 to 100). Positive = overlap, negative = gap.

◆ setPlotAreaColor()

void OpenXLSX::XLChart::setPlotAreaColor ( std::string_view  hexRGB)

Fill the chart plot area with a solid color.

Parameters
hexRGBSix-character hex color, e.g. "F2F2F2".

◆ setRotation()

void OpenXLSX::XLChart::setRotation ( uint16_t  x,
uint16_t  y,
uint16_t  perspective = 30 
)

Set the rotation of a 3D chart.

Parameters
xRotation around the X-axis in degrees (0–90).
yRotation around the Y-axis in degrees (0–360).
perspectivePerspective value (0–100, default 30).

◆ setSeriesMarker()

void OpenXLSX::XLChart::setSeriesMarker ( uint32_t  seriesIndex,
XLMarkerStyle  style 
)

Set the marker style for a specific series.

◆ setSeriesSmooth()

void OpenXLSX::XLChart::setSeriesSmooth ( uint32_t  seriesIndex,
bool  smooth 
)

Set whether a specific series should be rendered with a smooth line.

◆ setShowDataLabels()

void OpenXLSX::XLChart::setShowDataLabels ( bool  showValue,
bool  showCategory = false,
bool  showPercent = false 
)

Configure the display of data labels on the chart.

◆ setStyle()

void OpenXLSX::XLChart::setStyle ( uint8_t  styleId)

Set the built-in chart style ID (1–48).

◆ setTitle()

void OpenXLSX::XLChart::setTitle ( std::string_view  title)

Set the chart title.

◆ xAxis()

XLAxis OpenXLSX::XLChart::xAxis ( ) const

Get the X-axis (typically bottom category axis).

◆ yAxis()

XLAxis OpenXLSX::XLChart::yAxis ( ) const

Get the Y-axis (typically left value axis).

Friends And Related Symbol Documentation

◆ XLDocument

friend class XLDocument
friend

The documentation for this class was generated from the following file: