Hi Devansh,
I have put the dev list in CC, because such questions should go to the
dev list. There are other people too that can answer your questions. I'm
not an expert for charts and I have not always time to answers in a
reasonable time frame.
Devansh Varshney schrieb am 29.11.2024 um 14:38:
Hi Regina,
I have been working on adding the Histogram Chart to the LO
codebase(part of GSoC-24), and it is working well.
I think, it is still a lot to do:
Missing "bin"-properties
Filesave, bug 164108.
The use and meaning of "Y-Values" in the wizard is unclear, bug 164109.
Problem with empty "Categories" in the wizard, no bug report yet. The
role "values-y-original" is undocumented.
Now I am tasked to add the import and export support for the same but
what I am unable to get is where to begin exactly I have added the
entries in the token files - https://gerrit.libreoffice.org/c/core/+/177364
These two are the import files for the import and export -
xmloff/source/chart/SchXMLExport.cxx
xmloff/source/chart/SchXMLImport.cxx
I have looked for ODF-related PRs and even on OOo but could not find
anything related to adding new chart support for ODF.
The type of a chart is determined by the chart:class attribute of the
<chart:chart> element. The value of the chart:class attribute is a
namespaced token. The twelve predefined chart types use the namespace
'chart'. Since a histogram chart does not belong to the predefined chart
types, it needs a namespace other than 'chart'. So you should write it
out as chart:class="loext:histogram".
Because your new chart type needs some properties, which will be in
loext namespace as well, you can write the new chart type only in an
extended ODF version.
The chart:class attribute is specified in section 19.15.1 in ODF 1.3, [1].
Properties of the new chart type do not become attributes of the
<chart:chart> element, but become attributes of the
<style:chart-properties> child element of the <style:style> element
which is referenced by the chart:style-name attribute of an affected
element. That is a <chart:plot-area>, <chart:series> or <chart:axis>
element, for example.
That is currently wrong for ofPie charts, see bug 163921. So you cannot
use ofPie charts as template.
Such properties belong to the property map aXMLChartPropMap[].
In your case the labels of the x-axis are generated strings which are
not contained in the sheet. So you cannot use the
chart:cell-range-address attribute of the <chart:categories> element
with a reference into the sheet.
In your case the values in y-direction are generated values which are
not contained in the sheet. So you cannot use the
chart:value-cell-range-address of the <chart:series> element with a
reference into the sheet.
I have no ready to use solution to solve the problems. The same problems
are visible in the chart wizard as mentioned above.
There can currently only be one local table. So using an additional
local table would require changes in that area.
Changing the <chart:categories> and <chart:series> elements so that they
can carry fixed values might be a solution too.
OOXML does not save the values themselves but only writes the layout
properties. So that idea might be a way to go as well. In that case we
would need to decide whether new attributes of <chart:categories> and
<chart:series> are used or new entries in <style:chart-properties>
I think these problems need some discussion.
[1]
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html
The change to version 1.4 is ongoing. In your case you can still use the
v1.3 specification. The access to the ODF 1.3 specification is easier.
Kind regards,
Regina