<div dir="auto"><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">Hi,</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" 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 class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" 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 class="gmail_default" style="font-family:comic sans ms,sans-serif">i.e., with ZERO gap between each other.</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><img src="cid:ii_lyfzjvhs0" alt="image.png" width="558" height="432"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" 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 class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" 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" class="gmail_default">```bash<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><b>i/p</b>- 12,10,15,16,14<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><b>o/p</b> -<br></div></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default">```</div><br></div><div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default">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" class="gmail_default">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" class="gmail_default">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" class="gmail_default">Hard-coded -</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"><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" class="gmail_default">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" class="gmail_default">as the base hence bars with gaps - <br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><i>chart2/source/view/charttypes/<b>VSeriesPlotter.cxx</b></i><b> -</b></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">```cpp<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><div id="m_-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_-7957671227659832620m_2540617458572217542gmail-diffTable"><tbody>
</tbody>
<tbody>
</tbody></table><div id="m_-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" class="gmail_default">```<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default"><br></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-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" class="gmail_default">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" class="gmail_default">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" class="gmail_default">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" class="gmail_default">of code to avoid more redundancy of code -</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"><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" class="gmail_default">since they are same with only difference of axis difference.</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 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" class="gmail_default">to which we can find an appropriate place later.</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default">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" class="gmail_default"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default"><b>BarPositionHelper</b> and having some -</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">```bash<br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default">```</div><div style="font-family:comic sans ms,sans-serif" class="gmail_default">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" class="gmail_default">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" class="gmail_default">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" class="gmail_default"></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><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" class="gmail_default"> what we thought how our work gonna be</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"><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"><br></div><div style="font-family:comic sans ms,sans-serif" class="gmail_default"><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" class="gmail_default">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" class="gmail_default"><font size="2"><a href="https://gerrit.libreoffice.org/c/core/+/167068" target="_blank" rel="noreferrer">https://gerrit.libreoffice.org/c/core/+/167068</a></font></div></div></div></div></div>