fdo#43681: Always sort category axis when it's a date type.

Or else we'd end up drawing a pretty interesting diagram...
This commit is contained in:
Kohei Yoshida
2011-12-13 16:13:02 -05:00
parent 2977e3e988
commit ccc59bc76f

View File

@@ -629,6 +629,8 @@ void AreaChart::createShapes()
sal_Int32 nCreatedPoints = 0; sal_Int32 nCreatedPoints = 0;
// //
bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
//============================================================================= //=============================================================================
//iterate through all x values per indices //iterate through all x values per indices
for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ ) for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
@@ -646,8 +648,8 @@ void AreaChart::createShapes()
for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter ) for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
{ {
::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector); ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin(); std::vector<VDataSeries*>::iterator aSeriesIter = pSeriesList->begin();
const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end(); const std::vector<VDataSeries*>::iterator aSeriesEnd = pSeriesList->end();
for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter ) for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
{ {
@@ -655,6 +657,9 @@ void AreaChart::createShapes()
if(!pSeries) if(!pSeries)
continue; continue;
if (bDateCategory)
pSeries->doSortByXValues();
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex(); sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() ) if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
aLogicYSumMap[nAttachedAxisIndex]=0.0; aLogicYSumMap[nAttachedAxisIndex]=0.0;
@@ -716,7 +721,7 @@ void AreaChart::createShapes()
//collect data point information (logic coordinates, style ): //collect data point information (logic coordinates, style ):
double fLogicX = (*aSeriesIter)->getXValue(nIndex); double fLogicX = (*aSeriesIter)->getXValue(nIndex);
if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) if (bDateCategory)
fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution ); fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
double fLogicY = (*aSeriesIter)->getYValue(nIndex); double fLogicY = (*aSeriesIter)->getYValue(nIndex);