[Libreoffice-commits] .: 3 commits - chart2/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Dec 13 13:19:35 PST 2011


 chart2/source/view/charttypes/AreaChart.cxx      |   31 +++++++++++++----------
 chart2/source/view/charttypes/VSeriesPlotter.cxx |    2 -
 2 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit a9d1d2f35c7c763fdf59e0350478f583f9d934f8
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Dec 13 16:18:03 2011 -0500

    Prefer reference over pointer (when it makes sense).

diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 2e0161a..35f7033 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -647,9 +647,9 @@ void AreaChart::createShapes()
             //iterate through all x slots in this category to get 100percent sum
             for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
             {
-                ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
-                std::vector<VDataSeries*>::iterator       aSeriesIter = pSeriesList->begin();
-                const std::vector<VDataSeries*>::iterator aSeriesEnd  = pSeriesList->end();
+                std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
+                std::vector<VDataSeries*>::iterator       aSeriesIter = rSeriesList.begin();
+                const std::vector<VDataSeries*>::iterator aSeriesEnd  = rSeriesList.end();
 
                 for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
                 {
@@ -688,9 +688,9 @@ void AreaChart::createShapes()
             aXSlotIter = aZSlotIter->begin();
             for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, ++nX )
             {
-                ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
-                ::std::vector< VDataSeries* >::const_iterator       aSeriesIter = pSeriesList->begin();
-                const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd  = pSeriesList->end();
+                std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
+                std::vector<VDataSeries*>::const_iterator       aSeriesIter = rSeriesList.begin();
+                const std::vector<VDataSeries*>::const_iterator aSeriesEnd  = rSeriesList.end();
 
                 std::map< sal_Int32, double > aLogicYForNextSeriesMap;//one for each different nAttachedAxisIndex
     //=============================================================================
@@ -704,7 +704,7 @@ void AreaChart::createShapes()
                     /*  #i70133# ignore points outside of series length in standard area
                         charts. Stacked area charts will use missing points as zeros. In
                         standard charts, pSeriesList contains only one series. */
-                    if( m_bArea && (pSeriesList->size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
+                    if( m_bArea && (rSeriesList.size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
                         continue;
 
                     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(*aSeriesIter, m_xSeriesTarget);
@@ -730,7 +730,7 @@ void AreaChart::createShapes()
                     {
                         if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
                         {
-                            if( pSeriesList->size() == 1 || nSeriesIndex == 0 )
+                            if( rSeriesList.size() == 1 || nSeriesIndex == 0 )
                             {
                                 fLogicY = pPosHelper->getLogicMinY();
                                 if( !pPosHelper->isMathematicalOrientationY() )
@@ -741,7 +741,7 @@ void AreaChart::createShapes()
                         }
                     }
 
-                    if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
+                    if( m_nDimension==3 && m_bArea && rSeriesList.size()!=1 )
                         fLogicY = fabs( fLogicY );
 
                     if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
commit ccc59bc76f2d7cd5d6ccae47efc7e6633f01a70a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Dec 13 16:13:02 2011 -0500

    fdo#43681: Always sort category axis when it's a date type.
    
    Or else we'd end up drawing a pretty interesting diagram...

diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index e6d86aa..2e0161a 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -629,6 +629,8 @@ void AreaChart::createShapes()
     sal_Int32 nCreatedPoints = 0;
     //
 
+    bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
+
 //=============================================================================
     //iterate through all x values per indices
     for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
@@ -646,8 +648,8 @@ void AreaChart::createShapes()
             for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
             {
                 ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
-                ::std::vector< VDataSeries* >::const_iterator       aSeriesIter = pSeriesList->begin();
-                const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd  = pSeriesList->end();
+                std::vector<VDataSeries*>::iterator       aSeriesIter = pSeriesList->begin();
+                const std::vector<VDataSeries*>::iterator aSeriesEnd  = pSeriesList->end();
 
                 for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
                 {
@@ -655,6 +657,9 @@ void AreaChart::createShapes()
                     if(!pSeries)
                         continue;
 
+                    if (bDateCategory)
+                        pSeries->doSortByXValues();
+
                     sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
                     if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
                         aLogicYSumMap[nAttachedAxisIndex]=0.0;
@@ -716,7 +721,7 @@ void AreaChart::createShapes()
 
                     //collect data point information (logic coordinates, style ):
                     double fLogicX = (*aSeriesIter)->getXValue(nIndex);
-                    if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() )
+                    if (bDateCategory)
                         fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
                     double fLogicY = (*aSeriesIter)->getYValue(nIndex);
 
commit 2977e3e9882c14cda9d462cf96cd1f00fe7af4f7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Dec 13 12:34:28 2011 -0500

    Prefer pre-increments, especially with iterators.

diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 937ac09..e6d86aa 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -637,7 +637,7 @@ void AreaChart::createShapes()
         const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator  aZSlotEnd = m_aZSlots.end();
 
         std::map< sal_Int32, double > aLogicYSumMap;//one for each different nAttachedAxisIndex
-        for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+        for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
         {
             ::std::vector< VDataSeriesGroup >::iterator             aXSlotIter = aZSlotIter->begin();
             const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
@@ -673,7 +673,7 @@ void AreaChart::createShapes()
 
 //=============================================================================
         aZSlotIter = m_aZSlots.begin();
-        for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+        for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
         {
             ::std::vector< VDataSeriesGroup >::iterator             aXSlotIter = aZSlotIter->begin();
             const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
@@ -797,7 +797,7 @@ void AreaChart::createShapes()
                         pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
                                                             , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
                     {
-                        nSkippedPoints++;
+                        ++nSkippedPoints;
                         m_bPointsWereSkipped = true;
                         continue;
                     }
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 22fecf5..9a01b95 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1405,7 +1405,7 @@ sal_Int32 VSeriesPlotter::getPointCount() const
     ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator       aZSlotIter = m_aZSlots.begin();
     const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
 
-    for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+    for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
     {
         ::std::vector< VDataSeriesGroup >::const_iterator       aXSlotIter = aZSlotIter->begin();
         const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();


More information about the Libreoffice-commits mailing list