diff options
Diffstat (limited to 'chart2/source/view/charttypes')
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 17 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.hxx | 3 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 31 |
3 files changed, 29 insertions, 22 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 1774d9828e91..67914f47bac0 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -72,7 +72,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel , bool bNoArea , PlottingPositionHelper* pPlottingPositionHelper , bool bConnectLastToFirstPoint - , bool bAddOneToXMax , bool bExpandIfValuesCloseToBorder , sal_Int32 nKeepAspectRatio , const drawing::Direction3D& rAspectRatio @@ -84,7 +83,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) ) , m_bIsPolarCooSys( bConnectLastToFirstPoint ) , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint ) - , m_bAddOneToXMax(bAddOneToXMax) , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder ) , m_nKeepAspectRatio(nKeepAspectRatio) , m_aGivenAspectRatio(rAspectRatio) @@ -123,14 +121,17 @@ AreaChart::~AreaChart() delete m_pMainPosHelper; } +double AreaChart::getMinimumX() +{ + if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling + return 1.0;//first category (index 0) matches with real number 1.0 + return VSeriesPlotter::getMinimumX(); +} + double AreaChart::getMaximumX() { - if( m_bAddOneToXMax ) - { - //return category count - sal_Int32 nPointCount = getPointCount(); - return nPointCount+1; - } + if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling + return getPointCount()+1; return VSeriesPlotter::getMaximumX(); } diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index afe9908b3bfe..6924509a62a1 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -49,7 +49,6 @@ public: , bool bCategoryXAxis, bool bNoArea=false , PlottingPositionHelper* pPlottingPositionHelper=NULL //takes owner ship , bool bConnectLastToFirstPoint=false - , bool bAddOneToXMax=false , bool bExpandIfValuesCloseToBorder=true , sal_Int32 nKeepAspectRatio=-1 //0->no 1->yes other value->automatic , const ::com::sun::star::drawing::Direction3D& rAspectRatio=::com::sun::star::drawing::Direction3D(1,1,1)//only taken into account if nKeepAspectRatio==1 @@ -76,6 +75,7 @@ public: //------------------------------------------------------------------------- // MinimumAndMaximumSupplier //------------------------------------------------------------------------- + virtual double getMinimumX(); virtual double getMaximumX(); virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ); virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ); @@ -109,7 +109,6 @@ private: //member bool m_bSymbol; bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different) bool m_bConnectLastToFirstPoint;//used e.g. for net chart - bool m_bAddOneToXMax;//used e.g. for net chart (the angle axis needs a different autoscaling) bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index a6ab71df15f5..ccba1fdc4106 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -156,7 +156,7 @@ VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeMode , m_aZSlots() , m_bCategoryXAxis(bCategoryXAxis) , m_xColorScheme() - , m_xExplicitCategoriesProvider() + , m_pExplicitCategoriesProvider(0) , m_bPointsWereSkipped(false) { DBG_ASSERT(m_xChartTypeModel.is(),"no XChartType available in view, fallback to default values may be wrong"); @@ -477,9 +477,9 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re { if(pLabel->ShowCategoryName) { - if( m_xExplicitCategoriesProvider.is() ) + if( m_pExplicitCategoriesProvider ) { - Sequence< OUString > aCategories( m_xExplicitCategoriesProvider->getTextualData() ); + Sequence< OUString > aCategories( m_pExplicitCategoriesProvider->getSimpleCategories() ); if( nPointIndex >= 0 && nPointIndex < aCategories.getLength() ) { aText.append( aCategories[nPointIndex] ); @@ -1127,7 +1127,12 @@ void VSeriesPlotter::setMappedProperties( double VSeriesPlotter::getMinimumX() { if( m_bCategoryXAxis ) - return 1.0;//first category (index 0) matches with real number 1.0 + { + double fRet = 1.0;//first category (index 0) matches with real number 1.0 + if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() ) + fRet -= 0.5; + return fRet; + } double fMinimum, fMaximum; this->getMinimumAndMaximiumX( fMinimum, fMaximum ); @@ -1138,8 +1143,10 @@ double VSeriesPlotter::getMaximumX() if( m_bCategoryXAxis ) { //return category count - sal_Int32 nPointCount = getPointCount(); - return nPointCount;//first category (index 0) matches with real number 1.0 + double fRet = getPointCount();//first category (index 0) matches with real number 1.0 + if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() ) + fRet += 0.5; + return fRet; } double fMinimum, fMaximum; @@ -1356,9 +1363,9 @@ void VSeriesPlotter::setColorScheme( const uno::Reference< XColorScheme >& xColo m_xColorScheme = xColorScheme; } -void VSeriesPlotter::setExplicitCategoriesProvider( const uno::Reference< data::XTextualDataSequence >& xExplicitCategoriesProvider ) +void VSeriesPlotter::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider ) { - m_xExplicitCategoriesProvider = xExplicitCategoriesProvider; + m_pExplicitCategoriesProvider = pExplicitCategoriesProvider; } sal_Int32 VDataSeriesGroup::getPointCount() const @@ -1929,8 +1936,8 @@ std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForSe if( bVaryColorsByPoint ) { Sequence< OUString > aCategoryNames; - if( m_xExplicitCategoriesProvider.is() ) - aCategoryNames = m_xExplicitCategoriesProvider->getTextualData(); + if( m_pExplicitCategoriesProvider ) + aCategoryNames = m_pExplicitCategoriesProvider->getSimpleCategories(); for( sal_Int32 nIdx=0; nIdx<aCategoryNames.getLength(); ++nIdx ) { @@ -2074,9 +2081,9 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) pRet = new PieChart(xChartTypeModel,nDimensionCount); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); + pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,false,1,drawing::Direction3D(1,1,1) ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); + pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,false,1,drawing::Direction3D(1,1,1) ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) pRet = new CandleStickChart(xChartTypeModel,nDimensionCount); else |