Regarding ODF import and Export support for HistogramChart

Regina Henschel rb.henschel at t-online.de
Fri Jan 3 22:24:43 UTC 2025


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



More information about the LibreOffice mailing list