Charts
Chart support lives in the XLSX.Charts sub-module. using XLSX.Charts brings the functions below into scope; the handle and value types are public but not exported, so refer to them as XLSX.Charts.ChartSeries and so on. They are documented on the Chart types page.
The names released before the sub-module existed — getCharts, getChart, getChartData, getChartRanges, chartType, chartSchema, AbstractChart, Chart, ChartEx, ChartRef and ChartSeries — are also reachable as XLSX.getCharts and so on.
XLSX.Charts — Module
XLSX.ChartsReading, formatting and creating Excel charts, in both chart schemas: the c: schema (Chart) and the cx: chartEx schema (ChartEx).
using XLSX.Charts brings the chart functions into scope. The handle and value types are public but not exported; refer to them as XLSX.Charts.ChartSeries and so on.
Finding and reading charts
XLSX.Charts.getCharts — Function
getCharts(xf::XLSXFile) -> Vector{AbstractChart}
getCharts(ws::Worksheet) -> Vector{AbstractChart}Return every chart in the file, or every chart anchored to ws.
Each chart is a handle that reads its part on every call, so it stays valid across edits. Reading options belong to the accessors: series metadata without cached values is getChartSeries(c; read_cached_values=false).
A chart may reference an external workbook, in which case its source formula takes the form [1]Sheet1!$A$1:$A$10, where [1] indexes the workbook's external references. Pass get_external_refs=true to XLSX.Charts.getChartSeries or XLSX.Charts.getChartData to substitute the workbook path, as XLSX.getFormula does.
Examples
julia> f = XLSX.readxlsx("sales.xlsx");
julia> c = XLSX.Charts.getCharts(f["Summary"])[1];
julia> XLSX.Charts.getChartTitle(c)
"Revenue by region"
julia> XLSX.Charts.getChartSeries(c)[1].values.ref
"Summary!$B$2:$B$5"
# A DataFrame per chart, skipping chartEx charts, which carry no cached data
julia> dfs = Dict(c.name => DataFrame(XLSX.Charts.getChartData(c))
for c in XLSX.Charts.getCharts(f) if c isa XLSX.Charts.Chart)The values XLSX.Charts.getChartData and XLSX.Charts.getChartSeries return are Excel's cache, written when the file was last saved by Excel. They may be stale relative to the source, and a file written by a tool that does not populate the cache will give empty series.
Charts using the newer chartEx schema - waterfall, funnel, treemap, sunburst, histogram, Pareto, box & whisker, region map - are returned as XLSX.Charts.ChartEx rather than XLSX.Charts.Chart. Their type, title and source ranges are available; their cached values are not, and XLSX.Charts.getChartData throws for them. Use XLSX.Charts.getChartSchema or isa to tell the two apart, and XLSX.Charts.getChartRanges to find their source cells.
See also XLSX.Charts.getChart, XLSX.Charts.getChartData, XLSX.Charts.getChartType.
XLSX.Charts.getChart — Function
getChart(ws::Worksheet, name) -> AbstractChart
getChart(xf::XLSXFile, name) -> AbstractChartReturn a single chart. name may be the part name ("chart1" or "chart1.xml"), the full package path, or the chart's relationship id within its drawing part ("rId1").
Returns a XLSX.Charts.ChartEx where the named part uses the chartEx schema. The returned handle reads the current part on every call, so it stays valid across edits. Options that affect reading, such as read_cached_values and get_external_refs, are taken by the accessors: see XLSX.Charts.getChartSeries and XLSX.Charts.getChartData.
See also XLSX.Charts.getCharts.
XLSX.Charts.getChartSchema — Function
getChartSchema(c::AbstractChart) -> Symbol:c for charts in the original schema, :cx for newer chartEx charts.
XLSX.Charts.getChartType — Function
getChartType(c::AbstractChart) -> SymbolThe kind of chart, as a single symbol, whatever the schema.
For c: charts this is the plot-group tag - :barChart, :scatterChart - or :combo where the chart has more than one group. The full list is in getChartTypes(c), and each series carries its own group in s.charttype.
For cx: charts it is the normalised layout: :waterfall, :funnel, :treemap, :sunburst, :boxWhisker, :regionMap, :histogram, :pareto, or :clusteredColumn. Histogram and Pareto are not distinct layouts in the file - a histogram is a clustered column series carrying cx:binning, and a Pareto adds a second paretoLine series - so both are derived here.
XLSX.Charts.getChartTitle — Function
getChartTitle(c::Chart) -> Union{Nothing,String}
getChartTitle(c::ChartEx) -> Union{Nothing,String}The chart's title as plain text, whether typed into the chart or bound to a cell. A cell-bound title comes from the string Excel cached with the reference, so it is the text as of the last save rather than the cell's current value.
nothing where the chart has no title, where the title element carries no text of its own, or where Excel generates the title from the single series' name and so writes no text at all. Paragraphs are joined with newlines, as are the line breaks within one.
Returns text only. getChartTitleText gives a c: title's rich text with its formatting, getChartTitleRef the formula behind a cell-bound one, getChartTitleRange the same for a cx: chart, and getChartTitleTextProps the c:txPr or cx:txPr that formats it.
XLSX.Charts.getChartData — Function
getChartData(c::Chart) -> DataTable
getChartData(ws::Worksheet, name) -> DataTable
getChartData(xf::XLSXFile, name) -> DataTableReturn the cached data of a chart as a DataTable, ready for DataFrame(...) or any other Tables.jl sink.
Categories become the leading column(s). Where every series shares one category reference a single categories column is emitted; otherwise each series contributes its own <series>_x column, which is the usual layout for scatter and bubble charts. Multi-level categories give one column per level, and bubble charts add a <series>_size column. Series of unequal length are padded with missing.
Series with no name in the file - Excel shows these as "Series1", "Series2" in the legend - are labelled by position. No category column is produced when the chart has no c:cat at all: Excel is plotting against an implicit index in that case, and nothing is cached for it.
Examples
julia> using DataFrames
julia> DataFrame(XLSX.Charts.getChartData(f["Summary"], "chart1"))
4×3 DataFrame
Row │ categories 2024 2025
│ String Float64 Float64chartEx charts carry no readable value cache, so this throws XLSX.XLSXError for them. Use XLSX.Charts.getChartRanges and XLSX.getdata to read their source cells instead.
See also XLSX.Charts.getCharts, XLSX.gettable.
getChartData(c::ChartEx)chartEx charts do not carry a readable value cache. Throws XLSX.XLSXError.
XLSX.Charts.getChartRanges — Function
getChartRanges(c::Chart) -> Vector{ChartRanges}
getChartRanges(c::ChartEx) -> Vector{ChartRange}
getChartRanges(ws::Worksheet, name) -> Vector
getChartRanges(xf::XLSXFile, name) -> Vector
getChartRanges(ws::Worksheet) -> Vector{@NamedTuple{chart::String, ranges::Vector}}
getChartRanges(xf::XLSXFile) -> Vector{@NamedTuple{chart::String, ranges::Vector}}The worksheet ranges of the source data a chart plots from.
Given a XLSX.Charts.Chart, or a chart name in any of the forms XLSX.Charts.getChart accepts, return one entry per series in document order, parallel to getChartSeries(c). Each entry carries the series idx and name alongside its categories, values and bubble_sizes ranges.
Given no name, return the ranges of every chart on the worksheet or in the workbook, each paired with its chart name, following XLSX.Charts.getCharts.
categories holds c:cat or c:xVal and values holds c:val or c:yVal, so the two mean the same thing whatever the chart type, as in XLSX.Charts.ChartSeries. bubble_sizes is nothing for every chart type but bubble.
A range is nothing wherever the series has no addressable source: a literal series (c:numLit/c:strLit), a reference to an external workbook, a defined name.
Examples
julia> f = XLSX.readxlsx("sales.xlsx");
julia> r = XLSX.Charts.getChartRanges(f["Summary"], "chart1");
julia> r[1].name, r[1].values
("2024", Summary!B2:B5)
julia> XLSX.getdata(f, r[1].values) # read the live source cells, not the cache
4-element Vector{Any}:
1250.0
1310.0
⋮
julia> [(x.chart, length(x.ranges)) for x in XLSX.Charts.getChartRanges(f)]
2-element Vector{Tuple{String, Int64}}:
("chart1", 3)
("chart2", 1)A range records where the chart says its source data came from, which is not necessarily where the values in XLSX.Charts.getChartData came from: the cache is a snapshot from the last save, and the cells may have changed since, or the source sheet may have been deleted entirely.
For a XLSX.Charts.ChartEx this returns a flat Vector{ChartRange} rather than one entry per series. The cx: schema declares its data dimensions once in cx:chartData and shares them across series, so there is no per-series idx or name to report.
See also XLSX.Charts.getChart, XLSX.Charts.getCharts, XLSX.Charts.getChartData.
The chart as a whole
XLSX.Charts.getChartTypes — Function
getChartTypes(c::Chart) -> Vector{Symbol}The tag of each chart-type group in c:plotArea, in document order: :barChart, :lineChart and so on. One entry per group, duplicates kept — a primary and a secondary bar group both appear — and groups holding no series are included. Contrast getChartType, which names the chart as a whole.
XLSX.Charts.getChartGroups — Function
getChartGroups(c::Chart) -> Vector{ChartGroup}The chart-type groups in c:plotArea, in document order. A combo chart has several; a plain chart has one. Use getGroupAxes to find which axes a group's series are plotted against.
XLSX.Charts.getChartLegend — Function
getChartLegend(c::Chart) -> Union{Nothing,XML.Node}The c:legend element, or nothing if the chart has no legend. Returned as a node because the legend carries no identity of its own — pass it to getLegendShapeProps and friends, or read it directly.
XLSX.Charts.getLegendPos — Function
getLegendPos(c::Chart) -> Union{Nothing,Symbol}:b (bottom), :t (top), :l (left), :r (right) or :tr (top-right) from c:legendPos. nothing means no legend, or a legend with no explicit position.
XLSX.Charts.getLegendOverlay — Function
getLegendOverlay(c::Chart) -> Union{Nothing,Bool}c:overlay — true where the legend is drawn on top of the plot area rather than beside it. nothing means the chart has no legend, or the element was not written, in which case Excel treats it as false.
XLSX.Charts.getLegendShapeProps — Function
getLegendShapeProps(c::Chart) -> Union{Nothing,DrawingShapeProps}Fill and border of the legend box (c:legend/c:spPr). nothing means the chart has no legend, or none was written.
XLSX.Charts.getLegendTextProps — Function
getLegendTextProps(c::Chart) -> Union{Nothing,DrawingText}
getLegendTextProps(c::ChartEx) -> Union{Nothing,DrawingText}Text body for the legend entries (c:legend/c:txPr). nothing means the chart has no legend, or none was written.
XLSX.Charts.setLegendTextProp — Function
setLegendTextProp(c, field, value) -> ChartSet one text property of the legend (c:legend/c:txPr). A legend takes its text from the series names, so there is no c:tx to replace — only its formatting is settable.
setLegendTextProp(c::ChartEx, field, value) -> ChartExSet one field of the legend's text formatting, on cx:legend/cx:txPr. Creates the legend if the chart has none. Returns c, which remains valid.
XLSX.Charts.getLegendEntryDeleted — Function
getLegendEntryDeleted(c::Chart, i::Integer) -> Union{Nothing,Bool}Whether series i's legend entry is hidden (c:legendEntry/c:delete). nothing means the chart has no legend, series i has no c:legendEntry, or the entry carries text formatting instead, which the schema allows in place of c:delete; in all three cases the entry is shown.
A legend entry is keyed by its series' c:idx, which this finds from the position.
XLSX.Charts.setLegendEntryDeleted — Function
setLegendEntryDeleted(c, positions, deleted) -> ChartHide (true) or show (false) the legend entries of the series at positions — a single position or any collection of them — in one rebuild of the chart part. :inherit removes their c:legendEntry elements, so the entries show with the legend's own formatting.
Replacing an entry discards any text formatting it carried: the schema allows an entry either c:delete or c:txPr, not both.
Throws if the chart has no legend, rather than adding one.
Hiding entries is how to show a legend in an order other than series order: add series with zero values in the wanted order, format them to match, and hide the entries of the series that draw the data.
XLSX.Charts.getChartTitleText — Function
getChartTitleText(c::Chart) -> Union{Nothing,DrawingText}Literal title text (c:title/c:tx/c:rich). nothing if there is no title element, or the title references a cell rather than carrying literal text — see getChartTitleRef — or c:autoTitleDeleted is 0 and Excel generates the title from the series name, in which case no text exists in the file at all.
XLSX.Charts.getChartTitleRef — Function
getChartTitleRef(c::Chart) -> Union{Nothing,String}The formula behind a title that references a cell (c:title/c:tx/c:strRef/c:f). nothing for a literal or absent title.
XLSX.Charts.getChartTitleShapeProps — Function
getChartTitleShapeProps(c::Chart) -> Union{Nothing,DrawingShapeProps}Fill and border of the title box (c:title/c:spPr). nothing means there is no title element, or none was written.
XLSX.Charts.getChartTitleTextProps — Function
getChartTitleTextProps(c::Chart) -> Union{Nothing,DrawingText}
getChartTitleTextProps(c::ChartEx) -> Union{Nothing,DrawingText}Text body for the title (c:title/c:txPr) — its formatting, which applies whether the title is typed, bound to a cell or generated by Excel. Contrast getChartTitleText, which is the literal text in c:tx/c:rich.
XLSX.Charts.getAutoTitleDeleted — Function
getAutoTitleDeleted(c::Chart) -> Union{Nothing,Bool}c:autoTitleDeleted — true where the user removed the title Excel would otherwise generate from the single series' name. nothing means the element was not written, which Excel treats as false.
XLSX.Charts.setChartTitleText — Function
setChartTitleText(c, text) -> ChartReplace the chart title's text and all its formatting. text may be a DrawingText or a string, which becomes a one-run title inheriting its formatting from the chart style.
This replaces rather than merges, like writing a RichTextString to a cell — use setChartTitleTextProp to change one property and leave the rest.
A title bound to a cell (c:tx/c:strRef) is replaced by literal text; the reference is lost. c:autoTitleDeleted is not touched, so a chart with the title switched off stays that way.
A title created here gets c:overlay val="0", as Excel writes on every title it creates, so it sits beside the plot area rather than over it.
setChartTitleText(c::ChartEx, text::AbstractString) -> ChartExSet the chart title to text, typed rather than bound to a cell. Creates the title if the chart has none, and drops any cx:f binding it had.
Excel stores a typed title both as cx:tx/cx:txData/cx:v and as runs in the title's cx:txPr, and renders the latter, so both are updated. Run formatting is preserved; use setChartTitleTextProp to change it.
Returns c, which remains valid.
XLSX.Charts.setChartTitleTextProp — Function
setChartTitleTextProp(c, field, value) -> ChartSet one text property of the chart title. field is a field of DrawingRunProps other than raw; :inherit removes it.
A title carries formatting in c:title/c:txPr and, when it holds literal text, in c:title/c:tx/c:rich as well — Excel renders the rich one, so both are written. Contrast setChartTitleText, which replaces the text and all its formatting.
setChartTitleTextProp(c::ChartEx, field, value) -> ChartExSet one field of the chart title's text formatting, on cx:title/cx:txPr. Creates the title if the chart has none. Returns c, which remains valid.
XLSX.Charts.getPlotAreaShapeProps — Function
getPlotAreaShapeProps(c::Chart) -> Union{Nothing,DrawingShapeProps}Fill and border of the plot area (c:plotArea/c:spPr) — the region the data is drawn in, inside the axes. nothing means none was written.
XLSX.Charts.getChartSpaceShapeProps — Function
getChartSpaceShapeProps(c::Chart) -> Union{Nothing,DrawingShapeProps}Fill and border of the chart as a whole (c:chartSpace/c:spPr) — the outer frame, not the plot area. nothing means none was written.
XLSX.Charts.getChartSpaceTextProps — Function
getChartSpaceTextProps(c::Chart) -> Union{Nothing,DrawingText}Text body at the chart space (c:chartSpace/c:txPr), the default every other text element inherits from and the last rung of the text cascade; see getLabelTextProp. nothing means none was written.
XLSX.Charts.setChartSpaceTextProp — Function
setChartSpaceTextProp(c, field, value) -> ChartSet one text property on c:chartSpace/c:txPr — the bottom rung of the text cascade, which every text body in the chart inherits from unless it overrides.
XLSX.Charts.setPlotAreaLine — Function
setPlotAreaLine(c; color, width, dash, cap, compound, join, miterLimit) -> Chart
setPlotAreaLine(c, :none)
setPlotAreaLine(c, :inherit)Set the border of the plot area (c:plotArea/c:spPr/a:ln), as setSeriesLine sets a series outline.
Series
XLSX.Charts.getChartSeries — Function
getChartSeries(c::Chart; read_cached_values=true, get_external_refs=false) -> Vector{ChartSeries}The series of c, in document order across all chart groups. Each is a value identified by its idx; see ChartSeries."
read_cached_values=false reads metadata only: names, references and point counts, without the cached values. get_external_refs=true replaces an external workbook index such as [1] in each reference with the workbook's path.
XLSX.Charts.getSeriesGroup — Function
getSeriesGroup(c::Chart, i::Integer) -> ChartGroupThe chart-type group containing series i.
XLSX.Charts.getSeriesAxes — Function
getSeriesAxes(c::Chart, i::Integer) -> Vector{ChartAxis}The axes series i is plotted against. This is how you tell a primary-axis series from a secondary-axis one: they sit in different groups naming different axis ids.
XLSX.Charts.getSeriesShapeProps — Function
getSeriesShapeProps(c::Chart, i::Integer) -> Union{Nothing,DrawingShapeProps}Fill, line and effects for the graphic of series i (c:ser/c:spPr), where i is a position in getChartSeries(c), not the c:idx value. nothing means no spPr was written, which in DrawingML means inherit from the chart style — not "no formatting". Contrast an explicit <a:noFill/>, which hasFill reports as deliberately off.
XLSX.Charts.getSeriesFill — Function
getSeriesFill(c::Chart, i::Integer; point=nothing) -> Effective{DrawingFill}Resolve the fill of the graphic of series i, or of one data point of it.
This is always c:spPr. On a line or scatter series what Excel's format pane calls the point's fill lives on its marker instead — use getMarkerFill for that.
getSeriesFill(c::ChartEx, i::Integer; point=nothing, pareto=false) -> Effective{DrawingFill}Resolve the fill of series i, or of one data point of it, walking cx:dataPt/cx:spPr then cx:series/cx:spPr. With pareto = true, series i's Pareto line instead; an error if it has none.
XLSX.Charts.getSeriesLine — Function
getSeriesLine(c::Chart, i::Integer; point=nothing) -> Effective{DrawingLine}Resolve the outline of the graphic of series i, or of one data point of it.
getSeriesLine(c::ChartEx, i::Integer; point=nothing, pareto=false) -> Effective{DrawingLine}Resolve the outline of series i, or of one data point of it, walking cx:dataPt/cx:spPr then cx:series/cx:spPr. With pareto = true, series i's Pareto line instead; an error if it has none.
XLSX.Charts.getSeriesMarker — Function
getSeriesMarker(c::Chart, i::Integer) -> Union{Nothing,ChartMarker}Marker for series i of a line, scatter or radar chart (c:ser/c:marker). nothing means no c:marker element; a marker whose symbol is :none is a marker explicitly turned off, which is a different thing.
XLSX.Charts.getSeriesLabelTextProps — Function
getSeriesLabelTextProps(c::Chart, i::Integer) -> Union{Nothing,DrawingText}Text body for the data labels of series i (c:ser/c:dLbls/c:txPr). Per-point overrides in c:dLbls/c:dLbl are not consulted; this is the series-level default.
XLSX.Charts.setSeriesFill — Function
setSeriesFill(c, i, color) -> ChartSet the fill of series i's graphic. color may be a color string or Symbol, a Colors.Colorant, a SchemeColor, :none for an explicit <a:noFill/>, or :inherit to remove it so the chart style applies.
:none and :inherit are different states. An absent fill inherits; noFill does not.
Returns c. A Chart reads its part on every call, so c and any other handle to the same chart see the change. Values read from it earlier, such as a ChartSeries or a ChartDataPoint, describe the part as it was then.
setSeriesFill(c::ChartEx, i, color; point=nothing, pareto=false) -> ChartExSet the fill of series i, or of one data point of it. color may be a colour string or Symbol, a Colors.Colorant, a SchemeColor, :none for an explicit <a:noFill/>, or :inherit to remove the fill so the chart style applies. With pareto = true, series i's Pareto line instead; an error if it has none.
Setting a point's fill creates its cx:dataPt if Excel never formatted that point. :inherit never creates anything.
Returns c, which remains valid.
XLSX.Charts.setSeriesLine — Function
setSeriesLine(c, i; color, width, dash, cap, compound, join, miterLimit) -> Chart
setSeriesLine(c, i, :none)
setSeriesLine(c, i, :inherit)Set several line properties at once, in one rebuild of the chart part. A keyword left unspecified is left alone; pass :inherit to remove one that is set.
miterLimit needs a miter join. Passing join = :miter and miterLimit in one call works, since the join is applied first.
The symbol form acts on the whole outline: :none writes an a:ln whose fill is <a:noFill/>, and :inherit removes the a:ln so the chart style supplies it.
setSeriesLine(c::ChartEx, i; point=nothing, pareto=false, color, width, dash, cap, compound, join, miterLimit) -> ChartEx
setSeriesLine(c::ChartEx, i, :none; point=nothing, pareto=false)
setSeriesLine(c::ChartEx, i, :inherit; point=nothing, pareto=false)Set several outline properties of series i, or of one data point of it, in one rebuild of the chart part. A keyword left unspecified is left alone; pass :inherit to remove one that is set. With pareto = true, series i's Pareto line instead; an error if it has none.
The symbol form acts on the whole outline: :none writes an a:ln whose fill is <a:noFill/>, and :inherit removes the a:ln so the chart style supplies it.
Returns c, which remains valid.
XLSX.Charts.setSeriesLineColor — Function
setSeriesLineColor(c, i, color) -> ChartSet the color of series i's outline. Takes the same values as setSeriesFill: a color, a SchemeColor, :none for an explicit <a:noFill/>, or :inherit to remove it.
Note :none here leaves the a:ln in place with no fill — the line exists and draws nothing, which is what Excel writes and is distinct from setSeriesLine(c, i, :inherit), which removes the outline entirely.
setSeriesLineColor(c::ChartEx, i, color; point=nothing, pareto=false) -> ChartExSet the colour of series i's outline, or of one data point of it. color takes the same values as setSeriesFill: :none writes an outline with <a:noFill/>, :inherit removes the colour and leaves the rest of the a:ln. With pareto = true, series i's Pareto line instead; an error if it has none.
XLSX.Charts.setSeriesLineWidth — Function
setSeriesLineWidth(c, i, points) -> ChartSet the width of series i's outline, in points — the unit Excel's width box uses. :inherit removes the width so the chart style supplies it.
DrawingML caps a line width at 1584 pt; a wider one is rejected rather than written.
One of the single-property line setters; setSeriesLine sets several at once in a single rebuild.
XLSX.Charts.setSeriesLineDash — Function
setSeriesLineDash(c, i, dash) -> ChartSet the dash pattern of series i's outline: "solid", "dash", "sysDot" and the other DrawingML presets, or Excel's own names for them. :inherit removes the pattern.
One of the single-property line setters; see setSeriesLine.
XLSX.Charts.setSeriesLineCap — Function
setSeriesLineCap(c, i, cap) -> ChartSet how series i's outline ends: "rnd", "sq" or "flat", or Excel's names for them. :inherit removes the setting.
One of the single-property line setters; see setSeriesLine.
XLSX.Charts.setSeriesLineCompound — Function
setSeriesLineCompound(c, i, cmpd) -> ChartSet the compound line type of series i's outline — how many parallel strokes it draws: "sng", "dbl", "thickThin", "thinThick" or "tri", or Excel's names for them. :inherit removes the setting.
One of the single-property line setters; see setSeriesLine.
XLSX.Charts.setSeriesLineJoin — Function
setSeriesLineJoin(c, i, join) -> ChartSet how the segments of series i's outline meet: :round, :bevel or :miter. :inherit removes the join. Excel uses the same three words, so there are no aliases.
A miter join takes a limit as well, set separately with setSeriesLineMiterLimit; changing the join afterwards discards it.
One of the single-property line setters; see setSeriesLine.
XLSX.Charts.setSeriesLineMiterLimit — Function
setSeriesLineMiterLimit(c, i, limit) -> ChartSet the miter limit of series i's outline, as a multiple of the line width: how far a sharp corner may extend before the join is cut off. Excel's default is
:inheritremoves the limit.
The limit belongs to the a:miter element, so the series' outline must already have a miter join (setSeriesLineJoin); otherwise this throws.
One of the single-property line setters; see setSeriesLine.
XLSX.Charts.hasFill — Function
hasFill(x) -> BoolWhether x sets a visible fill. x is a DrawingShapeProps, a DrawingFill, or the Effective a resolver returns.
false covers two different cases: nothing was written, so the fill is inherited; or <a:noFill/> was, so it is deliberately transparent. Read sp.fill, or e.value, to tell those apart — nothing for the first, a fill with kind === :none for the second.
false never means Excel draws nothing: a property written at no rung comes from the chart style, which this layer does not read.
XLSX.Charts.hasLine — Function
hasLine(x) -> BoolWhether x sets a visible outline. x is a DrawingShapeProps, a DrawingLine, or the Effective a resolver returns.
false when a:ln is absent, so the outline is inherited, and also when it contains <a:noFill/>, which is how Excel writes "no border". As with hasFill, read the line itself to tell those apart.
false never means Excel draws nothing: a property written at no rung comes from the chart style, which this layer does not read.
Chart groups
XLSX.Charts.getGroupAxes — Function
getGroupAxes(c::Chart, g::ChartGroup) -> Vector{ChartAxis}The axes named by g's c:axId children, in that order. Empty for pie and doughnut groups, which have no axes. An id that names no axis in the plot area is skipped rather than raising — malformed files exist.
XLSX.Charts.getGroupLabelTextProps — Function
getGroupLabelTextProps(c::Chart, g::ChartGroup) -> Union{Nothing,DrawingText}Group-level data label text (c:barChart/c:dLbls/c:txPr). This is the inheritance parent for the series-level c:dLbls; Excel commonly writes a group c:dLbls carrying only the show* flags and no txPr, in which case this is nothing.
XLSX.Charts.getGroupDropLines — Function
getGroupDropLines(c::Chart, g::ChartGroup) -> Union{Nothing,DrawingShapeProps}Line properties of the group's drop lines (c:dropLines), which run from each data point down to the category axis. nothing means the group has no drop lines. Line, area and stock charts.
XLSX.Charts.getGroupHiLowLines — Function
getGroupHiLowLines(c::Chart, g::ChartGroup) -> Union{Nothing,DrawingShapeProps}Line properties of the group's high-low lines (c:hiLowLines), which span between the highest and lowest series at each category. Line and stock charts.
XLSX.Charts.getGroupSeriesLines — Function
getGroupSeriesLines(c::Chart, g::ChartGroup) -> Union{Nothing,DrawingShapeProps}Line properties of the group's series lines (c:serLines), which connect segments across categories on a stacked bar or an of-pie chart.
XLSX.Charts.getGroupUpDownBars — Function
getGroupUpDownBars(c::Chart, g::ChartGroup) -> Union{Nothing,ChartUpDownBars}The group's up-down bars (c:upDownBars), which span between the first and last series at each category. nothing means the group has none. Line and stock charts.
The result carries the gap width and is the handle the two formatting getters take: getUpBarShapeProps and getDownBarShapeProps.
XLSX.Charts.getUpBarShapeProps — Function
getUpBarShapeProps(c::Chart, b::ChartUpDownBars) -> Union{Nothing,DrawingShapeProps}Fill and border of the up bars (c:upBars/c:spPr). nothing means c:upBars was written with no formatting, or not written at all — Excel writes an empty <c:upBars/> for default white bars. The two cases differ only in the XML; both draw Excel's default bars.
XLSX.Charts.getDownBarShapeProps — Function
getDownBarShapeProps(c::Chart, b::ChartUpDownBars) -> Union{Nothing,DrawingShapeProps}Fill and border of the down bars (c:downBars/c:spPr), as getUpBarShapeProps is for the up bars.
XLSX.Charts.setGroupLabelTextProp — Function
setGroupLabelTextProp(c, g::ChartGroup, field, value) -> ChartSet one text property of a chart group's data labels — the rung every series in the group inherits from.
XLSX.Charts.getGroupGapWidth — Function
getGroupGapWidth(c::Chart, g::ChartGroup) -> Union{Nothing,Int}c:gapWidth — the space between bars or clusters, as a percentage of a bar's width (0–500). nothing means not written; Excel then uses 150. Bar and bar-of-pie groups only.
XLSX.Charts.setGroupGapWidth — Function
setGroupGapWidth(c, g, percent) -> ChartSet the group's gap width (0–500, as Excel's "Gap Width" box), or :inherit to remove it.
XLSX.Charts.getGroupOverlap — Function
getGroupOverlap(c::Chart, g::ChartGroup) -> Union{Nothing,Int}c:overlap — how far bars in a cluster overlap, as a percentage from -100 (separated by a bar's width) to 100 (fully overlapping, as stacked charts need). nothing means not written. 2-D bar groups only.
XLSX.Charts.setGroupOverlap — Function
setGroupOverlap(c, g, percent) -> ChartSet the group's overlap (-100 to 100), or :inherit to remove it. Stacked groups need 100 for each series to sit on the one before it.
Creating charts
XLSX.Charts.addChart — Function
addChart(ws::Worksheet, kind::Symbol; anchor, title=nothing) -> ChartAdd an empty chart of kind to ws, covering the cells in anchor (a range such as "F2:M18"). Add data with addSeries.
kind is one of :column, :bar, :stackedColumn, :stackedBar, :line, :lineMarkers, :area, :pie, :doughnut, :scatter, :bubble or :radar. :bar and :stackedBar are horizontal; :column and :stackedColumn vertical. The chart starts as Excel's own default for that kind, formatted by the workbook's theme.
title is nothing for Excel's automatic title, a string for typed text, or false for no title.
addChart(xf::XLSXFile, kind::Symbol; sheetname="", title=nothing) -> ChartAdd an empty chart of kind on a new chartsheet, placed after the existing sheets. sheetname defaults to Chart1, Chart2, … as Excel names them. See the worksheet method for kind and title.
XLSX.Charts.addChartEx — Function
addChartEx(ws::Worksheet, kind::Symbol, values; anchor, categories=nothing,
name=nothing, name_ref=nothing, title=nothing) -> ChartEx
addChartEx(xf::XLSXFile, kind::Symbol, values; sheetname="", …) -> ChartExAdd a chartEx chart of kind — :waterfall, :funnel, :treemap, :sunburst, :histogram, :pareto or :boxWhisker — plotting values, to a worksheet or as a new chartsheet.
Unlike addChart, this takes the first series' data: a chartEx part must contain data, so an empty one cannot exist. A box & whisker chart takes further series with addSeries; every other layout takes one.
categories are the category labels; treemap and sunburst require them, as one column per hierarchy level ("A2:B8"), and a histogram takes none. References, name, name_ref and title are as for addChart and addSeries. The chart's appearance comes from Excel's style for the layout.
XLSX.Charts.addSeries — Function
addSeries(c::Chart, values; categories=nothing, name=nothing, name_ref=nothing,
bubble_sizes=nothing, markers=nothing, smooth=nothing, line=nothing,
color=nothing) -> ChartAdd a series to c, plotting values. Each reference is a range string ("B2:B5"), a defined name, or a reference object; an unqualified range means the chart's own sheet, and a chart on a chartsheet must name one ("Data!B2:B5").
categories are the category labels, or the X values on a scatter or bubble chart; a bubble chart requires them, and bubble_sizes too. name is literal text for the series name, and name_ref a cell to take it from; pass one or neither.
To plot a table column, pass gettablerange(t, column) for either values or categories
markers (line, lineMarkers, radar and scatter) is a symbol such as :circle, or false for none. smooth (line, lineMarkers and scatter) curves the line. line (scatter) joins the points.
color overrides the series' automatic colour, and takes the same values as setSeriesFill: a colour name ("red" or :red), a hex colour ("FF0000", "#FF0000" or "FFFF0000"), a Colors.Colorant, a SchemeColor, or a scheme name such as "accent4". It does not apply to pie and doughnut charts, whose points are coloured individually.
The cells' current values are cached in the chart, as Excel does, so the series reads back without opening the file in Excel. Series take the theme's accent colours in turn; on a pie or doughnut chart each point does instead.