1#ifndef OPENXLSX_XLCHART_HPP
2#define OPENXLSX_XLCHART_HPP
4#include "OpenXLSX-Exports.hpp"
60 enum class XLMarkerStyle {
None,
Circle,
Dash,
Diamond,
Dot,
Picture,
Plus,
Square,
Star,
Triangle,
X,
Default };
270 std::string_view title =
"",
271 std::optional<XLChartType> targetChartType = std::nullopt,
272 bool useSecondaryAxis =
false);
276 std::string_view title =
"",
277 std::optional<XLChartType> targetChartType = std::nullopt,
278 bool useSecondaryAxis =
false);
280 std::string_view title =
"",
281 std::string_view categoriesRef =
"",
282 std::optional<XLChartType> targetChartType = std::nullopt,
283 bool useSecondaryAxis =
false);
293 addBubbleSeries(std::string_view xValRef, std::string_view yValRef, std::string_view sizeRef, std::string_view title =
"");
299 std::string_view title =
"");
367 void setRotation(uint16_t x, uint16_t y, uint16_t perspective = 30);
384 [[nodiscard]] uint32_t seriesCount()
const;
XLXmlData * xmlData
Definition XLDocument.cpp:1422
Definition XLXmlParser.hpp:84
Definition XLChart.hpp:153
void setMinorGridlines(bool show)
void setNumberFormat(std::string_view formatCode, bool sourceLinked=false)
Set the number format for axis tick labels.
void setDateAxis(bool isDateAxis)
Convert this axis to a date axis or back to a category axis.
void setTitle(std::string_view title)
void setMinorUnit(double unit)
Set the minor unit (interval between minor tick marks) for the axis.
XLAxis(const XMLNode &node)
void setOrientation(XLAxisOrientation orientation)
Set the orientation of the axis (normal or reverse).
void setCrosses(XLAxisCrosses crosses)
Set the axis crossing mode.
void setCrossesAt(double value)
Set the axis to cross at a specific value.
void setMaxBounds(double max)
void setMajorGridlines(bool show)
void setMajorUnit(double unit)
Set the major unit (interval between major tick marks) for the axis.
void setLogScale(double base)
Set the axis to use a logarithmic scale.
void setMinBounds(double min)
Represents a rectangular area of cells within a worksheet.
Definition XLCellRange.hpp:30
Definition XLChart.hpp:88
XLChartSeries & setColor(std::string_view hexRGB)
Set the fill and line color of this data series.
XLChartSeries & setMarkerStyle(XLMarkerStyle style)
XLChartSeries & setDataLabels(bool showValue, bool showCategoryName=false, bool showPercent=false)
Enable and configure data labels for this series.
XLChartSeries & setDataPointColor(uint32_t pointIdx, std::string_view hexRGB)
Override the color of a single data point within this series.
XLChartSeries & setDataLabelsFromRange(const XLWorksheet &wks, const XLCellRange &range)
Set the data labels for this series to come from a worksheet range.
XLChartSeries & setSmooth(bool smooth)
XLChartSeries & addTrendline(XLTrendlineType type, std::string_view name="", uint8_t order=2, uint8_t period=2)
Add a trendline to this series.
XLChartSeries & setTitle(std::string_view title)
XLChartSeries(const XMLNode &node)
XLChartSeries & addErrorBars(XLErrorBarDirection direction, XLErrorBarType type, XLErrorBarValueType valType, double value=0.0)
Add error bars to this series.
Definition XLChart.hpp:223
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.
void setPlotAreaColor(std::string_view hexRGB)
Fill the chart plot area with a solid color.
void setStyle(uint8_t styleId)
Set the built-in chart style ID (1–48).
void setRotation(uint16_t x, uint16_t y, uint16_t perspective=30)
Set the rotation of a 3D chart.
void setShowDataLabels(bool showValue, bool showCategory=false, bool showPercent=false)
Configure the display of data labels on the chart.
XLChartSeries addBubbleSeries(const XLWorksheet &wks, const XLCellRange &xValues, const XLCellRange &yValues, const XLCellRange &sizes, std::string_view title="")
void setHoleSize(uint8_t percent)
Set the size of the hole in a doughnut chart.
XLChartSeries addSeries(std::string_view valuesRef, std::string_view title="", std::string_view categoriesRef="", std::optional< XLChartType > targetChartType=std::nullopt, bool useSecondaryAxis=false)
void setLegendPosition(XLLegendPosition position)
Set the legend position or hide it.
XLChart(XLXmlData *xmlData)
Constructor from XLXmlData.
XLChart & operator=(const XLChart &other)=default
Copy Assignment Operator.
XLChart(const XLChart &other)=default
Copy Constructor.
XLAxis axis(std::string_view position) const
XLChartSeries addSeries(const XLWorksheet &wks, const XLCellRange &values, const XLCellRange &categories, std::string_view title="", std::optional< XLChartType > targetChartType=std::nullopt, bool useSecondaryAxis=false)
XLChart(XLChart &&other) noexcept=default
Move Constructor.
XLAxis xAxis() const
Get the X-axis (typically bottom category axis).
void setChartAreaColor(std::string_view hexRGB)
Fill the outermost chart space background with a solid color.
void setOverlap(int32_t percent)
Set the overlap between bars/columns within a cluster.
void setTitle(std::string_view title)
Set the chart title.
void setGapWidth(uint32_t percent)
Set the gap width between bar/column clusters.
void setSeriesMarker(uint32_t seriesIndex, XLMarkerStyle style)
Set the marker style for a specific series.
~XLChart()=default
Destructor.
XLChart & operator=(XLChart &&other) noexcept=default
Move Assignment Operator.
XLAxis yAxis() const
Get the Y-axis (typically left value axis).
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.
void setSeriesSmooth(uint32_t seriesIndex, bool smooth)
Set whether a specific series should be rendered with a smooth line.
XLChart()
Constructor.
Definition XLChart.hpp:228
Definition XLConstants.hpp:32
static XLDistance Pixels(uint32_t px)
Definition XLConstants.hpp:35
This class encapsulates the concept of an excel file. It is different from the XLWorkbook,...
Definition XLDocument.hpp:82
A class encapsulating an Excel worksheet. Access to XLWorksheet objects should be via the workbook ob...
Definition XLWorksheet.hpp:118
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:29
The XLXmlFile class provides an interface for derived classes to use. It functions as an ancestor to ...
Definition XLXmlFile.hpp:42
Definition IZipArchive.hpp:18
XLErrorBarDirection
Definition XLChart.hpp:75
XLAxisOrientation
Definition XLChart.hpp:83
XLMarkerStyle
Definition XLChart.hpp:60
XLTrendlineType
Definition XLChart.hpp:81
XLChartType
Definition XLChart.hpp:14
@ ScatterLineMarker
Scatter with straight lines and markers.
@ ScatterMarker
Scatter with markers only, no lines.
@ ScatterLine
Scatter with straight lines, no markers.
@ ScatterSmoothMarker
Scatter with smooth lines and markers.
@ Bubble
Bubble chart (needs addBubbleSeries)
@ ScatterSmooth
Scatter with smooth lines, no markers.
XLErrorBarValueType
Definition XLChart.hpp:79
XLAxisCrosses
Definition XLChart.hpp:85
XLErrorBarType
Definition XLChart.hpp:77
XLLegendPosition
Definition XLChart.hpp:58
Definition XLChart.hpp:140
uint32_t row
Definition XLChart.hpp:142
std::string name
Definition XLChart.hpp:141
XLChartAnchor(std::string_view n, uint32_t r, uint32_t c, XLDistance w, XLDistance h)
Definition XLChart.hpp:148
XLDistance width
Definition XLChart.hpp:144
XLDistance height
Definition XLChart.hpp:145
uint32_t col
Definition XLChart.hpp:143