<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-overflow-bin> <loext:histogram-underflow-bin>0</loext:histogram-underflow-bin>
<loext:histogram-interval-closed>true</loext:histogram-interval-closed> </loext:histogram-configuration> </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> On Thu, 2 Jan 2025 at 18:31, Regina Henschel <rb.hensc...@t-online.de> wrote: > Hi Devansh, > > Devansh Varshney schrieb am 02.01.2025 um 09:14: > > <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> > > > <!-- Series with label from A1 --> > The generated XML does not contain any comments. > > > <chart:series chart:label="Results"> > A 'chart:label' attribute does not exist for the <chart:series> element. > Instead it has the attribute 'chart:label-cell-address'. > > > > <!-- Data points from A2:A101 --> > The data values are not inside <chart:data-point> elements. The data > values are given by the attribute 'chart:values-cell-range-address' of > the <chart:series> element. > > The purpose of a <chart:data-point> element is, to specify the style of > a data point. As the columns in the histogram do not directly reflect > data points, a <chart:data-point> element is useless for an histogram. > But it does not harm to keep the default, which would be > <chart:data-point chart:repeated="100"/> > in the example. That means, that the style given in the > 'chart:style-name' attribute of the <chart:series> element is used for > all 100 data points. You can keep it although it will actually be the > style of the rendered bins (at least I think you will use the > 'chart:style-name' attribute of the <chart:series> element for this > purpose). > > An element <chart:data-points> does not exist. If <chart:data-point> > elements are needed, they are simply written one after the other. The > RELAX NG has the element <rng:zeroOrMore> for this. > > > <chart:data-points> > > <chart:data-point chart:value="5.3"/> <!-- A2 --> > > <chart:data-point chart:value="12.7"/> <!-- A3 --> > > <chart:data-point chart:value="8.4"/> <!-- A4 --> > > <chart:data-point chart:value="15.2"/> <!-- A5 --> > > <chart:data-point chart:value="22.6"/> <!-- A6 --> > > <chart:data-point chart:value="30.1"/> <!-- A7 --> > > <chart:data-point chart:value="45.7"/> <!-- A8 --> > > <chart:data-point chart:value="60.3"/> <!-- A9 --> > > <chart:data-point chart:value="75.9"/> <!-- A10 --> > > <chart:data-point chart:value="95.1"/> <!-- A11 --> > > <!-- Add more data points up to A101 --> > > </chart:data-points> > > > <!-- Histogram-specific configuration --> > > <loext:histogram> > > I would use element name > loext:histogram-configuration > to be more specific. Remember, there are no comments written, thus a > meaningful name helps. > > > <attribute name="loext:histogram-frequency-type"> > > <value>2</value> > > </attribute> > > <attribute name="loext:histogram-bin-count"> > > <data type="integer">10</data> > > </attribute> > > <optional> > > <attribute name="loext:histogram-overflow-bin"> > > <data type="double">100</data> > > </attribute> > > </optional> > > <optional> > > <attribute name="loext:histogram-underflow-bin"> > > <data type="double">0</data> > > </attribute> > > </optional> > > <optional> > > <attribute name="loext:histogram-interval-closed"> > > <data type="boolean">true</data> > > </attribute> > > </optional> > > </loext:histogram> > > Here you have mixed up the content in the schema with the written out > XML of the document. In the written out XML, it would be > <loext:histogram-configuration loext:histogram-frequency-type="2" > loext:histogram-bin-count="10" /> > > The attributes underflow-bin and overflow-bin are only written out, when > the user sets them explicitly. Otherwise a default is used. And default > values need not be written out. > > The attribute interval-closed too should only be written out, if it is > not the default. > > > > > </chart:series> > > <!-- Define the X-axis --> > > <chart:axis chart:dimension="x"> > > <chart:title> > > <text:p>Values</text:p> > It is more likely, that the user writes the unit of the data > values into the axis title. > > > </chart:title> > > </chart:axis> > > <!-- Define the Y-axis --> > > <chart:axis chart:dimension="y"> > > <chart:title> > > <text:p>Frequency</text:p> > > </chart:title> > > </chart:axis> > > </chart:plot-area> > > </chart:chart> > > > So you want a structure were element <loext:histogram-configuration> is > sub-element of the <chart:series> element. That is OK. > > You need to decide about the order. Where in the sequence of possible > sub-elements of the <chart:series> element you want the > <loext:histogram-configuration> sub-element to be written? > > > Now about the schema. A useful source to learn more about RELAX NG is > https://relaxng.org/tutorial-20011203.html. > > The <chart:series> element has no <rng:choice> for its sub-elements. > Therefore a solution with combine="choice" is not possible. And as it is > an element, a solution with combine="interleave" does neither work. You > need to replace the existing <chart:series> element with an extended > one. (See chapter 9.4 in the mentioned tutorial) > > For replacing, you need to copy the existing <rng:define> element, that > specifies the <chart:series> element, from the file > schema/odf1.4/OpenDocument-v1.4-schema.rng and add it as a new > sub-element of the <rng:inlcude> element in > schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng. Then you > extend it. > > You do not add the <loext:histogram-configuration> element directly, but > add a reference to its definition. ODF uses for the name a pattern > "prefix-elementname'. So in your case it would be a > <rng:ref name="loext-histogram-configuration" /> > Don't forget to mark it as optional. > > There exist no proposal to the ODF TC to integrate a chart type > 'histogram' in ODF and if such existed, it would last several years to > integrate it. Thus you add a comment with a pointer to that bug report, > where the histogram chart was initially implemented in LO. > > Then go to the end of the OpenDocument-v1.4+libreoffice-schema.rng file > and add the definition for histogram-configuration after the last > </rng:element>. Again add a comment. > > > In regard to loext:histogram-configuration itself: > 1. <optional> is not here, but in <chart:series> > 2. Your current version in Gerrit has two blocks about frequency-type. > There must be only one. Please re-read the answer from Michael Stahl how > to do it. > > Looking forward to your next version. > > Kind regards, > Regina > > > -- *Regards,* *Devansh*