summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-01-12 14:36:07 +0100
committerIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-01-12 14:36:07 +0100
commitbb15dfd763af19c547a27c40882d9cdf1477f375 (patch)
treec61f11f2407c0ca3ab3072db2415984df595b7d5 /chart2
parent9a8ff5c2508f78394dfda2e22c0b3b600000a284 (diff)
chart46: #i25706# implement date axis - #i116425# interpret no data as text axis
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx16
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx25
2 files changed, 32 insertions, 9 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 7e93afd3b42e..a075f6c3a5c6 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -43,6 +43,7 @@
#include "ExplicitCategoriesProvider.hxx"
#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -800,8 +801,19 @@ void DataBrowserModel::updateFromModel()
if( lcl_ShowCategories( xDiagram ))
{
Reference< frame::XModel > xChartModel( m_xChartDocument, uno::UNO_QUERY );
- ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
- bool bIsDateAxis = aExplicitCategoriesProvider.isDateAxis();
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
+ bool bIsDateAxis = false;
+ if( xCooSys.is() )
+ {
+ Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension(0,0) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScale( xAxis->getScaleData() );
+ bIsDateAxis = (aScale.AxisType == chart2::AxisType::DATE);
+ }
+ }
+
sal_Int32 nDateCategoriesNumberFormat = 0;
if( bIsDateAxis && aCooSysSeq.getLength() )
nDateCategoriesNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( 0, aCooSysSeq[0], 0, 0 );
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index c1b3ae4daf39..1c52a3c3e622 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -412,6 +412,7 @@ bool lcl_isDateFormat( sal_Int32 nNumberFormat, const Reference< util::XNumberFo
bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier )
{
bool bOnlyDatesFound = true;
+ bool bAnyDataFound = false;
if( xDataSequence.is() )
{
@@ -451,18 +452,28 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS
else
bIsDate = true;
+ bool bContainsEmptyString = false;
+ bool bContainsNan = false;
uno::Any aAny = aValues[nN];
+ if( aAny.hasValue() )
+ {
+ OUString aTest;
+ double fTest;
+ if( (aAny>>=aTest) && !aTest.getLength() ) //empty String
+ bContainsEmptyString = true;
+ else if( (aAny>>=fTest) && ::rtl::math::isNan(fTest) )
+ bContainsNan = true;
+
+ if( !bContainsEmptyString && !bContainsNan )
+ bAnyDataFound = true;
+ }
DatePlusIndex aDatePlusIndex( 1.0, nN );
if( bIsDate && (aAny >>= aDatePlusIndex.fValue) )
rDateCategories.push_back( aDatePlusIndex );
else
{
- if( aAny.hasValue() )
- {
- OUString aTest;
- if( !( (aAny>>=aTest) && !aTest.getLength() ) )//empty string does not count as non date value!
- bOnlyDatesFound=false;
- }
+ if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value!
+ bOnlyDatesFound=false;
::rtl::math::setNan( &aDatePlusIndex.fValue );
rDateCategories.push_back( aDatePlusIndex );
}
@@ -470,7 +481,7 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS
::std::sort( rDateCategories.begin(), rDateCategories.end(), DatePlusIndexComparator() );
}
- return bOnlyDatesFound;
+ return bAnyDataFound && bOnlyDatesFound;
}
void ExplicitCategoriesProvider::init()