Regarding ODF import and Export support for HistogramChart

Michael Stahl mst at libreoffice.org
Tue Dec 17 11:10:04 UTC 2024


On 17/12/2024 00:51, Regina Henschel wrote:
> Devansh Varshney schrieb am 14.12.2024 um 13:49:
>> Thanks, Regina, for such detailed information. This helped me to 
>> approach the
>> import/export for the Histogram Chart.
>>
>> I have added changes to the ODF Export for the Histogram Chart.
>> Have to add support for the Import and addition in the RNG file.
>>
>> https://gerrit.libreoffice.org/c/core/+/177364
>>
>> Would anyone from the community be able to help me by reviewing the PR?
>>

> You have added the 'bin' related information to the <chart:series> 
> element. A <chart:plot-area> element can have several <chart:series> 
> sub-elements. I guess, that you do not want to allow several series in 
> the same histogram. Excel does no allow it. Restricting it in the schema 
> is difficult. (Or do you have an idea, Michael?) I suggest to restrict 
> it in the specification text.

likely possible, but it sounds like it would make the schema a lot more 
complicated for very little gain.

> You export the labels for the x-axis as loext:BinRange. I would not 
> export them at all for these reasons:
> (A) Excel does not export that information.
> (B) The chart has a reference to the area of the data source in the 
> table. The content of this area might come from an external source, e.g. 
> a database engine. When the file is loaded, this data might be refreshed 
> and changes. Thus the bin labels and their frequency values might not 
> fit to the information that are put into the file when saving.
> 
> 
> You write the 'bin' related information as attributes of the 
> <chart:series> element. You should consider to use one child element 
> instead, that contains all needed information. That way you can use a 
> dedicated context when loading the file. The schema would get one new 
> child-element for the <chart:series> element and a new section for this 
> new element itself. Michael, what do you think?

i'm afraid i don't know enough about charts to have an opinion on that.

> Different variations (types) are possible for the histogram chart. You 
> need to specify in the text how the bins are calculated. Especially how 
> 'automatic' works and how overflow and underflow bins influence the bin 
> intervals.
> 
> 
> You use two attributes for a underflow bin, one whether such underflow 
> exists and one with its value. I think that can be combined. In 
> implementation and schema it would be optional. The specification text 
> then needs to contain, what is used, when this attribute is missing. 
> Same for overflow. Excel has data type ST_DoubleOrAutomatic.

is it so that an absence of the value attribute could mean that the 
feature is disabled? that could work...

> The 'binCount' and 'binWidth' information are coupled to the chart 
> variants FrequencyType=2 'Number of bins (BinCount)' and FrequencyType=1 
> 'Bin Width'. You write them in all cases. Especially for variant 
> FrequencyType=3 'By Category' the binWidth attribute is meaningless. On 
> the other hand for the variant FrequencyType=1 it is mandatory. Michael, 
> do you have a nice idea for the schema?

something along these lines?

<choice>
  <group>
    <attribute name="FrequencyType">
      <value>1</value>
    </attribute>
    <attribute name="BindWith">...</attribute>
  </group>
  <group>
    <attribute name="FrequencyType">
      <value>2</value>
    </attribute>
    <attribute name="BinCount">...</attribute>
  </group>
  ...
</choice>

could add some "<optional>" around the attributes if necessary...

> In implementation they might both be optional with an assert, if they 
> are missing in their corresponding FrequencyType. For UNO it might be 
> sufficient to make them optional and mention the dependencies in the text.
> 
> Kind regards,
> Regina


More information about the LibreOffice mailing list