Skip to contents

Handles three mark types, found by inspecting real chart-bearing files from Zenodo/Figshare rather than any spec (.spv charts have none – see the section header above): a <point> scatter mark, an <interval> histogram/bar mark (both resolved from .spv_decode_legacy_data()'s case data via .spvviz_decode_xy()), and a <schema> box-plot mark (its data resolved from EITHER an inline <embeddedSource> element or, when that is absent, the same case data the other two marks use – see .spvviz_decode_boxplot_source() / .spvviz_decode_boxplot_databin()). Any other mark (<line>/<bar>/<area>/...) is out of this version's scope.

Usage

.spv_decode_chart(xml_raw, data, title = NA_character_)

Arguments

xml_raw

raw vector or string: the path member's XML content (a <visualization> document, the same VizML dialect a legacy table's detail-xml uses).

data

the decoded raw case data for this chart's dataPath member, as returned by .spv_decode_legacy_data() – used for <point>/ <interval> charts, and as a <schema> box plot's fallback data source when it has no <embeddedSource>.

title

optional chart title (from the structure reader's own context), used when the XML's own <labelFrame> title cannot be read.

Value

For a <point>/<interval> chart: a data.frame with columns x, y (one row per case with both values present). For a <schema> box plot: a data.frame with columns category (the relabelled group name) and value (one row per case). NULL if this chart uses a construct out of this port's scope, or its variable/data references cannot be resolved. Every shape carries attributes spv_chart_title, spv_chart_xlab, spv_chart_ylab (character), and spv_chart_type ("point", "interval", or "boxplot"); a <point> chart also carries spv_chart_fits (a list of .spvviz_function_guide() results, possibly empty) for the fitted trend lines SPSS itself already computed.