summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-12-13 16:13:02 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-12-13 16:20:38 -0500
commit210341cecae3955b7bab3b8cefc6ee7c7b8fe821 (patch)
tree32109a7a99fa3efb7b9ab24e1fc6d047b1dce9b7 /chart2
parent746c6bb340e1b9557959d9f3d33adaa830790f2c (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.cxx11
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);