Kaydet (Commit) 33c0a646 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

tdf#42915, NaN in a date axis can destroy the whole chart

The NaN value forces the scaling of the axis to be based on years
and introduces gaps in the rendering.

Change-Id: I78219be289d76edb53b5672209e1c031ab62def9
Reviewed-on: https://gerrit.libreoffice.org/64267
Tested-by: Jenkins
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 92d39b63
...@@ -718,7 +718,12 @@ void AreaChart::createShapes() ...@@ -718,7 +718,12 @@ void AreaChart::createShapes()
//collect data point information (logic coordinates, style ): //collect data point information (logic coordinates, style ):
double fLogicX = pSeries->getXValue(nIndex); double fLogicX = pSeries->getXValue(nIndex);
if (bDateCategory) if (bDateCategory)
{
if (rtl::math::isNan(fLogicX))
continue;
fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution ); fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
}
double fLogicY = pSeries->getYValue(nIndex); double fLogicY = pSeries->getYValue(nIndex);
if( m_nDimension==3 && m_bArea && rXSlot.m_aSeriesVector.size()!=1 ) if( m_nDimension==3 && m_bArea && rXSlot.m_aSeriesVector.size()!=1 )
......
...@@ -1451,10 +1451,17 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() ...@@ -1451,10 +1451,17 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis()
if( !rDateCategories.empty() ) if( !rDateCategories.empty() )
{ {
std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end(); std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end();
while (rtl::math::isNan(*aIt) && aIt != aEnd)
{
++aIt;
}
Date aPrevious(aNullDate); aPrevious.AddDays(rtl::math::approxFloor(*aIt)); Date aPrevious(aNullDate); aPrevious.AddDays(rtl::math::approxFloor(*aIt));
++aIt; ++aIt;
for(;aIt!=aEnd;++aIt) for(;aIt!=aEnd;++aIt)
{ {
if (rtl::math::isNan(*aIt))
continue;
Date aCurrent(aNullDate); aCurrent.AddDays(rtl::math::approxFloor(*aIt)); Date aCurrent(aNullDate); aCurrent.AddDays(rtl::math::approxFloor(*aIt));
if( nRet == css::chart::TimeUnit::YEAR ) if( nRet == css::chart::TimeUnit::YEAR )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment