diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-12-13 16:13:02 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-12-13 16:20:24 -0500 |
commit | ccc59bc76f2d7cd5d6ccae47efc7e6633f01a70a (patch) | |
tree | c33e05ddfdc4f2eb84604a8762660eb0b29e1a6f /chart2 | |
parent | 2977e3e9882c14cda9d462cf96cd1f00fe7af4f7 (diff) |
fdo#43681: Always sort category axis when it's a date type.
Or else we'd end up drawing a pretty interesting diagram...
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e6d86aa07c7b..2e0161a7f6cf 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); |