Regarding ODF import and Export support for HistogramChart

Devansh Varshney varshney.devansh614 at gmail.com
Sun Jan 5 12:30:47 UTC 2025


Object 1/content.xml
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:chartooo="http://openoffice.org/2010/chart"
    xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="
http://www.w3.org/2003/g/data-view#"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"

xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rpt="http://openoffice.org/2005/report" xmlns:dc="
http://purl.org/dc/elements/1.1/"
    xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
    xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
    xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
    xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
    xmlns:oooc="http://openoffice.org/2004/calc"
    xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
    xmlns:ooow="http://openoffice.org/2004/writer"
    xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
    xmlns:ooo="http://openoffice.org/2004/office"
    xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
    xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"

xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
    xmlns:tableooo="http://openoffice.org/2009/table"
    xmlns:drawooo="http://openoffice.org/2010/draw"

xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
    xmlns:dom="http://www.w3.org/2001/xml-events"

xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:math="
http://www.w3.org/1998/Math/MathML"
    xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
    xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
    xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3">
    <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:auto-position="true" />
            <style:graphic-properties draw:stroke="none"
svg:stroke-color="#b3b3b3" draw:fill="none"
                draw:fill-color="#e6e6e6" />
            <style:text-properties fo:font-size="10pt"
style:font-size-asian="10pt"
                style:font-size-complex="10pt" />
        </style:style>
        <style:style style:name="ch3" style:family="chart">
            <style:chart-properties chart:include-hidden-cells="false"
chart:auto-position="true"
                chart:auto-size="true" chart:treat-empty-cells="leave-gap"
                chart:right-angled-axes="true" />
        </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: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="ch6" style:family="chart">
            <style:graphic-properties svg:stroke-color="#b3b3b3" />
        </style:style>
        <style:style style:name="ch7" style:family="chart"
style:data-style-name="N0">
            <style:chart-properties chart:link-data-style-to-source="true"
/>
            <style:graphic-properties draw:stroke="none"
draw:fill-color="#004586"
                dr3d:edge-rounding="5%" />
            <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:stroke="solid"
svg:stroke-color="#b3b3b3"
                draw:fill="none" draw:fill-color="#e6e6e6" />
        </style:style>
        <style:style style:name="ch9" style:family="chart">
            <style:graphic-properties svg:stroke-color="#b3b3b3"
draw:fill-color="#cccccc" />
        </style:style>
    </office:automatic-styles>
    <office:body>
        <office:chart>
            <chart:chart svg:width="16cm" svg:height="9cm" xlink:href=".."
xlink:type="simple"
                chart:class="chart:histogram" chart:style-name="ch1">
                <chart:legend chart:legend-position="end" svg:x="13.737cm"
svg:y="4.201cm"
                    style:legend-expansion="high" chart:style-name="ch2" />
                    <chart:plot-area chart:style-name="ch3"
table:cell-range-address="Sheet1.A1:Sheet1.A5" svg:x="0.32cm" svg:y="0.18cm"
                        svg:width="13.095cm" svg:height="8.64cm">
                        <chart:coordinate-region svg:x="0.941cm"
svg:y="0.379cm" svg:width="12.461cm"
                            svg:height="7.794cm" />
                        <chart:axis chart:dimension="x"
chart:name="primary-x" chart:style-name="ch4" />
                        <chart:axis chart:dimension="y"
chart:name="primary-y" chart:style-name="ch5">
                            <chart:grid chart:style-name="ch6"
chart:class="major" />
                        </chart:axis>
                        <chart:series chart:style-name="ch7"

chart:values-cell-range-address="Sheet1.A1:Sheet1.A5"
                            chart:class="chart:histogram">
                            <chart:data-point chart:repeated="5" />
                            <loext:histogram-configuration
                                loext:histogram-frequency-type="0"
                                loext:histogram-bin-count=""
                                loext:histogram-overflow-bin=""
                                loext:histogram-underflow-bin=""
                                loext:histogram-interval-closed="true"/>
                        </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: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 A</text:p>
                            </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="12">
                                <text:p>12</text:p>
                                <draw:g>
                                    <svg:desc>Sheet1.A1:Sheet1.A5</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="14">
                                <text:p>14</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="13">
                                <text:p>13</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="10">
                                <text:p>10</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="15">
                                <text:p>15</text:p>
                            </table:table-cell>
                        </table:table-row>
                    </table:table-rows>
                </table:table>
            </chart:chart>
        </office:chart>
    </office:body>
</office:document-content>

getting this while opening the modified Column Chart ods file to Histogram
chart.

 devansh   odf_histogram  instdir/program/scalc

   [25/01/5| 4:53PM]
warn:vcl.schedule:408447:408447:vcl/source/app/scheduler.cxx:639: Stop the
task before changing the priority, as it will just change after the task
was scheduled with the old prio!
warn:legacy.osl:408447:408447:chart2/source/tools/LegendHelper.cxx:96: need
diagram for creation of legend
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/LegendWrapper.cxx:366:
LegendWrapper::getInnerPropertySet() is NULL
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:137:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx:98:
missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx:98:
missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:legacy.osl:408447:408447:chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx:144:
need an XAxis
warn:xmloff.chart:408447:408447:xmloff/source/chart/SchXMLImport.cxx:238:
DBG_UNHANDLED_EXCEPTION in GetNewDataSeries exception:
com.sun.star.uno.RuntimeException message: "unsatisfied query for interface
of type com.sun.star.chart2.XCoordinateSystemContainer! at
/home/devansh/libreoffice/include/com/sun/star/uno/Reference.hxx:85"
warn:xmloff.chart:408447:408447:xmloff/source/chart/SchXMLSeries2Context.cxx:501:
DBG_UNHANDLED_EXCEPTION in startFastElement exception:
com.sun.star.uno.RuntimeException message: "unsatisfied query for interface
of type com.sun.star.chart2.data.XDataSink! at
/home/devansh/libreoffice/include/com/sun/star/uno/Reference.hxx:85"
warn:xmloff.core:408447:408447:xmloff/source/core/xmlimp.cxx:852: No
context for unknown-element
urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0
loext:histogram-configuration
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:chart2.tools:408447:408447:chart2/source/tools/WrappedPropertySet.cxx:92:
found no inner property set to map to
warn:sal.file:408447:408447:sal/osl/unx/file_misc.cxx:659: Invalid file URL
warn:sal.file:408447:408447:sal/osl/unx/file_misc.cxx:659: Invalid file URL
warn:sal.file:408447:408447:sal/osl/unx/file_misc.cxx:659: Invalid file URL
warn:sal.file:408447:408447:sal/osl/unx/file_misc.cxx:659: Invalid file URL
warn:legacy.osl:408447:408447:sc/source/ui/view/tabvwshh.cxx:235: no
accessibility broadcaster?
warn:legacy.osl:408447:408447:sc/source/ui/view/tabvwshh.cxx:235: no
accessibility broadcaster?
warn:legacy.osl:408447:408447:sc/source/ui/view/tabvwshh.cxx:235: no
accessibility broadcaster?
warn:chart2:408447:408447:chart2/source/tools/LifeTime.cxx:119: This
component is already disposed
warn:vcl.schedule.deinit:408447:408447:vcl/source/app/scheduler.cxx:176:
DeInit task: Timer a: 1 p: 1 framework::AutoRecovery m_aTimer 600000ms
(0x6478b17a1010)
warn:vcl.schedule.deinit:408447:408447:vcl/source/app/scheduler.cxx:176:
DeInit task: Timer a: 1 p: 1 MemoryManager::MemoryManager maSwapOutTimer
1000ms (0x72b65562f940)
warn:vcl.schedule.deinit:408447:408447:vcl/source/app/scheduler.cxx:196:
DeInit active tasks: 2 (ignored: 0)


I am looking into all these errors.



On Sat, 4 Jan 2025 at 22:11, Devansh Varshney <varshney.devansh614 at gmail.com>
wrote:

> <chart:chart svg:width="16.001cm" svg:height="8.986cm" xlink:href=".." chart:class="chart-type">
>   <chart:title>
>     <text:p>Histogram Chart</text:p>
>   </chart:title>
>   <chart:plot-area>
>     <chart:series chart:label-cell-address="'Sheet1'.$A$1:Sheet1.$A$1" chart:values-cell-range-address="'Sheet1'.$A$2:Sheet1.$A$101" style:style-name="ch6">
>       <chart:data-point chart:repeated="100"/>
>       <loext:histogram-configuration
>         loext:histogram-frequency-type="2"
>         loext:histogram-bin-count="10"
>         loext:histogram-overflow-bin="60"
>         loext:histogram-underflow-bin="0"
>         loext:histogram-interval-closed="true"/>
>     </chart:series>
>     <chart:axis chart:dimension="x">
>       <chart:title>
>         <text:p>Values (units)</text:p>
>       </chart:title>
>     </chart:axis>
>     <chart:axis chart:dimension="y">
>       <chart:title>
>         <text:p>Frequency</text:p>
>       </chart:title>
>     </chart:axis>
>   </chart:plot-area></chart:chart>
>
> https://gerrit.libreoffice.org/c/core/+/177364/19/schema/libreoffice/OpenDocument-v1.4%252Blibreoffice-schema.rng
>
> But I think in the PR we have only one <choice> block.
>
> I am trying to edit the column chart ods file(content.xml)
>
>
> On Sat, 4 Jan 2025 at 03:54, Regina Henschel <rb.henschel at t-online.de>
> wrote:
>
>> Hi Devansh,
>>
>> Devansh Varshney schrieb am 03.01.2025 um 15:08:
>> > <chart:chart svg:width="16.001cm" svg:height="8.986cm" xlink:href="..">
>> >    <chart:title>
>> >      <text:p>Histogram Chart</text:p>
>> >    </chart:title>
>> >    <chart:plot-area>
>> >      <chart:series chart:label-cell-address="'Sheet1'.$A$1"
>> > chart:values-cell-range-address="'Sheet1'.$A$2:$A$101">
>> >        <chart:data-point chart:repeated="100"/>
>> >        <loext:histogram-configuration
>> >          loext:histogram-frequency-type="2"
>> >          loext:histogram-bin-count="10"
>> >          loext:histogram-overflow-bin="60"
>> >          loext:histogram-underflow-bin="0"
>> >          loext:histogram-interval-closed="true"/>
>> >      </chart:series>
>> >      <chart:axis chart:dimension="x">
>> >        <chart:title>
>> >          <text:p>Values (units)</text:p>
>> >        </chart:title>
>> >      </chart:axis>
>> >      <chart:axis chart:dimension="y">
>> >        <chart:title>
>> >          <text:p>Frequency</text:p>
>> >        </chart:title>
>> >      </chart:axis>
>> >    </chart:plot-area>
>> > </chart:chart>
>> >
>> > I hope this time it's correct :)
>>
>> That will work. However, LibreOffice will write
>> "Sheet1.$A$1:Sheet1.$A$1" and LibreOffice will copy the chart:class
>> attribute from the <chart:chart> element to the <chart:series> element.
>> And the <chart:series> element will have an attribute
>> style:style-name="ch6" (or other number).
>>
>> Now you know, how the exported file should look. Thus you can manually
>> change an existing file (e.g a column chart) so, that it becomes a
>> histogram chart. When you manipulate a file, make at least sure, that
>> there is no XML-error. An XML editor should take care of that.
>> Having such file allows you to test the import without having the export
>> finished.
>>
>> The current state of OpenDocument-v1.4+libreoffice-schema.rng is going
>> to correspond to this markup solution. But your schema has still the
>> error, that the part for the frequency types has two blocks instead of
>> one block with one <choice>.
>>
>>
>>
>> The above solution uses for the histogram configuration a child element
>> of the <chart:series> element. Since this
>> <loext:histogram-configuration> element has only attributes but no child
>> elements, it would also be possible to use a solution where the
>> histogram configuration is part of the style.
>> I can't say, whether exporting and importing such a markup would be more
>> complicated or easier. I would have to study the existing code just as
>> you before I could give you a qualified advice. If you are still
>> interested in such a version, I can provide you with details.
>>
>> Kind regards,
>> Regina
>>
>>
>
> --
> *Regards,*
> *Devansh*
>


-- 
*Regards,*
*Devansh*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20250105/688be3e5/attachment.htm>


More information about the LibreOffice mailing list