API reference: charts

Charts are LibreOffice's embedded chart objects. The chart functions are in a submodule:

using OpenDocumentSpreadsheets.Charts

A few names are also available at the top level: getCharts, getChart, getChartData, getChartRanges, getChartType, getChartSchema and the chart types.

The functions read a chart as it is now: after the edits and structural operations made since the file was read. A series' values are read from its cells, as LibreOffice draws them.

OpenDocumentSpreadsheets.Charts — Module
OpenDocumentSpreadsheets.Charts

Charts: LibreOffice's embedded chart objects. Make, format and read a file's charts, with LibreOffice's behaviour.

using OpenDocumentSpreadsheets.Charts

A chart is an object (Object 1/content.xml) framed in a sheet. The functions read it as it is now, after the edits and structural operations made since the file was read.

source

Creating charts

A chart added here takes LibreOffice's default look (its colours, symbols, fonts and legend). It is a frame anchored in its first cell and resizing with its cells, and its references follow inserts, deletes and sheet operations as LibreOffice moves them.

OpenDocumentSpreadsheets.Charts.addChart — Function
addChart(ws::Worksheet, kind::Symbol; anchor, title = nothing, xtitle = nothing, ytitle = nothing,
         subtitle = nothing, threeD = false, deep = false) -> Chart (a ChartEx for :histogram)

A new chart of kind over the cells of anchor ("F2:M18"), with no series yet (add them with addSeries): a frame in the first cell, resizing with its cells up to the last, and an object in LibreOffice's default look.

kind = :histogram makes LibreOffice's histogram, which counts the values of its one series in bins: it returns a ChartEx, and takes only anchor, title, subtitle, xtitle and ytitle. See addSeries and setSeriesBinning.

kind is one of :column, :bar, :stackedColumn, :stackedBar, :percentStackedColumn, :percentStackedBar, :line, :lineMarkers, :stackedLine, :percentStackedLine, :stackedLineMarkers, :percentStackedLineMarkers, :area, :stackedArea, :percentStackedArea, :pie, :doughnut, :scatter, :bubble, :radar, :filledRadar, :combo (LibreOffice's column and line chart), :pieOfPie, :barOfPie, and the stock charts :stock (low, high, close), :stockOHLC (open, low, high, close, as candlesticks), :stockVolume and :stockVolumeOHLC (a volume series first, in columns on the left axis). A stock chart's series are added in that order.

title is text (nothing or false: none; LibreOffice has no automatic title). xtitle and ytitle title the axes (not on a pie or doughnut). LibreOffice's titles can't follow a cell: a CellRef is an error.

More options:

  • subtitle; threeD and deep for a 3-D chart; dataTable = true for a data table under the plot;
  • interpolation of line, XY and radar lines: :straight, :smooth, :bspline, :stepStart, :stepEnd, :stepCenterX, :stepCenterY;
  • emptyCells: :gap, :zero or :span (joined over); includeHidden: whether hidden cells are drawn; sortByX: an XY chart's points sorted by x;
  • startAngle of a pie or doughnut: degrees anticlockwise from three o'clock (LibreOffice's; 90 starts at twelve);
  • data, LibreOffice's chart wizard: a range whose series are made at once, in columns or rows (seriesIn = :columns or :rows), the first row and column holding names and categories (firstRowLabels, firstColumnLabels, both true by default).
using OpenDocumentSpreadsheets.Charts

ods = openods("budget.ods"; mode = "rw")
sh = ods["Costs"]
c = addChart(sh, :column; anchor = "E2:L18", title = "Costs by month", ytitle = "Amount")
addSeries(c, "B2:B13"; categories = "A2:A13", name_ref = "B1")

addChart(ods["Income"], :line; anchor = "E2:L18", data = "A1:B13")  # its series from a range
saveods(ods)
source
addChart(ods::ODSFile, kind::Symbol; sheetname = "", title = nothing, xtitle = nothing, ytitle = nothing,
         kw...) -> Chart

A chart on a new chart sheet (a ChartEx for :histogram): LibreOffice's form of one, an ordinary sheet named sheetname (by default Chart1, Chart2, …) holding the chart anchored to the page, after the other sheets. Add its series with addSeries, naming their sheet ("Data!B2:B7"). The other keywords are addChart's, but data (whose cells would be the chart sheet's).

source
OpenDocumentSpreadsheets.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, group = nothing) -> Chart

Adds a series to a chart, in LibreOffice's form:

  • values (and categories, name_ref, bubble_sizes) are references: "Data.B2:B7", "Data!B2:B7", "B2:B7" (on the chart's sheet), or a range object.
  • categories are the x axis's (a chart's, not a series': a different range later is an error), or an XY or bubble series' x values. bubble_sizes is required on a bubble chart.
  • name is the series' name as text (loext:label-string), name_ref a cell holding it.
  • markers (true, false or a symbol: :circle, :square, :diamond, :triangle, :x, :plus, :star, :dash, :dot, :none, :auto, and LibreOffice's :arrowDown, :arrowLeft, :bowTie, :hourglass, :loStar, :vBar) on line, radar and XY series; :picture is an error (no picture).
  • smooth on line and XY series: LibreOffice smooths a chart's lines all or none, so a series that differs from those before is an error.
  • line joins an XY series' points.
  • color (hex, a colour name, or a theme colour such as :accent1) is the series' colour (not on a pie or doughnut, whose points are coloured one by one).
  • group (:column or :line) is required on a :combo chart and refused elsewhere.
using OpenDocumentSpreadsheets.Charts

ods = openods("budget.ods"; mode = "rw")
sh = ods["Income"]
sh["D1"] = "Target"
for r in 2:13; sh[r, 4] = 1100.0; end
c = addChart(sh, :lineMarkers; anchor = "F2:M18")
addSeries(c, "B2:B13"; categories = "A2:A13", name_ref = "B1", color = "1F4E79")
addSeries(c, "D2:D13"; name = "Target", markers = false)
saveods(ods)
source
addSeries(c::ChartEx, values; name = nothing, name_ref = nothing) -> ChartEx

Adds a histogram's series: the cells whose values it counts ("Data.B2:B201", "B2:B201" on the chart's sheet, or a range object), with its name as text (name) or from a cell (name_ref). A histogram has one series, and no categories: LibreOffice draws its bins from its values.

source
OpenDocumentSpreadsheets.Charts.makeCombo — Function
makeCombo(c::Chart) -> Chart

Makes a :column, :stackedColumn or :line chart of two or more series LibreOffice's column and line chart: its last series becomes a line on a secondary y axis, the others clustered columns.

source
OpenDocumentSpreadsheets.Charts.deleteChart — Function
deleteChart(c::AbstractChart) -> Nothing

Removes a chart: its frame and, at the next save, its object. A chart anchored to the page (not to a cell) can't be removed, as pictures on the page can't.

source

Histograms and chart sheets

addChart(…, :histogram) makes a histogram, and addSeries adds its one series; its handle is a ChartEx. addChartEx makes the same chart in one call; the other kinds it names are charts LibreOffice doesn't have, so asking for them is an error. A chart sheet is an ordinary sheet holding one chart anchored to the page.

OpenDocumentSpreadsheets.Charts.addChartEx — Function
addChartEx(ws::Worksheet, kind::Symbol, values; anchor, categories = nothing, name = nothing,
           name_ref = nothing, title = nothing) -> ChartEx
addChartEx(ods::ODSFile, kind::Symbol, values; sheetname = "", …) -> ChartEx

A histogram of values (kind = :histogram), on a sheet or on a new chart sheet: the same as addChart(ws, :histogram; anchor, title) followed by addSeries(h, values; name, name_ref), the form these docs use. The other kinds, :waterfall, :funnel, :treemap, :sunburst, :pareto and :boxWhisker, are charts LibreOffice doesn't have, so they are errors. A histogram takes no categories, and LibreOffice draws its bins from its values (set them with setSeriesBinning, under setSeriesName).

A chart sheet is LibreOffice's form of one: an ordinary sheet, named sheetname (by default Chart1, Chart2, …), holding the chart anchored to the page. Its references name their sheet ("Data!B2:B7"), since the chart sheet's cells hold nothing.

source
OpenDocumentSpreadsheets.Charts.addChart — Method
addChart(ods::ODSFile, kind::Symbol; sheetname = "", title = nothing, xtitle = nothing, ytitle = nothing,
         kw...) -> Chart

A chart on a new chart sheet (a ChartEx for :histogram): LibreOffice's form of one, an ordinary sheet named sheetname (by default Chart1, Chart2, …) holding the chart anchored to the page, after the other sheets. Add its series with addSeries, naming their sheet ("Data!B2:B7"). The other keywords are addChart's, but data (whose cells would be the chart sheet's).

source
OpenDocumentSpreadsheets.Charts.getChartSeriesCount — Function
getChartSeriesCount(c::ChartEx) -> Int
getSeriesLayout(c::ChartEx, i) -> Symbol
getSeriesName(c::ChartEx, i) / getSeriesNameRange(c::ChartEx, i)
getChartDataBlocks(c::ChartEx) / getSeriesData(c::ChartEx, i)
getSeriesHidden(c::ChartEx, i) / getSeriesAxisIds(c::ChartEx, i) / getChartAxisIds(c::ChartEx)
getLabelPosition(c::ChartEx, i) / getSeriesBinning(c::ChartEx, i)

A histogram's series: its layout is :clusteredColumn, its data one dimension of values (data blocks numbered from 0, one per series), its axes [0, 1]; it is never hidden. Its binning is LibreOffice's: a width or a count, or :auto for both when LibreOffice chooses. pareto = true is an error: LibreOffice has no pareto charts.

source
OpenDocumentSpreadsheets.Charts.setSeriesName — Function
setSeriesName(c::ChartEx, i, name) -> ChartEx
setSeriesBinning(c::ChartEx, i; binSize = nothing, binCount = nothing, intervalClosed = nothing,
                 underflow = nothing, overflow = nothing) -> ChartEx

A histogram's series name (text), and its bins: a width (binSize) or a count (binCount), or :auto (LibreOffice chooses); :inherit is :auto. LibreOffice's bins have no closed side, underflow or overflow bin: those are errors. The other setters for a histogram's handle (setSeriesSubtotals, setSeriesAggregation, setSeriesQuartileMethod, setSeriesParentLabelLayout, setSeriesLayoutFlag) are for chart kinds LibreOffice doesn't have: errors.

source
OpenDocumentSpreadsheets.Charts.getSeriesSubtotals — Function
getSeriesSubtotals(c::ChartEx, i) / getSeriesAggregation(c::ChartEx, i) / getSeriesQuartileMethod(c::ChartEx, i)
getSeriesParentLabelLayout(c::ChartEx, i) / getSeriesLayoutFlag(c::ChartEx, i, flag)

Getters for chart kinds LibreOffice doesn't have (waterfall, box and whisker, treemap): a histogram has none of these settings, so nothing.

source
OpenDocumentSpreadsheets.Charts.ChartExDimension — Type
ChartExDimension, ChartExData, ChartExBinning

A histogram's data and its bins. LibreOffice's histogram has one dimension, its values (kind :num, type :val, formula the ODF range, range its ChartRange); its binning is a bin width or a bin count (intervalClosed, underflow and overflow are always nothing: LibreOffice has none).

source
OpenDocumentSpreadsheets.Charts.ChartExData — Type
ChartExDimension, ChartExData, ChartExBinning

A histogram's data and its bins. LibreOffice's histogram has one dimension, its values (kind :num, type :val, formula the ODF range, range its ChartRange); its binning is a bin width or a bin count (intervalClosed, underflow and overflow are always nothing: LibreOffice has none).

source
OpenDocumentSpreadsheets.Charts.ChartExBinning — Type
ChartExDimension, ChartExData, ChartExBinning

A histogram's data and its bins. LibreOffice's histogram has one dimension, its values (kind :num, type :val, formula the ODF range, range its ChartRange); its binning is a bin width or a bin count (intervalClosed, underflow and overflow are always nothing: LibreOffice has none).

source

Changing formatting

The setters change LibreOffice's chart styles, for charts added here and for a file's own charts. Each returns the chart, and :inherit removes a setting. What LibreOffice can't store is an error: compound lines, joins and miter limits; a marker's own fill or border; bubble-size labels; text capitals, kerning sizes and outlines; a minor unit that doesn't divide the major one. Theme colours are resolved against the document's theme: LibreOffice keeps colours in a chart, not links to the theme. A line, XY or radar series has one colour, its line's and its symbols'.

OpenDocumentSpreadsheets.Charts.setSeriesFill — Function
setSeriesFill(c::AbstractChart, i, color; transparency = nothing, gradient = nothing, gradientStyle = :linear,

gradientAngle = 0, hatch = nothing, hatchAngle = 0) -> Chart

Series i's fill: a colour (hex, a colour name, a theme colour such as :accent1 or a SchemeColor), :none, or :inherit (LibreOffice's default). Also: transparency, 0 to 100 percent; a gradient from color to gradient (another colour), of gradientStyle (:linear, :axial, :radial, :ellipsoid, :square, :rectangular) at gradientAngle degrees; or a hatch (:single, :double, :triple) of lines of color at hatchAngle degrees. A line, XY or radar series has one colour, its line's and its symbols' (LibreOffice's): its fill is its line colour, and :none, transparency, gradients and hatches are errors.

source
OpenDocumentSpreadsheets.Charts.setSeriesLine — Function
setSeriesLine(c::AbstractChart, i; color, width, dash, cap, compound, join, miterLimit) -> Chart
setSeriesLine(c::AbstractChart, i, :none | :inherit) -> Chart
setSeriesLineColor / setSeriesLineWidth / setSeriesLineDash / setSeriesLineCap(c, i, value) -> Chart
setSeriesLineCompound / setSeriesLineJoin / setSeriesLineMiterLimit(c, i, value) -> error

Series i's line: a colour, a width in points, a dash (:solid, :dot, :dash, :lgDash (long), :dashDot, :lgDashDot, :lgDashDotDot, :sysDash, :sysDot, :sysDashDot, :sysDashDotDot; the sys ones are denser), a cap (:rnd round, :sq square, :flat). LibreOffice's chart lines have no compound lines, joins or miter limits: those are errors.

source
OpenDocumentSpreadsheets.Charts.setMarker — Function
setMarker(c::AbstractChart, i; point = nothing, symbol = nothing, size = nothing, fill = nothing, lineColor = nothing,
          lineWidth = nothing) -> Chart
setMarkerSymbol(c, i, symbol; point = nothing) / setMarkerSize(c, i, size; point = nothing) -> Chart
setMarkerFill / setMarkerLineColor / setMarkerLineWidth(c, i, value; point = nothing) -> error

A line, XY or radar series' (or point's, from 1) symbol and size (2 to 72 points). Symbols are :circle, :square, :diamond, :triangle, :x, :plus, :star, :dash, :dot, :none, :auto, :arrowDown, :arrowLeft, :bowTie, :hourglass, :loStar and :vBar. LibreOffice draws a symbol in its series' colours: a fill or border of its own is an error.

source
OpenDocumentSpreadsheets.Charts.setLabelFlag — Function
setLabelFlag(c, i, flag, on) -> Chart

Whether series i's labels show flag: :value, :percent, :categoryName, :seriesName, :legendKey. LibreOffice has no bubble-size labels: :bubbleSize is an error.

source
OpenDocumentSpreadsheets.Charts.setChartTitleText — Function
setChartTitleText(c, text) -> Chart
setAxisTitleText(c, ax, text) -> Chart

The chart's (or an axis') title: a string (a line break starts a paragraph) or a DrawingText. LibreOffice's titles can't follow a cell: a CellRef is an error.

source
OpenDocumentSpreadsheets.Charts.setChartTitleTextProp — Function
setChartTitleTextProp(c, field, value) / setAxisTitleTextProp(c, ax, field, value) / setLegendTextProp(c, field, value)
setAxisTextProp(c, ax, field, value) / setLabelTextProp(c, i, field, value) / setLabelTextProp(c, i, point, field, value)
setGroupLabelTextProp(c, g, field, value) / setChartSpaceTextProp(c, field, value) -> Chart

One text property of a part of the chart. Fields: :size (points), :bold, :italic, :under (:underline), :strike (:strikethrough), :baseline (a fraction of the size), :spacing (points), :fill (:color), :latin (:font), :ea, :cs, :lang; :inherit removes one. LibreOffice's chart text has no capitals setting, kerning size or coloured outline: :caps, :kern and :line are errors. The chart space's text (setChartSpaceTextProp) is set on its series' labels.

source
OpenDocumentSpreadsheets.Charts.setLegendPos — Function
setLegendPos(c, pos; overlay = nothing, expansion = nothing) -> Chart
setLegendOverlay(c, overlay) -> Chart
setLegendEntryDeleted(c, positions, deleted) -> Chart

The legend's place: :b (bottom), :t, :l, :r, and the corners :tr, :tl, :bl, :br; a corner is a custom position in that corner of the chart. :inherit removes the position, which LibreOffice reads as :r. Whether the legend may overlap the plot area, and the series whose entries are hidden. The first two make a legend if the chart has none. expansion shapes the legend: :wide, :high or :balanced (not for a corner).

source
OpenDocumentSpreadsheets.Charts.setAxisScaling — Function
setAxisScaling(c, ax; orientation, min, max) / setAxisMin / setAxisMax / setAxisOrientation -> Chart
setAxisLogBase(c, ax, 10 | :inherit) -> Chart
setAxisCrosses(c, ax, rule) / setAxisCrossesAt(c, ax, value) -> Chart
setAxisMajorUnit / setAxisMinorUnit(c, ax, value) -> Chart
setAxisTickLabelPos(c, ax, pos) / setAxisMajorTickMark / setAxisMinorTickMark(c, ax, mark) -> Chart
setAxisGridlines(c, ax; major, minor) / setAxisLine(c, ax; …) / setAxisNumberFormatCode(c, ax, code)
setAxisNumberFormatLinked(c, ax, linked) -> Chart

An axis' scale and look, in LibreOffice's form. LibreOffice stores a minor unit as the number of minor intervals in a major one: it needs a major unit it divides.

source
OpenDocumentSpreadsheets.Charts.SchemeColor — Type
SchemeColor(token; lumMod = nothing, lumOff = nothing, satMod = nothing, shade = nothing, tint = nothing,
            alpha = nothing)
SchemeColor(token, transforms)

A theme colour: a token (:bg1, :tx1, :bg2, :tx2, :accent1 … :accent6, :hlink, :folHlink, or the aliases :lt1, :dk1, :lt2, :dk2) and transforms in percent, applied in order. It resolves to the document's theme (LibreOffice's, for a new document) and is written as LibreOffice's theme reference, so LibreOffice follows a change of theme. LibreOffice keeps lumMod, lumOff, tint and shade; alpha is a fill's transparency; satMod is an error.

source

Trendlines, error bars and more

Trendlines and error bars, explosion and axis label arrangement. addChart's own options (stock charts, interpolation, empty and hidden cells, the data table, the chart wizard's data and seriesIn) are under addChart.

OpenDocumentSpreadsheets.Charts.addSeriesTrendline — Function
addSeriesTrendline(c, i, kind = :linear; order, period, name, forward, backward, intercept,
             displayEquation = false, displayRSquared = false) -> Chart
deleteSeriesTrendlines(c, i) -> Chart

A trendline on series i, LibreOffice's Insert ▸ Trend Line: kind :linear, :log, :exp, :power, :poly (with order, 2 to 6) or :movingAvg (with period); its name; extrapolation forward and backward; a forced intercept; the equation and R² shown.

source
OpenDocumentSpreadsheets.Charts.setSeriesErrorBars — Function
setSeriesErrorBars(c, i; type, value, plus, minus, bars = :both, direction = :y) -> Chart
deleteSeriesErrorBars(c, i) -> Chart

Error bars on series i, LibreOffice's Insert ▸ Y Error Bars: type :fixed, :percent or :stdDev (with value), :stdErr, or :range (with the cells plus and minus); bars :both, :plus or :minus; direction :y or :x (XY charts).

source
OpenDocumentSpreadsheets.Charts.setAxisLabelArrangement — Function
setAxisLabelArrangement(c, ax; stagger = nothing, overlap = nothing, breakText = nothing) -> Chart

LibreOffice's label options of an axis: stagger (:odd, :even, :none), whether labels may overlap, and whether they may break into lines.

source

Finding charts

OpenDocumentSpreadsheets.Charts.getCharts — Function
getCharts(ws::Worksheet) -> Vector{AbstractChart}
getCharts(ods::ODSFile) -> Vector{AbstractChart}

The charts on a sheet, or in a file (sheet by sheet), as they are now: those made in LibreOffice, those it made when it opened a file in another format, and those added here. A histogram is a ChartEx, the others are Charts. A chart anchored to the page reports the cells its position falls in.

source
OpenDocumentSpreadsheets.Charts.getChart — Function
getChart(ws::Worksheet, name) -> AbstractChart
getChart(ods::ODSFile, name) -> AbstractChart

The chart named name: its object's name ("Object 1"), its path ("Object 1/content.xml"), or its frame's name (the name LibreOffice's Navigator shows). An error lists the names there are.

source
OpenDocumentSpreadsheets.Charts.getChartKind — Function
getChartKind(c) -> Symbol

The chart's kind, as addChart names it: addChart(sheet, getChartKind(c); …) makes a chart of the same type, as LibreOffice's Chart Type dialog shows it. It works on any chart, whatever made it.

  • Column, bar and area charts: :column or :bar (bars across), each also :stacked… or :percentStacked…; :area, :stackedArea, :percentStackedArea.
  • Lines: :line, :stackedLine, :percentStackedLine, with Markers when the chart's lines have points (:lineMarkers, :stackedLineMarkers, …).
  • Others: :pie, :doughnut, :pieOfPie, :barOfPie, :scatter, :bubble, :radar, :filledRadar, :histogram.
  • Stock charts: :stock, :stockOHLC (candlesticks), :stockVolume, :stockVolumeOHLC.
  • :combo: a column chart with line series (LibreOffice's column and line), stacked or not.
  • :unknown: a chart LibreOffice reads without a diagram.

A few of LibreOffice's types have no kind of their own and give the nearest: XY with lines only is :scatter, and a net with points is :radar. 3-D isn't part of the kind: getChartTypes gives a 3-D chart's 3-D type.

using OpenDocumentSpreadsheets.Charts

ods = openods("budget.ods"; mode = "rw")
c = addChart(ods["Costs"], :stackedBar; anchor = "E2:L18")
getChartKind(c)           # :stackedBar
getChartTypes(c)          # [:barChart]
source
OpenDocumentSpreadsheets.Charts.getChartTypes — Function
getChartTypes(c::Chart) -> Vector{Symbol}

The types of the chart's groups of series, one for each type the chart combines. They are broader than addChart's kinds:

addChart kindgetChartTypes
:column, :bar and their stacked forms[:barChart]
:line, :lineMarkers and their stacked forms[:lineChart]
:area and its stacked forms[:areaChart]
:pie, :doughnut[:pieChart], [:doughnutChart]
:pieOfPie, :barOfPie[:ofPieChart]
:scatter, :bubble[:scatterChart], [:bubbleChart]
:radar, :filledRadar[:radarChart]
:stock, :stockOHLC[:stockChart]
:stockVolume, :stockVolumeOHLC[:barChart, :stockChart]
:combo[:barChart, :lineChart]

A 3-D chart (threeD = true) gives the 3-D type: :bar3DChart, :line3DChart, :area3DChart, :pie3DChart. getChartKind gives the addChart kind itself: whether bars run up or across, the stacking and the markers.

source
OpenDocumentSpreadsheets.Charts.getChartGroups — Function
getChartGroups(c::Chart) -> Vector{ChartGroup}

The chart's groups: its series of one type on one pair of axes (LibreOffice's column and line chart has two). ODF has no group element, so raw is nothing.

source
OpenDocumentSpreadsheets.Charts.getChartTitle — Function
getChartTitle(c::AbstractChart) -> Union{Nothing,String}

The chart's title as text (paragraphs joined by "\n"), or nothing when it has none. LibreOffice has no automatic titles and no titles bound to cells.

source

Series and data

OpenDocumentSpreadsheets.Charts.getChartSeries — Function
getChartSeries(c::AbstractChart) -> Vector{ChartSeries}

The chart's series in order, each with its name, categories (x values on XY and bubble charts), values and bubble sizes, read from the cells now.

source
OpenDocumentSpreadsheets.Charts.getChartRanges — Function
getChartRanges(c::AbstractChart) -> Vector{NamedTuple}
getChartRanges(x::Union{Worksheet,ODSFile}, name) -> Vector{NamedTuple}
getChartRanges(x::Union{Worksheet,ODSFile}) -> Vector{Tuple{String,Vector{NamedTuple}}}

The ranges of each series: idx, name, categories, values and bubble_sizes, each a ChartRange. Without a name, every chart's: (chart name, ranges).

LibreOffice keeps a chart's references even when their cells are deleted: they never become #REF!.

source
OpenDocumentSpreadsheets.Charts.getChartData — Function
getChartData(c::AbstractChart) -> DataTable
getChartData(x::Union{Worksheet,ODSFile}, name) -> DataTable

The chart's data as a DataTable (for DataFrame(...) or any Tables.jl sink), read from its cells now, as LibreOffice draws it: a categories column when every series shares the categories (else a <series>_x column before each series), one column per series (named by the series, else Series<i>), and <series>_size after a bubble series. Shorter columns are padded with missing.

source
OpenDocumentSpreadsheets.iserror — Method
iserror(r::ChartRef) -> Vector{Bool}
iserror(r::ChartRef, i) -> Bool
geterror(r::ChartRef) -> Vector{String}
geterror(r::ChartRef, i) -> String

Whether each value of a chart reference is an error, and its error text ("" where none). Every error kind is reported, since the values come from the cells.

source

Reading formatting

A chart's formatting is read from LibreOffice's chart styles into the types the setters take. Fields LibreOffice has no value for are nothing.

Titles, legend and chart

OpenDocumentSpreadsheets.Charts.getLegendPos — Function
getLegendPos(c) -> Union{Nothing,Symbol}

:b, :t, :l, :r or :tr, and the other corners :tl, :bl, :br; nothing without a legend. LibreOffice keeps a corner as a custom position: the corner given is the quarter of the chart the legend is in.

source
OpenDocumentSpreadsheets.Charts.getPlotAreaShapeProps — Function
getPlotAreaShapeProps(c) -> Union{Nothing,DrawingShapeProps}
getChartSpaceShapeProps(c) -> Union{Nothing,DrawingShapeProps}
getChartSpaceTextProps(c) -> Union{Nothing,DrawingText}

The plot area's fill and border (LibreOffice's wall), and the chart's background and text defaults.

source

Series, points and labels

OpenDocumentSpreadsheets.Charts.getSeriesGroup — Function
getSeriesGroup(c, i) -> ChartGroup
getGroupAxes(c, g) -> Vector{ChartAxis}
getSeriesAxes(c, i) -> Vector{ChartAxis}

The group series i is in, and the axes of a group or a series (none for a pie or doughnut).

source
OpenDocumentSpreadsheets.Charts.getSeriesDataLabels — Function
getSeriesDataLabels(c, i) -> Vector{ChartDataLabel}
getSeriesDataLabel(c, i, point) -> Union{Nothing,ChartDataLabel}

The points of series i whose labels differ from the series': those with custom text (a chart:data-label), and those whose style turns every label part off (delete).

source
OpenDocumentSpreadsheets.Charts.getDataLabelTextProps — Function
getDataLabelTextProps(c, d) / getDataLabelShapeProps(c, d) / getDataLabelText(c, d)
getDataLabelPosition(c, d) / getDataLabelOffset(c, d)

A point's label: its text properties, fill and border, custom text (custom label fields), placement (:bestFit, :ctr, :t, :b, :l, :r, :inEnd, :outEnd, :inBase) and offset (nothing: ODF has no offsets).

source
OpenDocumentSpreadsheets.Charts.getLabelFlag — Function
getLabelFlag(c, i, flag) -> Union{Nothing,Bool}

Whether series i's labels show flag: :value, :percent, :categoryName, :seriesName or :legendKey; nothing when its style doesn't say. LibreOffice has no bubble-size labels: :bubbleSize is always nothing.

source
OpenDocumentSpreadsheets.Charts.getSeriesFill — Function
getSeriesFill(c, i; point = nothing) -> Effective{DrawingFill}
getSeriesLine(c, i; point = nothing) -> Effective{DrawingLine}
getMarkerFill(c, i, point) -> Effective{DrawingFill}

The fill or line series i (or one of its points) is drawn with, found through LibreOffice's cascade: the point's style, then the series'. LibreOffice draws a symbol in its series' colours, so a marker's fill is the series' fill.

source

Trendlines, error bars and groups

OpenDocumentSpreadsheets.Charts.getSeriesTrendlines — Function
getSeriesTrendlines(c, i) -> Vector{ChartTrendline}
getTrendlineShapeProps(c, t) / getTrendlineLabelText(c, t) / getTrendlineLabelTextProps(c, t) / getTrendlineLabelShapeProps(c, t)

Series i's trendlines (chart:regression-curve), their line, and their equation's text and formatting.

source
OpenDocumentSpreadsheets.Charts.getSeriesErrorBars — Function
getSeriesErrorBars(c, i) -> Vector{ChartErrorBars}
getErrorBarsShapeProps(c, e) -> Union{Nothing,DrawingShapeProps}
getErrorBarsCustomRefs(c, e) -> (plus, minus)

Series i's error bars (chart:error-indicator), their line, and the cells of error bars from cell ranges (as ChartRefs).

source
OpenDocumentSpreadsheets.Charts.getGroupUpDownBars — Function
getGroupUpDownBars(c, g) -> Union{Nothing,ChartUpDownBars}
getUpBarShapeProps(c, b) / getDownBarShapeProps(c, b)

A stock group's candle bodies (LibreOffice's Japanese candlesticks), and the fill and line of rising and falling ones (chart:stock-gain-marker, chart:stock-loss-marker).

source

Axes

OpenDocumentSpreadsheets.Charts.getChartAxes — Function
getChartAxes(c::AbstractChart) -> Vector{ChartAxis}
getChartAxes(c::AbstractChart, role) -> Vector{ChartAxis}

The chart's axes (hidden ones too), or those of a role: :category, :value, :date, :series.

source
OpenDocumentSpreadsheets.Charts.getChartAxis — Function
getChartAxis(c::AbstractChart, which::Symbol) -> ChartAxis
getChartAxis(c::AbstractChart, axid::Integer) -> ChartAxis

One axis: :x, :y, :x2, :y2 or :z (as drawn: a bar chart's :x is its value axis, along the bottom), a role that names one axis, or its number.

source
OpenDocumentSpreadsheets.Charts.getAxisTitle — Function
getAxisTitle(c, ax) -> Union{Nothing,String}
getAxisTitleText(c, ax) -> Union{Nothing,DrawingText}
getAxisTitleTextProps(c, ax) -> Union{Nothing,DrawingText}
getAxisTitleRef(c, ax) / getAxisTitleRange(c, ax) -> Nothing

An axis's title: its text, as rich text, and its text properties. LibreOffice's titles can't follow a cell: the reference is always nothing.

source
OpenDocumentSpreadsheets.Charts.getAxisOrientation — Function
getAxisOrientation(c, ax) / getAxisMin(c, ax) / getAxisMax(c, ax) / getAxisLogBase(c, ax)

:minMax or :maxMin (reversed); the fixed minimum and maximum (nothing: automatic); 10 for a logarithmic axis (LibreOffice's are base 10), else nothing.

source
OpenDocumentSpreadsheets.Charts.getAxisCrosses — Function
getAxisCrosses(c, ax) -> Union{Nothing,Symbol}
getAxisCrossesAt(c, ax) -> Union{Nothing,Float64}

Where an axis crosses the axis it meets (chart:axis-position): :min (its start), :max (its end), :autoZero (at 0), or at a value.

source
OpenDocumentSpreadsheets.Charts.getAxisLabelAlign — Function
getAxisLabelAlign(c, ax) / getAxisLabelOffset(c, ax) / getAxisMultiLevelLabels(c, ax) / getAxisCrossBetween(c, ax)

nothing: ODF has no label alignment, offset, multi-level switch or crossing rule for an axis.

source

Types

OpenDocumentSpreadsheets.Charts.Chart — Type
Chart

A handle to one chart: its object and anchor. Its content is read from the chart as it is now, on each call.

Fields

  • package: the ODSFile.
  • path: the object's content, "Object 1/content.xml".
  • name: the object's name, "Object 1".
  • rId: always nothing (ODF has no relationships).
  • sheet: the sheet the chart is on.
  • from, to: the cells its frame starts and ends in (a page-anchored frame's, from its position).
source
OpenDocumentSpreadsheets.Charts.ChartEx — Type
ChartEx

A handle to a histogram, made with addChart(…, :histogram) or addChartEx, or found in a file. Fields as Chart's. In the file a histogram is an ordinary chart (a column chart whose values are counted in bins), so the chart setters and getters work on it as on a column chart: its fill and lines, titles, legend, labels, axes, gap width, trendlines and error bars. Its bins have functions of their own (setSeriesBinning, getSeriesBinning). As on a column chart, markers and explosion are errors, and a histogram can't be made a combo chart.

source
OpenDocumentSpreadsheets.Charts.ChartRef — Type
ChartRef

One reference of a chart series, with the values its cells hold now (LibreOffice draws a chart from its cells).

Fields

  • kind::Symbol: :num when every value is a number (or empty), else :str; :strLit for a series name given as text (loext:label-string).
  • ref::Union{Nothing,String}: the reference in this package's notation (Data.B2:B7); nothing for a literal.
  • format_code::Union{Nothing,String}: the number format of the first number ("General"…), or nothing.
  • ptCount::Int: the number of points (cells).
  • data::Vector: the values, missing for empty cells and errors.
  • errors::Dict{Int,String}: position => error text ("#DIV/0!"): every error.
source
OpenDocumentSpreadsheets.Charts.ChartSeries — Type
ChartSeries

One series (chart:series), as read. categories holds the chart's categories for category charts, and the series' x values for XY and bubble charts; values its values (y values); bubble_sizes a bubble series' sizes. idx and order are its place in the chart, from 0. charttype is its group's tag (:barChart…). raw is the element.

source
OpenDocumentSpreadsheets.Charts.ChartAxis — Type
ChartAxis

An axis: kind (:catAx, :valAx, :dateAx, :serAx), axid (1 primary x, 2 primary y, 3 secondary x, 4 secondary y, 5 z), pos (:b, :l, :t, :r), crossax (the axis it crosses), deleted (hidden).

source
OpenDocumentSpreadsheets.Charts.ChartMarker — Type
ChartMarker

A series' (or point's) symbol: symbol (:circle, :square, :diamond, :triangle, :x, :plus, :star, :dash, :dot, :none, :auto, :arrowDown, :arrowLeft, :bowTie, :hourglass, :loStar, :vBar), size in points, shape its fill and line (LibreOffice draws a symbol in its series' colours).

source
OpenDocumentSpreadsheets.Charts.ChartTrendline — Type
ChartTrendline

A series' trendline (chart:regression-curve): kind (:linear, :log, :exp, :power, :poly, :movingAvg), name, order (polynomial degree), period (moving average), forward/backward (extrapolation), intercept (when forced), disp_rsqr, disp_eq.

source
OpenDocumentSpreadsheets.Charts.ChartErrorBars — Type
ChartErrorBars

A series' error bars (chart:error-indicator): direction ("x", "y"), bar_type ("both", "plus", "minus"), value_type ("fixedVal", "percentage", "stdDev", "stdErr", "cust" for cell ranges), value, no_end_cap.

source
OpenDocumentSpreadsheets.Charts.DrawingColor — Type
DrawingColor

A colour as read: kind is :srgb, or :scheme for a colour that follows the document's theme (LibreOffice's loext:theme-type); val is "RRGGBB" or the theme slot ("accent1"); transforms are a theme colour's (:lumMod => 60000…, thousandths of a percent); rgb the colour as drawn, "RRGGBB"; alpha its opacity, 0 to 1.

source
OpenDocumentSpreadsheets.Charts.DrawingFill — Type
DrawingFill

A fill: kind is :none, :solid, :gradient, :pattern (a hatch) or :blip (a bitmap); fgcolor a solid fill's colour (a hatch's line colour); bgcolor a hatch's background; preset a hatch's, gradient's or bitmap's name.

source
OpenDocumentSpreadsheets.Charts.DrawingLine — Type
DrawingLine

A line: fill its colour (kind === :none for no line), width in points, dash ("solid" or the name of LibreOffice's dash), cap ("rnd", "sq", "flat"), join ("round", "bevel", "miter"). ODF has no compound lines or miter limits: compound and miter_limit are nothing.

source
OpenDocumentSpreadsheets.Charts.DrawingShapeProps — Type
DrawingShapeProps

The fill and line of a part of a chart (a series, a point, the wall, the chart, an axis line, the legend, gridlines). nothing means the style says nothing (LibreOffice's default applies); a DrawingFill of kind :none means none.

source
OpenDocumentSpreadsheets.Charts.DrawingRunProps — Type
DrawingRunProps

Character properties, from style:text-properties: lang ("de-DE"), size (points), bold, italic, under and strike (DrawingML's names: "sng", "dbl", "wavy"…, "sngStrike"…), caps ("small", "all"), baseline (a fraction of the size), spacing (points), fill (the colour), line (a text outline; LibreOffice's has no colour), and the fonts latin, ea and cs. ODF has no kerning size: kern is nothing.

source
OpenDocumentSpreadsheets.Charts.Effective — Type
Effective{T}

A value resolved through LibreOffice's cascade (a point's style, then its series'): value, the site it came from, and the chain of sites looked at. value is nothing when no style sets it (LibreOffice's default applies).

source

Sparklines

Sparklines are LibreOffice's sparkline groups. The functions are in the main module (addSparklines, not Charts.addSparklines). A sparkline follows its cell through inserts and deletes, and its data moves as a chart's does.

OpenDocumentSpreadsheets.Charts.addSparklines — Function
addSparklines(ws::Worksheet, location, data; type = :line, kw...)

A group of sparklines, small charts each in one cell: location is the cell, or the row or column of cells, to hold them, and data the cells they chart, on this sheet or another ("Data!B2:M13", "Data.B2:M13"):

  • one cell: one sparkline of a row or column of data;
  • a column of cells: one sparkline for each row of data (as many rows), or each column;
  • a row of cells: one sparkline for each column of data, or each row.

A sparkline already in one of the cells is replaced. The group's options: type (:line, :column, :winloss, which LibreOffice calls stacked), markers, high, low, first, last, negative (true by default for :winloss), axis, emptyCells (:gap, :zero, :span), showHidden, lineWeight (points, 0.75), min and max (:individual, :group or a number), rightToLeft, and the colours seriesColor, negativeColor, axisColor, markersColor, firstColor, lastColor, highColor, lowColor (hex, a colour name, a theme colour or a SchemeColor, resolved against the document's theme).

LibreOffice keeps no date range: dateRange is an error. A sparkline follows its cell through inserts and deletes, and its data moves as a chart's; LibreOffice itself leaves both where they were.

source
OpenDocumentSpreadsheets.Charts.getSparklines — Function
getSparklines(ws::Worksheet) -> Vector{NamedTuple}

A sheet's sparkline groups: sparklines, each sparkline's cell and data ("F2" => "Data.A2:E2", in this package's notation); type, markers, high, low, first, last, negative, axis, emptyCells, showHidden, lineWeight, min, max, rightToLeft, dateRange (always nothing: LibreOffice keeps none) and colors (seriesColor …, each "FFRRGGBB"), as they are now.

source
OpenDocumentSpreadsheets.Charts.deleteSparklines — Function
deleteSparklines(ws::Worksheet, ref; group = false) -> Bool

Deletes the sparklines in the cells of ref (a cell or a range), or with group = true every group with a sparkline there. false if there were none.

source