<div dir="ltr"><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><span style="font-family:arial black,sans-serif">Hi everyone,</span></div><div class="gmail_default"><span style="font-family:arial black,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:arial black,sans-serif">So here is what happened.<br><br></span></div><div class="gmail_default"><span style="font-family:arial black,sans-serif">My initial call was to add the new variable to the data series (or similar central module), which ensures that any future chart types (post‑2016) can use this variable if they require “calculated” versus “source” data.<br><br></span></div><div class="gmail_default"><span style="font-family:arial black,sans-serif">Now my initial approach was not in the right direction and later Quikee pointed me in the right direction -</span></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><ul><li><span style="font-family:arial black,sans-serif">Pay close attention to the "You Ain't Gonna Need It" (YAGNI) principle. Don't over-engineer for future chart types. Focus on solving the current problem (histogram support) in a clean and maintainable way.</span></li><li><span style="font-family:arial black,sans-serif">No IDL Changes (Unless Necessary): Avoid modifying the UNO IDL files unless you have a very strong reason. IDL changes can have far-reaching consequences.</span></li><li><span style="font-family:arial black,sans-serif">Persistence: Quikee said that persistence doesn't need to be accounted for at this point and can be calculated again on the fly as we have the original data.</span></li></ul><div><span style="font-family:arial black,sans-serif"><br><br><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">Regina pointed out a deeper problem in the approach taken so far. She mentioned that the calculated bin frequencies and bin ranges were set in place of the original data. <br></span></span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">This approach allowed for a convenient way to render the histogram as a bar chart, but it introduced bugs (tdf#164109 and tdf#162240) and made it impossible to export the <br></span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-z32n2g gmail-r-z2wwpe gmail-r-1hkscgl gmail-r-1471scf gmail-r-1aiqnjv gmail-r-1hq4qhi gmail-r-16dba41 gmail-r-ilng1c gmail-r-trst2h gmail-r-1noe1sz gmail-r-njp1lv"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><chart:series></span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"> element in the same way as other chart types. She referred to a specific part of the code in </span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-z32n2g gmail-r-z2wwpe gmail-r-1hkscgl gmail-r-1471scf gmail-r-1aiqnjv gmail-r-1hq4qhi gmail-r-16dba41 gmail-r-ilng1c gmail-r-trst2h gmail-r-1noe1sz gmail-r-njp1lv"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">SchXMLExport.cxx</span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"> where the export of data series for the current chart type is handled. </span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">Currently, in the patch being discussed, the </span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-z32n2g gmail-r-z2wwpe gmail-r-1hkscgl gmail-r-1471scf gmail-r-1aiqnjv gmail-r-1hq4qhi gmail-r-16dba41 gmail-r-ilng1c gmail-r-trst2h gmail-r-1noe1sz gmail-r-njp1lv"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><chart:series></span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"> element isn’t being exported at all. When it is exported, the new </span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-z32n2g gmail-r-z2wwpe gmail-r-1hkscgl gmail-r-1471scf gmail-r-1aiqnjv gmail-r-1hq4qhi gmail-r-16dba41 gmail-r-ilng1c gmail-r-trst2h gmail-r-1noe1sz gmail-r-njp1lv"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><loext:histogram-configuration></span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"> element needs to be a child element </span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">after all existing child elements, ideally just before the comment </span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-z32n2g gmail-r-z2wwpe gmail-r-1hkscgl gmail-r-1471scf gmail-r-1aiqnjv gmail-r-1hq4qhi gmail-r-16dba41 gmail-r-ilng1c gmail-r-trst2h gmail-r-1noe1sz gmail-r-njp1lv"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">'// close series'</span></span><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">.</span></span></span><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">Tomaž has made a patch (PR) </span></span></span><span style="font-family:arial black,sans-serif"><a href="https://gerrit.libreoffice.org/c/core/+/181051">https://gerrit.libreoffice.org/c/core/+/181051</a><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"> to address this, </span></span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">and I’ve copied his work so far without making any changes yet </span></span></span><span style="font-family:arial black,sans-serif"><a href="https://gerrit.libreoffice.org/c/core/+/182101">https://gerrit.libreoffice.org/c/core/+/182101</a> <span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">.</span></span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><br></span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">After his PR, Regina further commented on it -</span></span></span></div><div><span style="font-family:arial black,sans-serif"><a href="https://gerrit.libreoffice.org/c/core/+/181051/comments/ca521ccf_9e2ab59c?tab=comments">https://gerrit.libreoffice.org/c/core/+/181051/comments/ca521ccf_9e2ab59c?tab=comments</a></span></div><div><h4><strong style="font-family:arial black,sans-serif">UI/UX Issues </strong> </h4><ul><li><span style="font-family:arial black,sans-serif"><strong>Problem </strong>: </span><ul><li><font size="2" style="font-family:arial black,sans-serif"><code class="gmail-codespan gmail-cursor-pointer">values-y</code> and <code class="gmail-codespan gmail-cursor-pointer">calculated-y</code> share the same UI label (<code class="gmail-codespan gmail-cursor-pointer">STR_DATA_ROLE_Y</code>).</font></li><li><font size="2" style="font-family:arial black,sans-serif">Switching chart types adds duplicate data series.</font></li></ul></li><li><span style="font-family:arial black,sans-serif"><strong>Solution </strong>:</span><ul><li><span style="font-family:arial black,sans-serif">Assign unique labels (e.g., "Original Y Values" vs. "Calculated Frequencies").</span></li><li><span style="font-family:arial black,sans-serif">Clear <code class="gmail-codespan gmail-cursor-pointer">calculated-y</code>/<code class="gmail-codespan gmail-cursor-pointer">calculated-x</code> when switching away from histograms.</span></li></ul></li></ul><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif">So what does he propose?<br><br></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">The goal is to ensure that the original data is preserved while also accommodating the calculated values needed for the histogram.</span></span></span></div><div><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3" style="font-family:arial black,sans-serif"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><br></span></span></span></div><div><span style="font-family:arial black,sans-serif">First, let's clarify the problem with the <b>y-values</b>. In a histogram, the y-values represent frequencies, which are calculated from the original data. </span></div><div><span style="font-family:arial black,sans-serif">However, the existing code assumes that the "values-y" role always contains the original, raw data. This creates a conflict because for histograms, </span></div><div><span style="font-family:arial black,sans-serif">we need to use calculated frequencies for rendering, but we also need to keep the original data intact for other functionalities or potential chart-type changes.</span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif">To address this, <span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">Tomaž</span></span></span> introduced a <b>new role </b>called <b>"calculated-y"</b> in his patch. This role is meant to store the calculated frequencies for the histogram, </span></div><div><span style="font-family:arial black,sans-serif"><b>while keeping the original data in the "values-y"</b> role. This way, the original data remains untouched, and the calculated values are available for rendering the histogram.</span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif">So, one of the tasks is to<b> introduce</b> <b>m_aCalculated_Y</b> in <b>VDataSeries</b> and adjust the code to use m_aCalculated_Y when it's set (i.e., for histograms), and <b>m_aValues_Y</b> <b>otherwise</b>. </span></div><div><span style="font-family:arial black,sans-serif">This requires auditing all places where m_aValues_Y is used and deciding whether to use m_aValues_Y or m_aCalculated_Y based on the context.</span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif">Additionally, there's a mention of clearing the <b>"calculated-y"</b> role when changing the chart type. </span></div><div><span style="font-family:arial black,sans-serif">This makes sense because the calculated values are specific to the histogram and shouldn't persist if the user switches to a different chart type.</span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><span style="font-family:arial black,sans-serif">Now, regarding the x-axis, there seems to be some confusion. Initially, I thought the issue was with <b>x-values</b>, but <span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3 gmail-r-a8ghvy"><span class="gmail-css-1jxf684 gmail-r-bcqeeo gmail-r-1ttztb7 gmail-r-qvutc0 gmail-r-poiln3">Tomaž</span></span></span> clarified that the primary issue is with y-values. </span></div><div><span style="font-family:arial black,sans-serif">However, in the context of histograms, the x-values represent the bins, which are also calculated from the original data. <br></span></div><div><span style="font-family:arial black,sans-serif">So, similar to the y-values, there might be a need to handle calculated x-values separately to preserve the original data.<br></span></div><div><span style="font-family:arial black,sans-serif"><br></span></div><div><br></div><div><br></div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, 1 Feb 2025 at 01:17, Devansh Varshney <<a href="mailto:varshney.devansh614@gmail.com">varshney.devansh614@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:comic sans ms,sans-serif" class="gmail_default"></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><span style="font-family:tahoma,sans-serif">Hi community,</span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><p><span><span>To follow up on the previous mail, I'd like to give you a more detailed update on how we're addressing the histogram data handling issue in the </span></span><span style="font-family:tahoma,sans-serif"><span></span><span><b><span style="color:rgb(19,79,92)">chart2</span></b></span><span></span></span><span><span> module, which </span></span><span><span>Tomaž</span></span><span><span> and Regina pointed out</span><span>.</span></span></p></span></div><ul><li class="gmail_default"><span style="font-family:tahoma,sans-serif"><span>The core problem lies in how <b>histograms</b> handle <b>X-axis</b> values. The existing </span><span><b><span style="color:rgb(19,79,92)">chart2</span></b></span><span> architecture <u><b>assumes a direct mapping between source data and chart X-axis values</b></u>.</span></span></li><li class="gmail_default"><span style="font-family:tahoma,sans-serif"><span>However, histograms </span><span style="font-style:italic"><span><span>calculate</span></span></span><span>
X-axis values (bin-width) based on the input data, leading to a
situation where these calculated values overwrite the original X-values
and create issues in many places in the code.</span></span></li><li class="gmail_default"><span style="font-family:tahoma,sans-serif"><span>We can get the render of the chart while creating it but when we tried to save(for example) the original values were gone by this time hence the problem.<br></span></span></li></ul><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><span><br></span></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><span><span>Tomaž </span></span><span><span>also said that he would like to introduce a variable </span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b> which will resolve most of the problem.<br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><span><br></span></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><span>Further Analysis -</span></span></div><div class="gmail_default"><ul><li><span style="font-family:tahoma,sans-serif"> <b>Original X-Values:</b> The original X-values are correctly stored in <span style="color:rgb(153,0,255)">XLabeledDataSequence</span>.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Histogram Calculations:</b> The histogram calculations occur within the <span style="color:rgb(180,95,6)"><i>HistogramDataInterpreter</i></span> and then the calculated values overwrite the <span style="color:rgb(153,0,255)">XLabeledDataSequence</span> x values.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Need for Separation:</b> We need to store and display the histogram-calculated X-values while preserving the original data as many parts of the code depend on original values.</span></li></ul></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><font size="4">Analysis of <b>HistogramChartType.cxx</b></font><br><br><i><b>Purpose</b>:</i> This file defines the HistogramChartType class, that is responsible for setting up a histogram chart type. It manages properties specific to histograms,</span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif">like bin width and range. It also implements the logic to create the data-series and do the calculations.<br><br><b><i>createCalculatedDataSeries()</i></b> Method:<br></span><ul><li><span style="font-family:tahoma,sans-serif">This method retrieves the raw data through the <b><span style="color:rgb(153,0,255)">XLabeledDataSequence</span></b> from <b><span style="color:rgb(116,27,71)">m_aDataSeries</span></b>. This is where the logic modifies the source data (the sequence returned from getValues()).</span></li><li><span style="font-family:tahoma,sans-serif">It then uses <b><span style="color:rgb(11,83,148)">HistogramCalculator</span></b> to perform calculations and generate the data.</span></li><li><span style="font-family:tahoma,sans-serif">Finally, it creates a new <b><span style="color:rgb(53,28,117)">HistogramDataSequence</span></b> to store calculated values and then adds that to m_aDataSeries.</span></li></ul><span style="font-family:tahoma,sans-serif"><br><b>Interaction with </b></span><span style="font-family:tahoma,sans-serif"><b><span style="color:rgb(153,0,255)">XLabeledDataSequence</span></b></span><span style="font-family:tahoma,sans-serif"><b>:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> It gets the original data using the <b>getDataSequences2()</b> method of <b>DataSeries</b>.</span></li><li><span style="font-family:tahoma,sans-serif"> It gets the original x values by using <b>getValues</b>() method of the </span><span style="font-family:tahoma,sans-serif"><b><span style="color:rgb(153,0,255)">XLabeledDataSequence</span></b></span><span style="font-family:tahoma,sans-serif"> which returns an XDataSequence and then uses the <b>getData() </b>method of the XDataSequence to retrieve the x values in a sequence of uno::Any.</span></li></ul></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><font size="4" style="font-family:tahoma,sans-serif">Analysis of <b>HistogramCalculator.cxx</b></font><span style="font-family:tahoma,sans-serif"><br><br><b>Purpose</b>: This class performs the core histogram calculations using the raw data that is provided to <span style="color:rgb(127,96,0)"><b>computeBinFrequencyHistogram()</b></span> method.<br><br><b>Bin Calculation Logic:</b><br></span><ul><li><span style="font-family:tahoma,sans-serif"> The class calculates the number of bins, bin width, and bin ranges based on the input data.</span></li><li><span style="font-family:tahoma,sans-serif"> It computes bin ranges and their frequencies.</span></li><li><span style="font-family:tahoma,sans-serif"> The calculated values are stored internally in <b>maBinRanges</b> and <b>maBinFrequencies</b>.</span></li></ul></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><font size="4">Understanding<b> <span style="color:rgb(0,0,0)">HistogramDataSequence.cxx</span></b></font><br><br><b>Data Storage:</b><br></span><ul><li><span style="font-family:tahoma,sans-serif"> The primary data storage is the <b>mxValues</b> member, which is a <b>uno::Sequence<double></b>. This sequence stores the calculated bin values for the histogram.</span></li><li><span style="font-family:tahoma,sans-serif"> There is also <b>mxLabels</b> which stores labels but we are not concerned with it.</span></li></ul><span style="font-family:tahoma,sans-serif"><b><br>Interface Implementations:</b><br></span><ul><li><span style="font-family:tahoma,sans-serif"> <b><span style="color:rgb(153,0,0)">HistogramDataSequence</span></b> implements several UNO interfaces including <i>XNumericalDataSequence, XTextualDataSequence, XDataSequence</i>.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>getNumericalData()</b>: Returns the <b>mxValues</b> as a <b>uno::Sequence<double></b>.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>getTextualData()</b>: Returns an empty <b>uno::Sequence<OUString></b>.</span></li><li><span style="font-family:tahoma,sans-serif"> <b> getData()</b>: Returns the <b>mxValues</b> as a <b>uno::Sequence<uno::Any></b>.</span></li></ul></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><font size="4"><br></font></div><div class="gmail_default"><div class="gmail_default"><font size="4"><span style="font-family:tahoma,sans-serif">Proposed Solution:</span></font></div></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif">To address these issues, this is how I am thinking of making the changes:<br><br> * <b>Add </b></span><b><span style="font-family:tahoma,sans-serif"><span><span></span></span><span style="color:rgb(56,118,29)">XValuesCalculated</span></span><span style="font-family:tahoma,sans-serif"> Property(As said by </span><span style="font-family:tahoma,sans-serif"><span><span>Tomaž)</span></span></span></b><span style="font-family:tahoma,sans-serif"><b> </b>:<br></span><ul><li><span style="font-family:tahoma,sans-serif"> Add an <b>[optional, attribute] sequence<<span style="color:rgb(11,83,148)">double</span>> </b></span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><b>;</b> to the <b>DataSeries</b> service definition (<b>offapi/com/sun/star/chart2/DataSeries.idl</b>).</span></li><li><span style="font-family:tahoma,sans-serif"> Implement the corresponding storage, getter, and setter methods in <b>DataSeries.hxx</b> and <b>DataSeries.cxx</b>. (Add storage for</span> <span style="font-family:tahoma,sans-serif"><b>m_aXValuesCalculated</b>)</span></li><li><span style="font-family:tahoma,sans-serif"> Add the corresponding property support in <b>OPropertySet.hxx</b> and <b>OPropertySet.cxx</b>?</span></li></ul><span style="font-family:tahoma,sans-serif"></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"> <b>Why add it to DataSeries? </b>-> If my understanding is correct, </span><span style="font-family:tahoma,sans-serif"><b></b></span><b><span style="font-family:tahoma,sans-serif"><span><span></span></span><span style="color:rgb(56,118,29)">XValuesCalculated</span></span><span style="font-family:tahoma,sans-serif"></span></b><span style="font-family:tahoma,sans-serif"> is a property associated with a DataSeries and is not a new data structure by itself, so we do not need to create a new IDL file for it</span><span style="font-family:tahoma,sans-serif"><span><span>.</span></span></span></div><div class="gmail_default"><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><b> No Boolean Flag Needed:</b> -> we do not need an explicit boolean flag.<br><br> I am using <span><span><b>.<span style="color:rgb(103,78,167)">hasElements</span>() </b>and <u>w</u></span></span><u>hy Length Check is Sufficient</u>:</span><ul><li><span style="font-family:tahoma,sans-serif"> <b>Presence = Calculated Values</b>: The presence of elements within the </span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"> sequence is sufficient to determine if calculated X-values exist.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Empty Sequence = No Calculated Values</b>:
An empty sequence, which tells us that no values have been calculated.
This is very convenient because UNO Sequences can be empty.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>No Redundancy:</b> Using a separate boolean flag would add redundancy. <br></span></li></ul></div></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"><b> Modify Histogram Logic:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> Update <span style="color:rgb(180,95,6)">HistogramDataInterpreter</span><span style="color:rgb(153,0,0)">.cxx</span> to perform calculations and store calculated bin values in the </span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"> property of the corresponding DataSeries object. This will not touch the original values in the </span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><b><span style="color:rgb(153,0,255)">XLabeledDataSequence</span></b></span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif">.</span></li><li><span style="font-family:tahoma,sans-serif"> And the Histogram View utilises the BarChart view for the final rendering.</span></li></ul><span style="font-family:tahoma,sans-serif"><br> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"><b> Modify Rendering Logic:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> Modify chart renderers (such as VSeriesPlotter.cxx ?) to prioritize the </span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"> property when available for plotting. When the </span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"> is not available then it will use the original values of </span><span style="font-family:tahoma,sans-serif"><b><span style="color:rgb(153,0,255)">XLabeledDataSequence</span></b></span><span style="font-family:tahoma,sans-serif">.</span></li></ul><span style="font-family:tahoma,sans-serif"><br> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"> <b>Adjust Axis Scaling:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> Modify the code to use the </span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"> property, when available, for axis scaling range calculation.</span></li></ul><span style="font-family:tahoma,sans-serif"><br> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"> <b>Preserve Original Data in UI:</b><br></span><ul><li><span style="font-family:tahoma,sans-serif"> Ensure that UI components always display original data fetched from <b>XLabeledDataSequence</b> with the role of <b>"values-x".</b></span></li><li><span style="font-family:tahoma,sans-serif"> Since users expect the UI tables to reflect the underlying data they have provided. If we show calculated bin values in tables/cells, it will be confusing and wrong.</span></li></ul><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><br> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"> <b>Comprehensive Testing:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> Create tests to ensure that the changes work and do not cause a regression to ensure proper functionality and maintain backward compatibility.</span></li><li><span style="font-family:tahoma,sans-serif"> We will also make sure the undo and redo are working properly.</span></li></ul><span style="font-family:tahoma,sans-serif"><br> </span><span style="font-family:tahoma,sans-serif">*</span><span style="font-family:tahoma,sans-serif"><b> Documentation:<br></b></span><ul><li><span style="font-family:tahoma,sans-serif"> Document all the changes to reflect the new property and its usage.</span></li></ul></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><br></span></div><br><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><font size="4">Key Benefits:</font><br></span><ol><li><span style="font-family:tahoma,sans-serif"> <b> Correct Histogram Display:</b> Histograms will correctly use calculated bin values for the X-axis.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Preserved Original Data:</b> Original source data will be maintained for other charts and user interactions.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Minimal Impact:</b> This change does not affect other chart types, it ensures backward compatibility, and it only impacts histogram and renderer-specific logic.</span></li><li><span style="font-family:tahoma,sans-serif"> <b>Clear Separation:</b> Separates the concern of raw data and calculated data.</span></li><li><span style="font-family:tahoma,sans-serif"> <b> Improved Architecture: </b>Addresses the underlying issue of assumptions embedded in the chart(</span><span style="font-family:tahoma,sans-serif"><span style="font-family:tahoma,sans-serif"><span><b><span style="color:rgb(19,79,92)">chart2</span></b></span><span></span></span><span><span>)</span></span></span><span style="font-family:tahoma,sans-serif"> module.</span></li></ol></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif"><b><i>Is the below file related?<br></i></b></span></div><div class="gmail_default"><a href="https://github.com/LibreOffice/core/blob/b0a4afc58e1c9434e56ddb96c41f4ebe5985ed0a/chart2/source/controller/dialogs/DataBrowser.cxx#L4" style="font-family:tahoma,sans-serif" target="_blank">chart2/source/controller/dialogs/DataBrowser.cxx</a><span style="font-family:tahoma,sans-serif"> <br></span></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Do we also have to m<span><span>odify </span><span><b>getValues()</b></span><span> in </span><b><span>XLabeledDataSequence</span></b><span> to return calculated values or original values based on the presence of </span></span><span style="font-family:tahoma,sans-serif"></span><span style="font-family:tahoma,sans-serif"><span><span></span></span><b><span style="color:rgb(56,118,29)">XValuesCalculated</span></b></span><span style="font-family:tahoma,sans-serif"></span><span><span></span><span> property and chart type?</span></span></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><span><span><br></span></span></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><span><span></span></span></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">If other places need changes or I if have still missed files (please let me know)</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">and the changes in the <b>offapi/com/sun/star/chart2/DataSeries.idl</b> are correct?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 23 Jan 2025 at 18:59, Regina Henschel (via Code Review) <<a href="mailto:gerrit@gerrit.libreoffice.org" target="_blank">gerrit@gerrit.libreoffice.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Attention is currently required from: Devansh Varshney, Tomaž Vajngerl.<br>
<br>
Regina Henschel has posted comments on this change by Devansh Varshney. ( <a href="https://gerrit.libreoffice.org/c/core/+/177364?usp=email" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/c/core/+/177364?usp=email</a> )<br>
<br>
Change subject: xmloff: Histogram Chart ODF import and export support<br>
......................................................................<br>
<br>
<br>
Patch Set 26:<br>
<br>
(2 comments)<br>
<br>
Patchset:<br>
<br>
PS26: <br>
There is a deeper problem. You have set the calculated binFrequencies and binRanges in place of the original data. That has give you a convenient way for getting a rendering as bar chart. Not only does this cause bugs tdf#164109 and tdf#162240, but now you can't export the <chart:series> element the same way as it is done for other chart types. I'm referring to the way that can be seen after comment '// export dataseries for current chart-type' in SchXMLExport.cxx.<br>
<br>
Currently in your patch, the <chart:series> element is not exported at all. When it will be exported, the new <loext:histogram-configuration> element has to become a child element after all the existing child elements. If the export looks similar to the existing chart types, it would be just before the comment '// close series'.<br>
<br>
I suggest to discuss the underlying problem with Tomaž Vajngerl. I don't see an easy solution and would have to try a lot. Until this is resolved, it doesn't make sense to make progress on the export.<br>
<br>
<br>
File schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng:<br>
<br>
<a href="https://gerrit.libreoffice.org/c/core/+/177364/comment/2e8b89d8_b939b3f4?usp=email" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/c/core/+/177364/comment/2e8b89d8_b939b3f4?usp=email</a> :<br>
PS26, Line 2149: <rng:optional><br>
: <rng:ref name="loext-histogram-configuration"/><br>
: </rng:optional><br>
> I mean the `loext:histogram-configuration` is placed under `chart:series` is this the correct way? […]<br>
The position is correct.<br>
<br>
<br>
<br>
-- <br>
To view, visit <a href="https://gerrit.libreoffice.org/c/core/+/177364?usp=email" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/c/core/+/177364?usp=email</a><br>
To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.libreoffice.org/settings?usp=email" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/settings?usp=email</a><br>
<br>
Gerrit-MessageType: comment<br>
Gerrit-Project: core<br>
Gerrit-Branch: master<br>
Gerrit-Change-Id: Ibda198c1a3e4a7b53e3cf590c33cc9adb558be74<br>
Gerrit-Change-Number: 177364<br>
Gerrit-PatchSet: 26<br>
Gerrit-Owner: Devansh Varshney <<a href="mailto:varshney.devansh614@gmail.com" target="_blank">varshney.devansh614@gmail.com</a>><br>
Gerrit-Reviewer: Jenkins<br>
Gerrit-Reviewer: Tomaž Vajngerl <<a href="mailto:quikee@gmail.com" target="_blank">quikee@gmail.com</a>><br>
Gerrit-CC: Regina Henschel <<a href="mailto:rb.henschel@t-online.de" target="_blank">rb.henschel@t-online.de</a>><br>
Gerrit-Attention: Devansh Varshney <<a href="mailto:varshney.devansh614@gmail.com" target="_blank">varshney.devansh614@gmail.com</a>><br>
Gerrit-Attention: Tomaž Vajngerl <<a href="mailto:quikee@gmail.com" target="_blank">quikee@gmail.com</a>><br>
Gerrit-Comment-Date: Thu, 23 Jan 2025 13:29:36 +0000<br>
Gerrit-HasComments: Yes<br>
Gerrit-Has-Labels: No<br>
Comment-In-Reply-To: Devansh Varshney <<a href="mailto:varshney.devansh614@gmail.com" target="_blank">varshney.devansh614@gmail.com</a>><br>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-family:monospace"><b>Regards,</b></span></div><div><span style="font-family:monospace;color:rgb(153,0,255)"><b>Devansh</b></span><br></div></div></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-family:monospace"><b>Regards,</b></span></div><div><span style="font-family:monospace;color:rgb(153,0,255)"><b>Devansh</b></span><br></div></div></div>