diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-11-29 19:11:58 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-11-29 23:31:36 +0100 |
commit | 33c0a64650646fc542a104f025abbf30d1b7628f (patch) | |
tree | 46fbeea1a9c8684db0300150e298cc63cef28c71 /chart2 | |
parent | 92d39b63d28fa3a65de623ea1c6f455c01fa9473 (diff) |
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: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 5 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index f7f49af92f30..570dd0840f8b 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -718,7 +718,12 @@ void AreaChart::createShapes() //collect data point information (logic coordinates, style ): double fLogicX = pSeries->getXValue(nIndex); if (bDateCategory) + { + if (rtl::math::isNan(fLogicX)) + continue; + fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution ); + } double fLogicY = pSeries->getYValue(nIndex); if( m_nDimension==3 && m_bArea && rXSlot.m_aSeriesVector.size()!=1 ) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index f80f656cf478..ff09606cda5c 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1451,10 +1451,17 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() if( !rDateCategories.empty() ) { 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)); ++aIt; for(;aIt!=aEnd;++aIt) { + if (rtl::math::isNan(*aIt)) + continue; + Date aCurrent(aNullDate); aCurrent.AddDays(rtl::math::approxFloor(*aIt)); if( nRet == css::chart::TimeUnit::YEAR ) { |