chart2: odf import/export of correlation circle chart

ODF has no name for this chart type, so the file says two things at once, the
way a histogram already does: chart:class names the scatter chart, which is the
nearest a reader that knows nothing of correlation circles can make of it, and
coext:class beside it names the type itself. A reader that knows the coext name
gets the chart back as it was saved.

The series need no new shape in the file. The feature column is the range of
the series and the two dimension columns are a domain each, which is where a
bubble chart already keeps its x and y values, so both the reading and the
writing of them follows the bubble path rather than a new logic.

The schema the tests validate against lists the values coext:class may take, so
the new one is added there beside the histogram.

The test document is one block of five columns: three features and then the two
dimensions, the shape the wizard asks for. The test checks after a round trip
that the chart type came back, that the file carries both class names, and that
every series still holds its feature column beside the two dimension columns.

Change-Id: Iac73ff357c7490b4f38a4390c63948cf148d8585
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8106
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 4e59ea1c83e61b8dc2647f9a915884f9d461165d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210498
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Dennis Francis
2026-09-05 00:10:37 +02:00
committed by Xisco Fauli
parent 1b276f9265
commit 0bbeeeaf54
14 changed files with 505 additions and 6 deletions
+62
View File
@@ -1175,6 +1175,68 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testHistogramODSRoundtrip)
CPPUNIT_ASSERT_EQUAL(3.5, fBinWidth);
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testCorrelationCircleODSRoundtrip)
{
loadFromFile(u"fods/correlation-circle.fods");
saveAndReload(TestFilter::ODS);
xmlDocUniquePtr pXmlDoc = parseExport(u"Object 1/content.xml"_ustr);
CPPUNIT_ASSERT(pXmlDoc);
// A reader that knows nothing of this chart type is left with points in a
// plane, and the name of the type itself rides in the loext namespace.
assertXPath(pXmlDoc, "/office:document-content/office:body/office:chart/chart:chart"
"[@chart:class='chart:scatter']");
assertXPath(pXmlDoc, "/office:document-content/office:body/office:chart/chart:chart"
"[@loext:class='loext:correlation-circle']");
// Each series keeps its feature column as the series range and the two
// dimension columns as a domain each.
assertXPath(pXmlDoc,
"/office:document-content/office:body/office:chart/chart:chart"
"/chart:plot-area/chart:series",
3);
assertXPath(pXmlDoc,
"/office:document-content/office:body/office:chart/chart:chart"
"/chart:plot-area/chart:series[1]/chart:domain",
2);
uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0);
CPPUNIT_ASSERT(xChartDoc.is());
Reference<chart2::XChartType> xChartType = getChartTypeFromDoc(xChartDoc, 0, 0);
CPPUNIT_ASSERT(xChartType.is());
CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart2.CorrelationCircleChartType"_ustr,
xChartType->getChartType());
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getNumberOfDataSeries(xChartDoc));
// One series per feature column, every one of them against the same two
// dimension columns.
const OUString aFeatureRanges[]
= { u"$Sheet1.$A$2:$A$6"_ustr, u"$Sheet1.$B$2:$B$6"_ustr, u"$Sheet1.$C$2:$C$6"_ustr };
for (sal_Int32 nSeries = 0; nSeries < 3; ++nSeries)
{
Reference<chart2::data::XDataSequence> xFeature
= getDataSequenceFromDocByRole(xChartDoc, u"values-feature", nSeries);
CPPUNIT_ASSERT(xFeature.is());
CPPUNIT_ASSERT_EQUAL(aFeatureRanges[nSeries], xFeature->getSourceRangeRepresentation());
Reference<chart2::data::XDataSequence> xFirstDimension
= getDataSequenceFromDocByRole(xChartDoc, u"values-x", nSeries);
CPPUNIT_ASSERT(xFirstDimension.is());
CPPUNIT_ASSERT_EQUAL(u"$Sheet1.$D$2:$D$6"_ustr,
xFirstDimension->getSourceRangeRepresentation());
Reference<chart2::data::XDataSequence> xSecondDimension
= getDataSequenceFromDocByRole(xChartDoc, u"values-y", nSeries);
CPPUNIT_ASSERT(xSecondDimension.is());
CPPUNIT_ASSERT_EQUAL(u"$Sheet1.$E$2:$E$6"_ustr,
xSecondDimension->getSourceRangeRepresentation());
}
}
CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testHistogramXLSXRoundtrip)
{
// See tdf#163727
@@ -0,0 +1,359 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
<office:automatic-styles>
<style:style style:name="co1" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="0.889in"/>
</style:style>
<style:style style:name="ro1" style:family="table-row">
<style:table-row-properties style:row-height="0.178in" fo:break-before="auto" style:use-optimal-row-height="true"/>
</style:style>
<style:style style:name="ta1" style:family="table" style:master-page-name="Default">
<style:table-properties table:display="true" style:writing-mode="lr-tb"/>
</style:style>
<number:number-style style:name="N2">
<number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1"/>
</number:number-style>
<style:style style:name="gr1" style:family="graphic" style:parent-style-name="Default">
<style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:ole-draw-aspect="1" loext:decorative="false"/>
<style:paragraph-properties fo:text-align="center"/>
</style:style>
<style:style style:name="P1" style:family="paragraph">
<loext:graphic-properties draw:fill="none"/>
<style:paragraph-properties fo:text-align="center"/>
</style:style>
</office:automatic-styles>
<office:body>
<office:spreadsheet>
<table:calculation-settings table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true" table:null-year="1950"/>
<table:table table:name="Sheet1" table:style-name="ta1">
<table:shapes>
<draw:frame draw:z-index="0" draw:style-name="gr1" draw:text-style-name="P1" svg:width="3.9366in" svg:height="3.5429in" svg:x="0.1969in" svg:y="1.5748in">
<draw:object draw:notify-on-update-of-ranges="Sheet1.A1:Sheet1.E6">
<loext:p/>
<office:document xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:chartooo="http://openoffice.org/2010/chart" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.chart">
<office:styles/>
<office:automatic-styles>
<number:number-style style:name="N0">
<number:number number:min-integer-digits="1"/>
</number:number-style>
<style:style style:name="ch1" style:family="chart">
<style:graphic-properties draw:stroke="none"/>
</style:style>
<style:style style:name="ch2" style:family="chart">
<style:chart-properties chart:symbol-type="automatic" chart:auto-position="true" chart:auto-size="true" chart:treat-empty-cells="leave-gap" loext:frequency-type="0" loext:bin-width="0" loext:bin-count="0" loext:use-underflow-bin="false" loext:underflow-bin-value="0" loext:use-overflow-bin="false" loext:overflow-bin-value="0" chart:data-label-number="none" chart:data-label-text="false" chart:data-label-symbol="false" chart:data-label-series="true"/>
</style:style>
<style:style style:name="ch3" style:family="chart" style:data-style-name="N0">
<style:chart-properties chart:display-label="true" chart:logarithmic="false" chart:reverse-direction="false" text:line-break="false" loext:try-staggering-first="false" chart:link-data-style-to-source="true" loext:major-origin="0.5" chart:axis-position="0"/>
<style:graphic-properties svg:stroke-color="#b3b3b3"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="ch4" style:family="chart" style:data-style-name="N0">
<style:chart-properties chart:display-label="true" chart:logarithmic="false" chart:reverse-direction="false" text:line-break="false" loext:try-staggering-first="false" chart:link-data-style-to-source="true" chart:axis-position="0"/>
<style:graphic-properties svg:stroke-color="#b3b3b3"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="ch5" style:family="chart" style:data-style-name="N0">
<style:chart-properties chart:symbol-type="named-symbol" chart:symbol-name="square" chart:symbol-width="0.25cm" chart:symbol-height="0.25cm" chart:link-data-style-to-source="true" chart:data-label-number="none" chart:data-label-text="false" chart:data-label-symbol="false" chart:data-label-series="true" chart:label-position="top"/>
<style:graphic-properties svg:stroke-color="#004586" draw:fill-color="#004586"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="ch6" style:family="chart" style:data-style-name="N0">
<style:chart-properties chart:symbol-type="named-symbol" chart:symbol-name="diamond" chart:symbol-width="0.25cm" chart:symbol-height="0.25cm" chart:link-data-style-to-source="true" chart:data-label-number="none" chart:data-label-text="false" chart:data-label-symbol="false" chart:data-label-series="true" chart:label-position="top"/>
<style:graphic-properties svg:stroke-color="#ff420e" draw:fill-color="#ff420e"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="ch7" style:family="chart" style:data-style-name="N0">
<style:chart-properties chart:symbol-type="named-symbol" chart:symbol-name="arrow-down" chart:symbol-width="0.25cm" chart:symbol-height="0.25cm" chart:link-data-style-to-source="true" chart:data-label-number="none" chart:data-label-text="false" chart:data-label-symbol="false" chart:data-label-series="true" chart:label-position="top"/>
<style:graphic-properties svg:stroke-color="#ffd320" draw:fill-color="#ffd320"/>
<style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
</style:style>
<style:style style:name="ch8" style:family="chart">
<style:graphic-properties draw:fill="solid" draw:fill-color="#d9d9d9"/>
</style:style>
<style:style style:name="ch9" style:family="chart">
<style:graphic-properties draw:fill-color="#d9d9d9"/>
</style:style>
</office:automatic-styles>
<office:body>
<office:chart>
<chart:chart svg:width="10cm" svg:height="9cm" xlink:href=".." xlink:type="simple" chart:class="chart:scatter" loext:class="loext:correlation-circle" chart:style-name="ch1">
<chart:plot-area chart:style-name="ch2" svg:x="0.2cm" svg:y="0.18cm" svg:width="9.6cm" svg:height="8.64cm">
<chart:coordinate-region svg:x="0.907cm" svg:y="0.379cm" svg:width="8.242cm" svg:height="8.242cm"/>
<chart:axis chart:dimension="x" chart:name="primary-x" chart:style-name="ch3"/>
<chart:axis chart:dimension="y" chart:name="primary-y" chart:style-name="ch4"/>
<chart:series chart:style-name="ch5" chart:values-cell-range-address="Sheet1.A2:Sheet1.A6" chart:label-cell-address="Sheet1.A1:Sheet1.A1" chart:class="chart:correlation-circle">
<chart:domain table:cell-range-address="Sheet1.E2:Sheet1.E6"/>
<chart:domain table:cell-range-address="Sheet1.D2:Sheet1.D6"/>
<chart:data-point chart:repeated="5"/>
</chart:series>
<chart:series chart:style-name="ch6" chart:values-cell-range-address="Sheet1.B2:Sheet1.B6" chart:label-cell-address="Sheet1.B1:Sheet1.B1" chart:class="chart:correlation-circle">
<chart:data-point chart:repeated="5"/>
</chart:series>
<chart:series chart:style-name="ch7" chart:values-cell-range-address="Sheet1.C2:Sheet1.C6" chart:label-cell-address="Sheet1.C1:Sheet1.C1" chart:class="chart:correlation-circle">
<chart:data-point chart:repeated="5"/>
</chart:series>
<chart:wall chart:style-name="ch8"/>
<chart:floor chart:style-name="ch9"/>
</chart:plot-area>
<table:table table:name="local-table">
<table:table-header-columns>
<table:table-column/>
</table:table-header-columns>
<table:table-columns>
<table:table-column table:number-columns-repeated="5"/>
</table:table-columns>
<table:table-header-rows>
<table:table-row>
<table:table-cell>
<text:p/>
</table:table-cell>
<table:table-cell office:value-type="string">
<text:p>Column D</text:p>
</table:table-cell>
<table:table-cell office:value-type="string">
<text:p>Column E</text:p>
</table:table-cell>
<table:table-cell office:value-type="string">
<text:p>length</text:p>
<draw:g>
<svg:desc>Sheet1.A1:Sheet1.A1</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="string">
<text:p>width</text:p>
<draw:g>
<svg:desc>Sheet1.B1:Sheet1.B1</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="string">
<text:p>mass</text:p>
<draw:g>
<svg:desc>Sheet1.C1:Sheet1.C1</svg:desc></draw:g>
</table:table-cell>
</table:table-row>
</table:table-header-rows>
<table:table-rows>
<table:table-row>
<table:table-cell office:value-type="string">
<text:p>1</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.6">
<text:p>-0.6</text:p>
<draw:g>
<svg:desc>Sheet1.D2:Sheet1.D6</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.1">
<text:p>0.1</text:p>
<draw:g>
<svg:desc>Sheet1.E2:Sheet1.E6</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="1">
<text:p>1</text:p>
<draw:g>
<svg:desc>Sheet1.A2:Sheet1.A6</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="5">
<text:p>5</text:p>
<draw:g>
<svg:desc>Sheet1.B2:Sheet1.B6</svg:desc></draw:g>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="40">
<text:p>40</text:p>
<draw:g>
<svg:desc>Sheet1.C2:Sheet1.C6</svg:desc></draw:g>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell office:value-type="string">
<text:p>2</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.3">
<text:p>-0.3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.4">
<text:p>-0.4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="2">
<text:p>2</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="4">
<text:p>4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="38">
<text:p>38</text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell office:value-type="string">
<text:p>3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0">
<text:p>0</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.5">
<text:p>0.5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="3">
<text:p>3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="3.5">
<text:p>3.5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="39">
<text:p>39</text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell office:value-type="string">
<text:p>4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.3">
<text:p>0.3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.3">
<text:p>-0.3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="4">
<text:p>4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="2">
<text:p>2</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="36">
<text:p>36</text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell office:value-type="string">
<text:p>5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.6">
<text:p>0.6</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.1">
<text:p>0.1</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="5">
<text:p>5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="1">
<text:p>1</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="35">
<text:p>35</text:p>
</table:table-cell>
</table:table-row>
</table:table-rows>
</table:table>
</chart:chart>
</office:chart>
</office:body>
</office:document>
</draw:object>
</draw:frame></table:shapes>
<table:table-column table:style-name="co1" table:number-columns-repeated="5" table:default-cell-style-name="Default"/>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>length</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>width</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>mass</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>dim 1</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>dim 2</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
<text:p>1</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="5" calcext:value-type="float">
<text:p>5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="40" calcext:value-type="float">
<text:p>40</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.6" calcext:value-type="float">
<text:p>-0.6</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.1" calcext:value-type="float">
<text:p>0.1</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
<text:p>2</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="4" calcext:value-type="float">
<text:p>4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="38" calcext:value-type="float">
<text:p>38</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.3" calcext:value-type="float">
<text:p>-0.3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.4" calcext:value-type="float">
<text:p>-0.4</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="float" office:value="3" calcext:value-type="float">
<text:p>3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="3.5" calcext:value-type="float">
<text:p>3.5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="39" calcext:value-type="float">
<text:p>39</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0" calcext:value-type="float">
<text:p>0</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.5" calcext:value-type="float">
<text:p>0.5</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="float" office:value="4" calcext:value-type="float">
<text:p>4</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
<text:p>2</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="36" calcext:value-type="float">
<text:p>36</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.3" calcext:value-type="float">
<text:p>0.3</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="-0.3" calcext:value-type="float">
<text:p>-0.3</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell office:value-type="float" office:value="5" calcext:value-type="float">
<text:p>5</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
<text:p>1</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="35" calcext:value-type="float">
<text:p>35</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.6" calcext:value-type="float">
<text:p>0.6</text:p>
</table:table-cell>
<table:table-cell office:value-type="float" office:value="0.1" calcext:value-type="float">
<text:p>0.1</text:p>
</table:table-cell>
</table:table-row>
</table:table>
<table:named-expressions/>
</office:spreadsheet>
</office:body>
</office:document>
@@ -87,6 +87,7 @@ enum eServiceType
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
SERVICE_NAME_BUBBLE_DIAGRAM,
SERVICE_NAME_CORRELATION_CIRCLE_DIAGRAM,
SERVICE_NAME_DASH_TABLE,
SERVICE_NAME_GRADIENT_TABLE,
@@ -116,6 +117,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
{"com.sun.star.chart.StockDiagram", SERVICE_NAME_STOCK_DIAGRAM},
{"com.sun.star.chart.XYDiagram", SERVICE_NAME_XY_DIAGRAM},
{"com.sun.star.chart.BubbleDiagram", SERVICE_NAME_BUBBLE_DIAGRAM},
{"com.sun.star.chart.CorrelationCircleDiagram", SERVICE_NAME_CORRELATION_CIRCLE_DIAGRAM},
{"com.sun.star.drawing.DashTable", SERVICE_NAME_DASH_TABLE},
{"com.sun.star.drawing.GradientTable", SERVICE_NAME_GRADIENT_TABLE},
@@ -1230,6 +1232,14 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bCreateDiagram = true;
}
break;
case SERVICE_NAME_CORRELATION_CIRCLE_DIAGRAM:
if( xChartTypeManager.is())
{
xTemplate = xChartTypeManager->createTemplate(
u"com.sun.star.chart2.template.CorrelationCircle"_ustr);
bCreateDiagram = true;
}
break;
case SERVICE_NAME_DASH_TABLE:
case SERVICE_NAME_GRADIENT_TABLE:
@@ -570,6 +570,9 @@ OUString lcl_getDiagramType( std::u16string_view rTemplateServiceName )
if( aName.find( u"Bubble" ) != std::u16string_view::npos )
return u"com.sun.star.chart.BubbleDiagram"_ustr;
if( aName.find( u"CorrelationCircle" ) != std::u16string_view::npos )
return u"com.sun.star.chart.CorrelationCircleDiagram"_ustr;
// Note: this must be checked after Bar, Net and Scatter
// "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
@@ -607,6 +610,7 @@ OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
{u"com.sun.star.chart2.NetChartType", u"com.sun.star.chart.NetDiagram"_ustr},
{u"com.sun.star.chart2.CandleStickChartType", u"com.sun.star.chart.StockDiagram"_ustr},
{u"com.sun.star.chart2.BubbleChartType", u"com.sun.star.chart.BubbleDiagram"_ustr},
{u"com.sun.star.chart2.CorrelationCircleChartType", u"com.sun.star.chart.CorrelationCircleDiagram"_ustr},
{u"com.sun.star.chart2.FunnelChartType", u"com.sun.star.chart.FunnelDiagram"_ustr},
{u"com.sun.star.chart2.BoxWhiskerChartType", u"com.sun.star.chart.BoxWhiskerDiagram"_ustr},
{u"com.sun.star.chart2.ClusteredColumnChartType", u"com.sun.star.chart.ClusteredColumnDiagram"_ustr},
+1
View File
@@ -537,6 +537,7 @@ namespace xmloff::token {
XML_COPY_STYLES,
XML_CORNER_RADIUS,
XML_CORRECT,
XML_CORRELATION_CIRCLE,
XML_COS,
XML_COSH,
XML_COT,
+1
View File
@@ -573,6 +573,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/chart,\
ChartTitle \
ChartTwoAxisXSupplier \
ChartTwoAxisYSupplier \
CorrelationCircleDiagram \
Diagram \
Dim3DDiagram \
DonutDiagram \
@@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* Copyright the LibreOffice contributors.
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
module com { module sun { module star { module chart {
/** a service for correlation circle plots.
<p>Each series holds one feature column together with the two dimension
columns every series shares, and stands for one point, at the correlation of
the feature with each of the two dimensions.</p>
*/
service CorrelationCircleDiagram
{
service com::sun::star::chart::Diagram;
service com::sun::star::chart::ChartAxisXSupplier;
service com::sun::star::chart::ChartTwoAxisYSupplier;
};
}; }; }; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
@@ -2917,6 +2917,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
<rng:attribute name="loext:class">
<rng:choice>
<rng:value>loext:histogram</rng:value>
<rng:value>loext:correlation-circle</rng:value>
</rng:choice>
</rng:attribute>
</rng:optional>
+19 -2
View File
@@ -1321,6 +1321,18 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >
mrExport.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_LO_EXT, GetXMLToken(XML_HISTOGRAM)));
}
else if (eXMLChartType == XML_CORRELATION_CIRCLE)
{
// A reader that does not know the correlation circle plot is
// left with points in a plane, which is the nearest thing the
// format has a name for.
mrExport.AddAttribute(XML_NAMESPACE_CHART, XML_CLASS,
mrExport.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_CHART, GetXMLToken(XML_SCATTER)));
mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_CLASS,
mrExport.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_LO_EXT, GetXMLToken(XML_CORRELATION_CIRCLE)));
}
else if( eXMLChartType != XML_TOKEN_INVALID )
{
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_CLASS,
@@ -3007,8 +3019,13 @@ void SchXMLExportHelper_Impl::exportSeries(
{
bool bIsScatterChart = aChartType == "com.sun.star.chart2.ScatterChartType";
bool bIsBubbleChart = aChartType == "com.sun.star.chart2.BubbleChartType";
// A correlation circle plot keeps its two dimension
// columns where a bubble chart keeps its x and y
// values, in a domain each.
bool bHasTwoDomains = bIsBubbleChart
|| aChartType == "com.sun.star.chart2.CorrelationCircleChartType";
Reference< chart2::data::XDataSequence > xYValuesForBubbleChart;
if( bIsBubbleChart )
if( bHasTwoDomains )
{
Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, u"values-y"_ustr ) );
if( xSequence.is() )
@@ -3018,7 +3035,7 @@ void SchXMLExportHelper_Impl::exportSeries(
xYValuesForBubbleChart = nullptr;
}
}
if( bIsScatterChart || bIsBubbleChart )
if( bIsScatterChart || bHasTwoDomains )
{
Reference< chart2::data::XLabeledDataSequence > xSequence( lcl_getDataSequenceByRole( aSeqCnt, u"values-x"_ustr ) );
if( xSequence.is() )
+8 -3
View File
@@ -469,6 +469,8 @@ void SchXMLSeries2Context::startFastElement (sal_Int32 /*Element*/,
OUString aMainRole(u"values-y"_ustr);
if (maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType")
aMainRole = "values-size";
else if (maSeriesChartTypeName == "com.sun.star.chart2.CorrelationCircleChartType")
aMainRole = "values-feature";
xSeqProp->setPropertyValue(u"Role"_ustr, uno::Any(aMainRole));
}
xLabeledSeq->setValues(xSequenceValues);
@@ -566,12 +568,15 @@ void SchXMLSeries2Context::endFastElement(sal_Int32 )
// roles are not yet saved in the file format
sal_Int32 nDomainCount = maDomainAddresses.size();
bool bIsScatterChart = maSeriesChartTypeName == "com.sun.star.chart2.ScatterChartType";
bool bIsBubbleChart = maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType";
// A correlation circle plot carries its two dimension columns in a domain
// each, the same way a bubble chart carries its x and y values.
bool bHasTwoDomains = maSeriesChartTypeName == "com.sun.star.chart2.BubbleChartType"
|| maSeriesChartTypeName == "com.sun.star.chart2.CorrelationCircleChartType";
bool bDeleteSeries = false;
std::vector< DomainInfo > aDomainInfos;
//different handling for different chart types necessary
if( bIsScatterChart || ( nDomainCount==1 && !bIsBubbleChart ) )
if( bIsScatterChart || ( nDomainCount==1 && !bHasTwoDomains ) )
{
DomainInfo aDomainInfo( u"values-x"_ustr, m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
bool bCreateXValues = true;
@@ -602,7 +607,7 @@ void SchXMLSeries2Context::endFastElement(sal_Int32 )
if( bCreateXValues )
aDomainInfos.push_back( aDomainInfo );
}
else if( bIsBubbleChart )
else if( bHasTwoDomains )
{
if( nDomainCount>1 )
{
+8 -1
View File
@@ -145,6 +145,7 @@ const SvXMLEnumMapEntry<SchXMLChartTypeEnum> aXMLChartClassMap[] =
{ XML_HISTOGRAM, XML_CHART_CLASS_HISTOGRAM },
{ XML_STOCK, XML_CHART_CLASS_STOCK },
{ XML_BUBBLE, XML_CHART_CLASS_BUBBLE },
{ XML_CORRELATION_CIRCLE, XML_CHART_CLASS_CORRELATION_CIRCLE },
{ XML_SURFACE, XML_CHART_CLASS_BAR }, //@todo change this if a surface chart is available
{ XML_ADD_IN, XML_CHART_CLASS_ADDIN },
{ XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
@@ -188,7 +189,9 @@ static const tMakeStringStringMap& lcl_getChartTypeNameMap()
{"com.sun.star.chart.StockDiagram",
"com.sun.star.chart2.CandleStickChartType"},
{"com.sun.star.chart.BubbleDiagram",
"com.sun.star.chart2.BubbleChartType"}};
"com.sun.star.chart2.BubbleChartType"},
{"com.sun.star.chart.CorrelationCircleDiagram",
"com.sun.star.chart2.CorrelationCircleChartType"}};
return g_aChartTypeNameMap;
}
@@ -248,6 +251,8 @@ OUString GetChartTypeByClassName(
else if( IsXMLToken( rClassName, XML_BUBBLE ))
aResultBuffer.append("Bubble");
else if( IsXMLToken( rClassName, XML_CORRELATION_CIRCLE ))
aResultBuffer.append("CorrelationCircle");
else if( IsXMLToken( rClassName, XML_RADAR ))
aResultBuffer.append("Net");
else if( IsXMLToken( rClassName, XML_FILLED_RADAR ))
@@ -328,6 +333,8 @@ XMLTokenEnum getTokenByChartType(
eResult = XML_SCATTER;
else if ( aServiceName == u"Bubble" )
eResult = XML_BUBBLE;
else if ( aServiceName == u"CorrelationCircle" )
eResult = XML_CORRELATION_CIRCLE;
else if ( aServiceName == u"Net" )
eResult = XML_RADAR;
else if ( aServiceName == u"FilledNet" )
+1
View File
@@ -63,6 +63,7 @@ namespace SchXMLTools
XML_CHART_CLASS_HISTOGRAM,
XML_CHART_CLASS_STOCK,
XML_CHART_CLASS_BUBBLE,
XML_CHART_CLASS_CORRELATION_CIRCLE,
XML_CHART_CLASS_ADDIN,
XML_CHART_CLASS_UNKNOWN
};
+1
View File
@@ -548,6 +548,7 @@ namespace xmloff::token {
TOKEN( "copy-styles", XML_COPY_STYLES ),
TOKEN( "corner-radius", XML_CORNER_RADIUS ),
TOKEN( "correct", XML_CORRECT ),
TOKEN( "correlation-circle", XML_CORRELATION_CIRCLE ),
TOKEN( "cos", XML_COS ),
TOKEN( "cosh", XML_COSH ),
TOKEN( "cot", XML_COT ),
+1
View File
@@ -452,6 +452,7 @@ copy-results-only
copy-styles
corner-radius
correct
correlation-circle
cos
cosh
cot