<div dir="ltr"><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Hi,<br clear="all"></div><div><br><div style="font-family:comic sans ms,sans-serif" class="gmail_default">So last week my mentor <i>Tomaž</i> set the direction of the descent towards a working Histogram which is now successfully merged with master <a href="https://gerrit.libreoffice.org/c/core/+/167068">https://gerrit.libreoffice.org/c/core/+/167068</a></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">As I kept looking to modify the View for the Histogram which was quite late to do so and hence he set up two file <i>HistogramDataSequence</i> and <i>HistogramDataInterpreter</i> as the name suggests handling sequence of data and interpreting it in separate logic. <br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">and as I used square root to calculate the number of bins which was easier to test with(for me) which was later pointed out that we should be using what MS-Office is using and my mentor pointed me <a href="https://support.microsoft.com/en-us/office/create-a-histogram-85680173-064b-4024-b39d-80f17ff2f4e8#ID0EBBDBBJBJ-panel">https://support.microsoft.com/en-us/office/create-a-histogram-85680173-064b-4024-b39d-80f17ff2f4e8#ID0EBBDBBJBJ-panel</a> <b class="gmail-ocpRunInHead">Scott’s normal reference (By Default) </b>and as off now I do have created a <i>separate commit </i>for this which I corrected/aligned over the last week- <a href="https://gerrit.libreoffice.org/c/core/+/170526">https://gerrit.libreoffice.org/c/core/+/170526</a></div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">We are still not having the exact same values as in the MS-Office ones, which still needs some calculation(rounding/approximation) corrections.<br></div><br></div><div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">MS-Office vs. Our Implementation -</div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><img src="cid:ii_lyx4hbyq0" alt="image.png" width="710" height="282" style="margin-right: 0px;"><br><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">Google Sheet vs. Our Implementation -</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><img src="cid:ii_lyx4jo0z1" alt="image.png" width="707" height="254" style="margin-right: 0px;"><br><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><i><u>There is a blog about Hisotgram and its working by MSO</u></i> <a href="http://web.archive.org/web/20160117042913/https://blogs.office.com/2015/08/18/visualize-statistics-with-histogram-pareto-and-box-and-whisker-charts/">http://web.archive.org/web/20160117042913/https://blogs.office.com/2015/08/18/visualize-statistics-with-histogram-pareto-and-box-and-whisker-charts/</a></div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">Second, I also made a mistake in how we perceive/begin the bin range?</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"> I believed that creating Bin Ranges was similar to filling a glass with water, wherein we begin by including the beginning(base) until below the top(to avoid overflow), akin to filling a glass of water.</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"> i.e. <b>[Glass of Water)</b></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">But, this is not how MS-Office is doing rather it was <b>(Glass of Water]</b> & can be seen in the above imageries. Hence, made change to the code -<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(106,153,85)"> // Set up bin ranges</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">maBinRanges</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">reserve</span><span style="color:rgb(204,204,204)">(mnBins);</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(86,156,214)">double</span><span style="color:rgb(204,204,204)"> fBinStart </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> fMinValue;</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">for</span><span style="color:rgb(204,204,204)"> (sal_Int32 i </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(204,204,204)">; i </span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(204,204,204)"> mnBins; </span><span style="color:rgb(212,212,212)">++</span><span style="color:rgb(204,204,204)">i)</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(86,156,214)">double</span><span style="color:rgb(204,204,204)"> fBinEnd </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> fBinStart </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> mfBinWidth;</span></div><br><div><span style="color:rgb(106,153,85)"> // Correct rounding to avoid discrepancies</span></div><div><span style="color:rgb(204,204,204)"> fBinStart </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">round</span><span style="color:rgb(204,204,204)">(fBinStart </span><span style="color:rgb(212,212,212)">*</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">100.0</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">/</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">100.0</span><span style="color:rgb(204,204,204)">;</span></div><div><span style="color:rgb(204,204,204)"> fBinEnd </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">round</span><span style="color:rgb(204,204,204)">(fBinEnd </span><span style="color:rgb(212,212,212)">*</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">100.0</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">/</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">100.0</span><span style="color:rgb(204,204,204)">;</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(204,204,204)"> (i </span><span style="color:rgb(212,212,212)">==</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(204,204,204)">)</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(106,153,85)"> // First bin includes the minimum value, so use closed interval [fMinValue, fBinEnd]</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">maBinRanges</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">emplace_back</span><span style="color:rgb(204,204,204)">(fMinValue, fBinEnd);</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">else</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(106,153,85)"> // Subsequent bins use half-open interval (fBinStart, fBinEnd]</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">maBinRanges</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">emplace_back</span><span style="color:rgb(204,204,204)">(fBinStart, fBinEnd);</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><div><span style="color:rgb(204,204,204)"> fBinStart </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> fBinEnd;</span></div><div><span style="color:rgb(204,204,204)"> }</span></div></div></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(106,153,85)"> // Create labels and values for HistogramDataSequence</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(204,204,204)">::vector</span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(204,204,204)">OUString</span><span style="color:rgb(212,212,212)">></span><span style="color:rgb(204,204,204)"> labels;</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(204,204,204)">::vector</span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(86,156,214)">double</span><span style="color:rgb(212,212,212)">></span><span style="color:rgb(204,204,204)"> values;</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">for</span><span style="color:rgb(204,204,204)"> (</span><span style="color:rgb(86,156,214)">size_t</span><span style="color:rgb(204,204,204)"> i </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(204,204,204)">; i </span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">binRanges</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">size</span><span style="color:rgb(204,204,204)">(); </span><span style="color:rgb(212,212,212)">++</span><span style="color:rgb(204,204,204)">i)</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> OUString label;</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(204,204,204)"> (i </span><span style="color:rgb(212,212,212)">==</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(204,204,204)">)</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> label </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"["</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">OUString</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">number</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">binRanges</span><span style="color:rgb(204,204,204)">[i].</span><span style="color:rgb(156,220,254)">first</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"-"</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">OUString</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">number</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">binRanges</span><span style="color:rgb(204,204,204)">[i].</span><span style="color:rgb(156,220,254)">second</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"]"</span><span style="color:rgb(204,204,204)">;</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">else</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> label </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"("</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">OUString</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">number</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">binRanges</span><span style="color:rgb(204,204,204)">[i].</span><span style="color:rgb(156,220,254)">first</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"-"</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">OUString</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">number</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">binRanges</span><span style="color:rgb(204,204,204)">[i].</span><span style="color:rgb(156,220,254)">second</span><span style="color:rgb(204,204,204)">) </span><span style="color:rgb(212,212,212)">+</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">u"]"</span><span style="color:rgb(204,204,204)">;</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">labels</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">push_back</span><span style="color:rgb(204,204,204)">(label);</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">values</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">push_back</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(86,156,214)">static_cast</span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(86,156,214)">double</span><span style="color:rgb(212,212,212)">></span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">binFrequencies</span><span style="color:rgb(204,204,204)">[i]));</span></div><div><span style="color:rgb(204,204,204)"> }</span></div></div></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">i.e. A data point is included in a particular bin if the number is greater
than the lowest bound and equal to or less than the greatest bound for
the data bin.</div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">Now, these above two changes are still needs to be added /merge to replace the square root method.<br></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">There is one more thing which can be seen easily is the color of the bins in our implementation and which is also being pointed out by <span class="gmail-vcard"><a class="email" href="mailto:stephane.guillou@libreoffice.org" title="Stéphane Guillou (stragu) <stephane.guillou@libreoffice.org>"> <span class="gmail-fn">Stéphane</span></a> </span>in the testing <a href="https://bugs.documentfoundation.org/show_bug.cgi?id=162135">https://bugs.documentfoundation.org/show_bug.cgi?id=162135</a></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"> Me and my mentor, we both did have a conversation on this that this is probably due to as we are creating a new DataSeries instead of reusing the existing one. For example, since we are inheriting BarChart view to reuse the code for creating and rendering the bars.<br></div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(86,156,214)"><br></span></div><div><span style="color:rgb(86,156,214)"> void</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">HistogramChart</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">createShapes</span><span style="color:rgb(204,204,204)">()</span></div><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(204,204,204)"> (</span><span style="color:rgb(156,220,254)">m_aZSlots</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">empty</span><span style="color:rgb(204,204,204)">())</span><span style="color:rgb(106,153,85)"> //No data series Available</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">return</span><span style="color:rgb(204,204,204)">;</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(220,220,170)">OSL_ENSURE</span><span style="color:rgb(204,204,204)">(</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">m_xLogicTarget</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">is</span><span style="color:rgb(204,204,204)">() </span><span style="color:rgb(212,212,212)">&&</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">m_xFinalTarget</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">is</span><span style="color:rgb(204,204,204)">(),</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)"> "HistogramChart is not properly initialized"</span><span style="color:rgb(204,204,204)">);</span><span style="color:rgb(106,153,85)"> // Ensuring chart is properly initialized</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)"> if</span><span style="color:rgb(204,204,204)"> (</span><span style="color:rgb(212,212,212)">!</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">m_xLogicTarget</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">is</span><span style="color:rgb(204,204,204)">() </span><span style="color:rgb(212,212,212)">&&</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">m_xFinalTarget</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">is</span><span style="color:rgb(204,204,204)">()))</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)"> return</span><span style="color:rgb(204,204,204)">;</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(220,220,170)"> adaptGapWidthForHistogram</span><span style="color:rgb(204,204,204)">();</span></div><br><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">BarChart</span><span style="color:rgb(204,204,204)">::</span><span style="color:rgb(220,220,170)">createShapes</span><span style="color:rgb(204,204,204)">();</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><br><br></div></div><br></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">Have to discuss this and also looking for more feedback as <span style="font-family:comic sans ms,sans-serif">New histogram chart implemented in 25.2 by <a href="https://git.libreoffice.org/core/commit/07ae0e5ada7cb595eb4815413a5bdd442c32a6ab">07ae0e5ada7cb595eb4815413a5bdd442c32a6ab</a> for <a class="gmail-bz_bug_link gmail-bz_status_NEW" title="NEW - Ability to create histogram chart directly from data, not using FREQUENCY()" href="https://bugs.documentfoundation.org/show_bug.cgi?id=82716">bug 82716</a></span></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">For this week which is 11 My goal is to get the OOXML and ODF support added for the histogram <a href="http://officeopenxml.com/">http://officeopenxml.com/</a></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">The way I have understood OOXMl and ODF as sort of Container File (which could be thought of zip file) since we are using XML files for reading parsing and loading the struture how it should look on the UI or presented to the user.</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">The every first time I came across this kind of usage of XML when I was making a small software using Qt ( <a href="https://github.com/varshneydevansh/EFM-DC_V2">https://github.com/varshneydevansh/EFM-DC_V2</a> ) where for the UI I came across the usage of XML file. <br></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">So, for this if I am correct is had to make the Histogram correctly able to read and write its content in XML files so that we can use it efficiently.<br></div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><b>OOXML</b> - Microsoft Office applications like Excel (.xlsx), Word (.docx), and PowerPoint (.pptx). <b> oox/source/ directory</b></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><b>ODF</b> - Used by LibreOffice applications like Calc (.ods), Writer (.odt), and Impress (.odp). <b>xmloff/source/chart/ directory</b><h3>How Do Import and Export Work?</h3><h4>Importing (Reading)</h4><p>When we <strong>import</strong> an OOXML or ODF file:</p><ol><li>The software <strong>unzips</strong> the archive.</li><li>It <strong>reads</strong> the XML files inside.</li><li>It <strong>parses</strong> the XML data to understand the content and structure (e.g., charts, tables, text).</li><li>It <strong>loads</strong> this data into the application (like LibreOffice Calc or Excel) for us to work with.</li></ol><h4>Exporting (Saving)</h4><p>When we <strong>export</strong> to an OOXML or ODF file:</p><ol><li>The software <strong>gathers</strong> the data from the application.</li><li>It <strong>formats</strong> this data into XML according to the OOXML or ODF standards.</li><li>It <strong>creates</strong> new XML files or updates existing ones inside the archive.</li><li>It <strong>zips</strong> the files into a single archive (e.g., .xlsx or .ods).</li></ol></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">Not just this also have to look at the testing results a.k.a the bugs which are now being reported.</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">and soon work for the Pareto Chart :)<br></div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote><blockquote class="gmail_quote"><div dir="ltr" class="gmail_attr"><span class="gmail_default" style="font-family:comic sans ms,sans-serif"></span>From: <b class="gmail_sendername" dir="auto">Devansh Varshney</b> <span dir="auto"><<a href="mailto:varshney.devansh614@gmail.com">varshney.devansh614@gmail.com</a>></span><br>Date: Thu, 11 Jul 2024 at 00:30<br>Subject: GSoC: Adding Histogram Chart Native Support (Week 8, prev) and (Week 9, this)<br>To: <<a href="mailto:libreoffice@lists.freedesktop.org">libreoffice@lists.freedesktop.org</a>><br></div><br><br><div dir="auto"><div dir="ltr"><div style="font-family:comic sans ms,sans-serif">Hi,</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">So, the previous week I did not send the weekly update as I was hopeful that I am close to get this done</div><div style="font-family:comic sans ms,sans-serif">and kept pushing to not only get the X and Y axis with proper Bin Range and Frequency but also the bar</div><div style="font-family:comic sans ms,sans-serif">for the Histogram plot. But, I also find the scaling issue which I encountered by the end of the week.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">Here, I am using the analogy of Gradient Descent part of Mathematical Optimization to explain the situation.<br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">In the beginning of the May, we started off from the top region (Red) with the highest cost of instability for</div><div style="font-family:comic sans ms,sans-serif">the addition of the changes. By the end of May we were able to have the Histogram specific code but mimicking</div><div style="font-family:comic sans ms,sans-serif">Bar/Column Chart and in the beginning of the June we were able to have the bars attached to each other, </div><div style="font-family:comic sans ms,sans-serif">i.e., with ZERO gap between each other.</div><div style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyfzjvhs0" alt="image.png" width="558" height="432"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyg4vnec3" alt="Screenshot from 2024-06-13 21-38-21.png" width="353" height="180" style="margin-right: 0px;"> <img src="cid:ii_lyg4vwg84" alt="Screenshot from 2024-06-17 15-17-27.png" width="304" height="187" style="margin-right: 0px;"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">After having this as a success, we went on our next step, which was to get the X and Y axis as Bin Ranges and Frequency.</div><div>W<span class="gmail_default" style="font-family:comic sans ms,sans-serif">hich could be thought of as somewhere around the location of <i>Saddle point</i>. From here instead of going towards the</span></div><div><span class="gmail_default" style="font-family:comic sans ms,sans-serif">global minima I went towards the local minima, which is got stuck with the axes' modification.<br></span></div><div><span class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></span></div><div><span class="gmail_default" style="font-family:comic sans ms,sans-serif">Though in local minima which took me almost 4 weeks I kept revolving into it and the result was by last week -</span></div><div><span class="gmail_default" style="font-family:comic sans ms,sans-serif"></span><br><img src="cid:ii_lyg4lc4o2" alt="Screenshot from 2024-07-06 19-47-52.png" width="322" height="172" style="margin-right: 0px;"><span class="gmail_default" style="font-family:comic sans ms,sans-serif"> </span><img src="cid:ii_lyg4lc4g1" alt="Screenshot from 2024-07-06 19-55-52.png" width="325" height="173" style="margin-right: 0px;"></div><div><div style="font-family:comic sans ms,sans-serif">```bash<br></div><div style="font-family:comic sans ms,sans-serif"><b>i/p</b>- 12,10,15,16,14<br></div><div style="font-family:comic sans ms,sans-serif"><b>o/p</b> -<br></div></div><div><div style="font-family:comic sans ms,sans-serif">Entering createShapes()<br>xSeriesTarget is valid: true<br>xTextTarget is valid: true<br>m_nBins: 2, m_fBinWidth: 3<br>minValue: 10, maxValue: 16<br>m_binRanges: {10, 13} {13, 16} <br>m_binFrequencies: 3 2 <br>Bin ranges size: 2<br>Bin frequencies size: 2<br>Entering doXSlot() for bin index: 0<br>Bar dimensions - X: 0.25, Width: 0.5, Height: 1<br>Exiting doXSlot()<br>Entering doXSlot() for bin index: 1<br>Bar dimensions - X: 0.75, Width: 0.5, Height: 0.666667<br>Exiting doXSlot()<br>Exiting createShapes(</div></div><div><div style="font-family:comic sans ms,sans-serif">```</div><br></div><div><div style="font-family:comic sans ms,sans-serif">I was able to have the bars which were 2 as I am using the <b>sqrt</b> method to calculate the number of bins as of now.<br></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">After having been stuck in the local minima for so long, my mentor <i>Tomaž</i> came forward and change the direction of the</div><div style="font-family:comic sans ms,sans-serif">descent from the local minima towards the global minima by creating the <i>chart2/source/model/template/<b>HistogramDataInterpreter</b>.<b>cxx</b></i></div><div style="font-family:comic sans ms,sans-serif">and <i>chart2/source/tools/<b>HistogramDataSequence</b>.<b>cxx</b></i> where we are currently having the X and Y axis values and dummy values</div><div style="font-family:comic sans ms,sans-serif">Hard-coded -</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyg596p65" alt="Screenshot from 2024-07-08 18-20-06.png" width="391" height="207" style="margin-right: 0px;"> <img src="cid:ii_lyg59b4a6" alt="Screenshot from 2024-07-08 18-38-17.png" width="340" height="206" style="margin-right: 0px;"><br><br></div><div style="font-family:comic sans ms,sans-serif">In the above images which were being generated via the help of <b>HistogramDataInterpreter</b> the first image is taking the BarChart</div><div style="font-family:comic sans ms,sans-serif">as the base hence bars with gaps - <br></div><div style="font-family:comic sans ms,sans-serif"><i>chart2/source/view/charttypes/<b>VSeriesPlotter.cxx</b></i><b> -</b></div><div style="font-family:comic sans ms,sans-serif">```cpp<br></div><div style="font-family:comic sans ms,sans-serif"><div id="m_7339531049166401237m_-7957671227659832620m_2540617458572217542gmail-right-content-2961"><span> <span><span>else</span></span> <span><span>if</span></span>( <span>aChartType</span>.<span><span>equalsIgnoreAsciiCase</span></span>( <span>CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM</span> ) )</span></div><span></span><span><span name="post-left-line-2961"></span>
<span name="post-right-line-2961"></span>
</span><span>
</span><span>
</span><table id="m_7339531049166401237m_-7957671227659832620m_2540617458572217542gmail-diffTable"><tbody>
</tbody>
<tbody>
</tbody></table><div id="m_7339531049166401237m_-7957671227659832620m_2540617458572217542gmail-right-content-2962"><span> <span>pRet</span> = <span><span>new</span></span> <span><span><span>Bar</span></span></span><span><span>Chart</span></span>(<span>xChartTypeModel</span>,<span> </span><span>nDimensionCount</span>);</span></div></div><div style="font-family:comic sans ms,sans-serif">```<br></div><div style="font-family:comic sans ms,sans-serif">and the next image is where I after cherry-picking the code and replacing the base object as Histogram.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)"><br></span></div><div><span style="color:rgb(156,220,254)"> aNewData</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">push_back</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(156,220,254)">aData</span><span style="color:rgb(204,204,204)">[</span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(204,204,204)">]);</span></div><br><div><span style="color:rgb(204,204,204)"> {</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(78,201,176)">rtl</span><span style="color:rgb(204,204,204)">::Reference</span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(204,204,204)">HistogramDataSequence</span><span style="color:rgb(212,212,212)">></span><span style="color:rgb(204,204,204)"> aValuesDataSequence </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">new</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(220,220,170)">HistogramDataSequence</span><span style="color:rgb(204,204,204)">();</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">aValuesDataSequence</span><span style="color:rgb(204,204,204)">-></span><span style="color:rgb(220,220,170)">setValues</span><span style="color:rgb(204,204,204)">({ </span><span style="color:rgb(181,206,168)">7</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(181,206,168)">12</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(181,206,168)">4</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(181,206,168)">6</span><span style="color:rgb(204,204,204)"> });</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">aValuesDataSequence</span><span style="color:rgb(204,204,204)">-></span><span style="color:rgb(220,220,170)">setLabels</span><span style="color:rgb(204,204,204)">(</span></div><div><span style="color:rgb(204,204,204)"> { </span><span style="color:rgb(206,145,120)">u"[1-4)"</span><span style="color:rgb(86,156,214)">_ustr</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(206,145,120)">u"[4-8)"</span><span style="color:rgb(86,156,214)">_ustr</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(206,145,120)">u"[8-12)"</span><span style="color:rgb(86,156,214)">_ustr</span><span style="color:rgb(204,204,204)">, </span><span style="color:rgb(206,145,120)">u"[12-16]"</span><span style="color:rgb(86,156,214)">_ustr</span><span style="color:rgb(204,204,204)"> });</span></div><br><div><span style="color:rgb(204,204,204)"> aDataSequence </span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(204,204,204)"> aValuesDataSequence;</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(220,220,170)">SetRole</span><span style="color:rgb(204,204,204)">(aDataSequence, </span><span style="color:rgb(206,145,120)">u"values-y"</span><span style="color:rgb(86,156,214)">_ustr</span><span style="color:rgb(204,204,204)">);</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(156,220,254)">aNewData</span><span style="color:rgb(204,204,204)">.</span><span style="color:rgb(220,220,170)">push_back</span><span style="color:rgb(204,204,204)">(</span><span style="color:rgb(197,134,192)">new</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(220,220,170)">LabeledDataSequence</span><span style="color:rgb(204,204,204)">(aDataSequence));</span></div><div><span style="color:rgb(204,204,204)"> }</span></div><br></div></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">After this <i>Tomaž</i> pointed out some other changes which are better for the descent, which included the change of inheritance</div><div style="font-family:comic sans ms,sans-serif">from <b>VSeriesPlotter</b> and <b>ChartModel</b> to <b>BarChart</b>. The reason being is as<u> Histogram</u> is sort of a <u>special Barchart</u> we can reuse</div><div style="font-family:comic sans ms,sans-serif">lot
of code from Barchart itself and if you look closely in the code you
can find that the ColumnChart and Barchart are utilizing a lot</div><div><div style="font-family:comic sans ms,sans-serif">of code to avoid more redundancy of code -</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(156,220,254)">pPosHelper</span><span style="color:rgb(204,204,204)">-></span><span style="color:rgb(220,220,170)">isSwapXAndY</span><span style="color:rgb(204,204,204)">()</span></div></div></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">since they are same with only difference of axis difference.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">The second is to detach the Bin and Frequency calculation to a separate class from the <b>HistogramChartType</b> model.</div><div style="font-family:comic sans ms,sans-serif">to which we can find an appropriate place later.</div><div style="font-family:comic sans ms,sans-serif">I have done this and named the class as - <i>chart2/source/model/template/<b>HistogramCalculator.hxx</b></i></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">Third is replacing the hard-coded values with the input, i.e., dynamic calculation of the values.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">Currently, in order to align with the first point, I am reverting my addition of the <b>HistogramPositionHelper</b> with <br></div><div style="font-family:comic sans ms,sans-serif"><b>BarPositionHelper</b> and having some -</div><div style="font-family:comic sans ms,sans-serif">```bash<br></div><div style="font-family:comic sans ms,sans-serif">Error: attempt to subscript container with out-of-bounds index 2, but <br>container only holds 2 elements.<br></div><div style="font-family:comic sans ms,sans-serif">```</div><div style="font-family:comic sans ms,sans-serif">As of now, I am considering to get the dynamic calculations first and later update the inheritance. Hence, currently at the</div><div style="font-family:comic sans ms,sans-serif">small red region in between local and global minima, hence the instability with the code</div><div style="font-family:comic sans ms,sans-serif">after the intervention and better descent approach made by <i>Tomaž </i>it now won't take that much time now.<i><br></i></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyg74avf7" alt="image.png" width="423" height="238" style="margin-right: 0px;"><br></div></div><div><div style="font-family:comic sans ms,sans-serif"> what we thought how our work gonna be</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyg74syx8" alt="image.png" width="302" height="204" style="margin-right: 0px;"><br> how it's actually going<br></div><br></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">Till last week, I couldn't figure out why I got stuck this bad. But now it makes sense from the view point of mathematics. :)<br></div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif"><font size="2"><a href="https://gerrit.libreoffice.org/c/core/+/167068" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/c/core/+/167068</a></font></div></div></div></div></div>
</blockquote><br clear="all"><br></div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="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></div>