11#ifndef OPENXLSX_XLCHART_HPP
12#define OPENXLSX_XLCHART_HPP
14#include "OpenXLSX-Exports.hpp"
72 enum class XLMarkerStyle {
None,
Circle,
Dash,
Diamond,
Dot,
Picture,
Plus,
Square,
Star,
Triangle,
X,
Default };
194 void setTitle(std::string_view title);
252 void setNumberFormat(std::string_view formatCode,
bool sourceLinked =
false);
308 std::string_view title =
"",
309 std::optional<XLChartType> targetChartType = std::nullopt,
310 bool useSecondaryAxis =
false);
314 std::string_view title =
"",
315 std::optional<XLChartType> targetChartType = std::nullopt,
316 bool useSecondaryAxis =
false);
318 std::string_view title =
"",
319 std::string_view categoriesRef =
"",
320 std::optional<XLChartType> targetChartType = std::nullopt,
321 bool useSecondaryAxis =
false);
331 addBubbleSeries(std::string_view xValRef, std::string_view yValRef, std::string_view sizeRef, std::string_view title =
"");
337 std::string_view title =
"");
342 void setTitle(std::string_view title);
364 [[nodiscard]]
XLAxis axis(std::string_view position)
const;
369 void setShowDataLabels(
bool showValue,
bool showCategory =
false,
bool showPercent =
false);
405 void setRotation(uint16_t x, uint16_t y, uint16_t perspective = 30);
424 [[nodiscard]] uint32_t seriesCount()
const;
Definition XLChart.hpp:189
void setLogScale(double base)
Set the axis to use a logarithmic scale.
Definition XLChart.cpp:288
void clearMaxBounds()
Definition XLChart.cpp:268
void setMinorGridlines(bool show)
Definition XLChart.cpp:368
void setCrossesAt(double value)
Set the axis to cross at a specific value.
Definition XLChart.cpp:349
void setOrientation(XLAxisOrientation orientation)
Set the orientation of the axis (normal or reverse).
Definition XLChart.cpp:318
void setMinBounds(double min)
Definition XLChart.cpp:244
void setMaxBounds(double max)
Definition XLChart.cpp:259
void setDateAxis(bool isDateAxis)
Convert this axis to a date axis or back to a category axis.
Definition XLChart.cpp:303
void clearMinBounds()
Definition XLChart.cpp:253
void setMajorUnit(double unit)
Set the major unit (interval between major tick marks) for the axis.
Definition XLChart.cpp:274
void setTickLabelPosition(XLAxisTickLabelPosition position)
Definition XLChart.cpp:1115
void setTitle(std::string_view title)
Definition XLChart.cpp:227
void setMinorUnit(double unit)
Set the minor unit (interval between minor tick marks) for the axis.
Definition XLChart.cpp:281
void setCrosses(XLAxisCrosses crosses)
Set the axis crossing mode.
Definition XLChart.cpp:328
void setNumberFormat(std::string_view formatCode, bool sourceLinked=false)
Set the number format for axis tick labels.
Definition XLChart.cpp:838
void setMajorGridlines(bool show)
Definition XLChart.cpp:357
Represents a rectangular area of cells within a worksheet.
Definition XLCellRange.hpp:40
Definition XLChart.hpp:121
XLChartSeries & setDataLabelsFromRange(const XLWorksheet &wks, const XLCellRange &range)
Set the data labels for this series to come from a worksheet range.
Definition XLChart.cpp:675
XLChartSeries & setMarkerStyle(XLMarkerStyle style)
Definition XLChart.cpp:500
XLChartSeries & addTrendline(XLTrendlineType type, std::string_view name="", uint8_t order=2, uint8_t period=2)
Add a trendline to this series.
Definition XLChart.cpp:572
XLChartSeries & setTitle(std::string_view title)
Definition XLChart.cpp:475
XLChartSeries & setSmooth(bool smooth)
Definition XLChart.cpp:492
XLChartSeries & setDataPointColor(uint32_t pointIdx, std::string_view hexRGB)
Override the color of a single data point within this series.
Definition XLChart.cpp:798
XLChartSeries & setColor(std::string_view hexRGB)
Set the fill and line color of this data series.
Definition XLChart.cpp:788
XLChartSeries & addErrorBars(XLErrorBarDirection direction, XLErrorBarType type, XLErrorBarValueType valType, double value=0.0)
Add error bars to this series.
Definition XLChart.cpp:607
XLChartSeries & setLineDash(XLLineDashType dashType)
Definition XLChart.cpp:1068
XLChartSeries & setDataLabels(bool showValue, bool showCategoryName=false, bool showPercent=false)
Enable and configure data labels for this series.
Definition XLChart.cpp:554
XLChartSeries & setLineWidth(double points)
Definition XLChart.cpp:1040
Definition XLChart.hpp:261
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.
Definition XLChart.cpp:968
void setShowDataTable(bool showTable, bool showKeys=false)
Definition XLChart.cpp:1148
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.
Definition XLChart.cpp:711
void setStyle(uint8_t styleId)
Set the built-in chart style ID (1–48).
Definition XLChart.cpp:129
void setSeriesSmooth(uint32_t seriesIndex, bool smooth)
Set whether a specific series should be rendered with a smooth line.
Definition XLChart.cpp:411
void setRotation(uint16_t x, uint16_t y, uint16_t perspective=30)
Set the rotation of a 3D chart.
Definition XLChart.cpp:925
void setGapWidth(uint32_t percent)
Set the gap width between bar/column clusters.
Definition XLChart.cpp:864
void setOverlap(int32_t percent)
Set the overlap between bars/columns within a cluster.
Definition XLChart.cpp:885
XLAxis axis(std::string_view position) const
Definition XLChart.cpp:379
void setLegendPosition(XLLegendPosition position)
Set the legend position or hide it.
Definition XLChart.cpp:138
void setShowDataLabels(bool showValue, bool showCategory=false, bool showPercent=false)
Configure the display of data labels on the chart.
Definition XLChart.cpp:179
XLChart & operator=(const XLChart &other)=default
Copy Assignment Operator.
void setHoleSize(uint8_t percent)
Set the size of the hole in a doughnut chart.
Definition XLChart.cpp:908
XLChart(const XLChart &other)=default
Copy Constructor.
XLAxis yAxis() const
Get the Y-axis (typically left value axis).
Definition XLChart.cpp:392
XLChart(XLChart &&other) noexcept=default
Move Constructor.
XLAxis xAxis() const
Get the X-axis (typically bottom category axis).
Definition XLChart.cpp:391
void setPlotAreaColor(std::string_view hexRGB)
Fill the chart plot area with a solid color.
Definition XLChart.cpp:950
friend class XLDocument
Definition XLChart.hpp:422
void setTitle(std::string_view title)
Set the chart title.
Definition XLChart.cpp:106
~XLChart()=default
Destructor.
XLChart & operator=(XLChart &&other) noexcept=default
Move Assignment Operator.
void setChartAreaColor(std::string_view hexRGB)
Fill the outermost chart space background with a solid color.
Definition XLChart.cpp:957
void setSeriesMarker(uint32_t seriesIndex, XLMarkerStyle style)
Set the marker style for a specific series.
Definition XLChart.cpp:420
XLChart()
Constructor.
Definition XLChart.hpp:266
Definition XLConstants.hpp:42
static XLDistance Pixels(uint32_t px)
Definition XLConstants.hpp:45
A class encapsulating an Excel worksheet. Access to XLWorksheet objects should be via the workbook ob...
Definition XLWorksheet.hpp:132
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:79
XLXmlFile()=default
Default constructor.
Definition IXLCellProvider.hpp:24
XLErrorBarDirection
Definition XLChart.hpp:108
@ Y
Definition XLChart.hpp:108
XLAxisOrientation
Definition XLChart.hpp:116
@ MinMax
Definition XLChart.hpp:116
@ MaxMin
Definition XLChart.hpp:116
XLAxisTickLabelPosition
Definition XLChart.hpp:88
@ Low
Definition XLChart.hpp:91
@ High
Definition XLChart.hpp:90
@ NextToAxis
Definition XLChart.hpp:89
XLMarkerStyle
Definition XLChart.hpp:72
@ X
Definition XLChart.hpp:72
@ Star
Definition XLChart.hpp:72
@ Circle
Definition XLChart.hpp:72
@ Plus
Definition XLChart.hpp:72
@ Dash
Definition XLChart.hpp:72
@ Triangle
Definition XLChart.hpp:72
@ None
Definition XLChart.hpp:72
@ Default
Definition XLChart.hpp:72
@ Picture
Definition XLChart.hpp:72
@ Diamond
Definition XLChart.hpp:72
@ Dot
Definition XLChart.hpp:72
@ Square
Definition XLChart.hpp:72
XLLineDashType
Definition XLChart.hpp:74
@ SysDashDot
Definition XLChart.hpp:85
@ SysDot
Definition XLChart.hpp:84
@ LgDashDot
Definition XLChart.hpp:81
@ LgDash
Definition XLChart.hpp:79
@ LgDashDotDot
Definition XLChart.hpp:82
@ Unset
Definition XLChart.hpp:75
@ SysDash
Definition XLChart.hpp:83
@ Solid
Definition XLChart.hpp:76
@ DashDot
Definition XLChart.hpp:80
XLTrendlineType
Definition XLChart.hpp:114
@ Polynomial
Definition XLChart.hpp:114
@ Logarithmic
Definition XLChart.hpp:114
@ Linear
Definition XLChart.hpp:114
@ MovingAverage
Definition XLChart.hpp:114
@ Exponential
Definition XLChart.hpp:114
@ Power
Definition XLChart.hpp:114
XLChartType
Definition XLChart.hpp:24
@ Scatter
Definition XLChart.hpp:43
@ Bar3D
Definition XLChart.hpp:28
@ Column
Definition XLChart.hpp:31
@ Bar3DStacked
Definition XLChart.hpp:29
@ StockOHLC
Definition XLChart.hpp:51
@ Line3D
Definition XLChart.hpp:40
@ ScatterLineMarker
Scatter with straight lines and markers.
Definition XLChart.hpp:45
@ Doughnut
Definition XLChart.hpp:62
@ BarOfPie
Definition XLChart.hpp:67
@ ScatterMarker
Scatter with markers only, no lines.
Definition XLChart.hpp:48
@ Column3D
Definition XLChart.hpp:34
@ Line
Definition XLChart.hpp:37
@ BarPercentStacked
Definition XLChart.hpp:27
@ Pie3D
Definition XLChart.hpp:42
@ Bar3DPercentStacked
Definition XLChart.hpp:30
@ ScatterLine
Scatter with straight lines, no markers.
Definition XLChart.hpp:44
@ LinePercentStacked
Definition XLChart.hpp:39
@ ScatterSmoothMarker
Scatter with smooth lines and markers.
Definition XLChart.hpp:47
@ RadarFilled
Definition XLChart.hpp:64
@ StockHLC
Definition XLChart.hpp:50
@ Pie
Definition XLChart.hpp:41
@ ColumnStacked
Definition XLChart.hpp:32
@ AreaPercentStacked
Definition XLChart.hpp:58
@ Surface
Definition XLChart.hpp:52
@ Area3DStacked
Definition XLChart.hpp:60
@ LineStacked
Definition XLChart.hpp:38
@ Column3DPercentStacked
Definition XLChart.hpp:36
@ Bubble
Bubble chart (needs addBubbleSeries).
Definition XLChart.hpp:49
@ ColumnPercentStacked
Definition XLChart.hpp:33
@ PieOfPie
Definition XLChart.hpp:66
@ Area3DPercentStacked
Definition XLChart.hpp:61
@ SurfaceWireframe
Definition XLChart.hpp:54
@ ScatterSmooth
Scatter with smooth lines, no markers.
Definition XLChart.hpp:46
@ Area3D
Definition XLChart.hpp:59
@ Radar
Definition XLChart.hpp:63
@ Bar
Definition XLChart.hpp:25
@ Area
Definition XLChart.hpp:56
@ Column3DStacked
Definition XLChart.hpp:35
@ Surface3D
Definition XLChart.hpp:53
@ RadarMarkers
Definition XLChart.hpp:65
@ AreaStacked
Definition XLChart.hpp:57
@ Surface3DWireframe
Definition XLChart.hpp:55
@ BarStacked
Definition XLChart.hpp:26
OpenXLSX_xml_node XMLNode
Definition XLXmlParser.hpp:64
XLErrorBarValueType
Definition XLChart.hpp:112
@ Percentage
Definition XLChart.hpp:112
@ StandardDeviation
Definition XLChart.hpp:112
@ Custom
Definition XLChart.hpp:112
@ FixedValue
Definition XLChart.hpp:112
@ StandardError
Definition XLChart.hpp:112
XLAxisCrosses
Definition XLChart.hpp:118
@ AutoZero
Definition XLChart.hpp:118
@ Max
Definition XLChart.hpp:118
@ Min
Definition XLChart.hpp:118
XLErrorBarType
Definition XLChart.hpp:110
@ Both
Definition XLChart.hpp:110
@ Minus
Definition XLChart.hpp:110
XLLegendPosition
Definition XLChart.hpp:70
@ TopRight
Definition XLChart.hpp:70
@ Bottom
Definition XLChart.hpp:70
@ Hidden
Definition XLChart.hpp:70
@ Right
Definition XLChart.hpp:70
@ Left
Definition XLChart.hpp:70
@ Top
Definition XLChart.hpp:70
uint32_t row
Definition XLChart.hpp:178
std::string name
Definition XLChart.hpp:177
XLChartAnchor(std::string_view n, uint32_t r, uint32_t c, XLDistance w, XLDistance h)
Definition XLChart.hpp:184
XLDistance width
Definition XLChart.hpp:180
XLDistance height
Definition XLChart.hpp:181
uint32_t col
Definition XLChart.hpp:179