diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2010-12-07 17:18:10 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2010-12-07 17:18:10 +0100 |
commit | 23a41b480633914a7a0db19f5b23e61dd28dfca0 (patch) | |
tree | 850e8dbad62b82a8d2c1f06466eec94ccc2ef35b /chart2 | |
parent | 137698744547aea35fd5649e541adb9157ab0b5b (diff) |
chart46: #i25706# implement date axis - corrected z-axis layout
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/axes/ScaleAutomatism.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/axes/VCoordinateSystem.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/axes/VPolarAngleAxis.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/axes/VPolarGrid.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 7 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarPositionHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 49 | ||||
-rw-r--r-- | chart2/source/view/inc/PlottingPositionHelper.hxx | 35 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/PlottingPositionHelper.cxx | 19 |
13 files changed, 61 insertions, 89 deletions
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx index 6942871df704..075ad16347c2 100644 --- a/chart2/source/view/axes/ScaleAutomatism.cxx +++ b/chart2/source/view/axes/ScaleAutomatism.cxx @@ -260,6 +260,9 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory( // no scaling for categories rExplicitScale.Scaling.clear(); + if( rExplicitScale.ShiftedCategoryPosition ) + rExplicitScale.Maximum += 1.0; + // ensure that at least one category is visible if( rExplicitScale.Maximum <= rExplicitScale.Minimum ) rExplicitScale.Maximum = rExplicitScale.Minimum + 1.0; @@ -275,9 +278,6 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory( if( bAutoMaximum && m_bExpandBorderToIncrementRhythm ) rExplicitScale.Maximum = EquidistantTickFactory::getMaximumAtIncrement( rExplicitScale.Maximum, rExplicitIncrement ); - if( rExplicitScale.ShiftedCategoryPosition ) - rExplicitScale.Maximum += 1.0; - //prevent performace killover double fDistanceCount = ::rtl::math::approxFloor( (rExplicitScale.Maximum-rExplicitScale.Minimum) / rExplicitIncrement.Distance ); if( static_cast< sal_Int32 >( fDistanceCount ) > MAXIMUM_MANUAL_INCREMENT_COUNT ) diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index f184fbe0a1e3..a99ab4368d60 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -98,8 +98,8 @@ VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCoo { if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 ) { - m_aExplicitScales[2].Minimum = -0.5; - m_aExplicitScales[2].Maximum = 0.5; + m_aExplicitScales[2].Minimum = 1.0; + m_aExplicitScales[2].Maximum = 2.0; m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL; } } diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx index dcb7cd5a6303..0a10ee25e1c4 100644 --- a/chart2/source/view/axes/VPolarAngleAxis.cxx +++ b/chart2/source/view/axes/VPolarAngleAxis.cxx @@ -178,7 +178,7 @@ void VPolarAngleAxis::createLabels() return; double fLogicRadius = m_pPosHelper->getOuterLogicRadius(); - double fLogicZ = -0.5;//as defined + double fLogicZ = 1.0;//as defined if( m_aAxisProperties.m_bDisplayLabels ) { @@ -213,7 +213,7 @@ void VPolarAngleAxis::createShapes() return; double fLogicRadius = m_pPosHelper->getOuterLogicRadius(); - double fLogicZ = -0.5;//as defined + double fLogicZ = 1.0;//as defined //----------------------------------------- //create axis main lines diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx index 953b729bd453..c3554fd4876b 100644 --- a/chart2/source/view/axes/VPolarGrid.cxx +++ b/chart2/source/view/axes/VPolarGrid.cxx @@ -131,7 +131,7 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT double fLogicInnerRadius = m_pPosHelper->getInnerLogicRadius(); double fLogicOuterRadius = m_pPosHelper->getOuterLogicRadius(); - double fLogicZ = -0.5;//as defined + double fLogicZ = 1.0;//as defined sal_Int32 nLinePropertiesCount = rLinePropertiesList.size(); ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAngleTickInfos.begin(); @@ -223,7 +223,7 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic //xxxxx rTickInfo.updateUnscaledValue( xInverseRadiusScaling ); double fLogicRadius = rTickInfo.getUnscaledTickValue(); - double fLogicZ = -0.5;//as defined + double fLogicZ = 1.0;//as defined drawing::PointSequenceSequence aPoints(1); VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAngleTickInfos diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 59cde85a13fe..06e09d60fcf1 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -98,7 +98,10 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel if( !m_pMainPosHelper ) m_pMainPosHelper = new PlottingPositionHelper(); if( m_pMainPosHelper ) - m_pMainPosHelper->DoShiftCategoryXIfShiftIsIndicated(true); + { + m_pMainPosHelper->AllowShiftXAxisPos(true); + m_pMainPosHelper->AllowShiftZAxisPos(true); + } PlotterBase::m_pPosHelper = m_pMainPosHelper; VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper; @@ -613,7 +616,7 @@ void AreaChart::createShapes() //check necessary here that different Y axis can not be stacked in the same group? ... hm? //update/create information for current group - double fLogicZ = 0.5;//as defined + double fLogicZ = 1.0;//as defined sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale sal_Int32 nEndIndex = VSeriesPlotter::getPointCount(); diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 6d94cea682dc..9e4484727a2d 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -450,7 +450,7 @@ void BarChart::createShapes() m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() )); //check necessary here that different Y axis can not be stacked in the same group? ... hm? - double fLogicZ = 0.0;//as defined + double fLogicZ = 1.0;//as defined bool bDrawConnectionLines = false; bool bDrawConnectionLinesInited = false; @@ -614,7 +614,7 @@ void BarChart::createShapes() continue;//point not visible if(fUnscaledLogicX>pPosHelper->getLogicMaxX()) continue;//point not visible - if(pPosHelper->isStrongLowerXRequested() && fUnscaledLogicX==pPosHelper->getLogicMaxX()) + if(pPosHelper->isStrongLowerRequested(0) && fUnscaledLogicX==pPosHelper->getLogicMaxX()) continue;//point not visible double fLogicX = pPosHelper->getScaledSlotPos( fUnscaledLogicX, fSlotX ); @@ -643,7 +643,7 @@ void BarChart::createShapes() fNegativeLogicYForNextSeries += fLogicBarHeight; if(m_nDimension==3) - fLogicZ = nZ; + fLogicZ = nZ+0.5; drawing::Position3D aUnscaledLogicPosition( fUnscaledLogicX, fUpperYValue, fLogicZ ); diff --git a/chart2/source/view/charttypes/BarPositionHelper.cxx b/chart2/source/view/charttypes/BarPositionHelper.cxx index bd013b08207d..45dab527da11 100644 --- a/chart2/source/view/charttypes/BarPositionHelper.cxx +++ b/chart2/source/view/charttypes/BarPositionHelper.cxx @@ -45,7 +45,8 @@ using namespace ::com::sun::star::chart2; BarPositionHelper::BarPositionHelper( bool /* bSwapXAndY */ ) : CategoryPositionHelper( 1 ) { - DoShiftCategoryXIfShiftIsIndicated(true); + AllowShiftXAxisPos(true); + AllowShiftZAxisPos(true); } BarPositionHelper::BarPositionHelper( const BarPositionHelper& rSource ) @@ -76,7 +77,6 @@ double BarPositionHelper::getScaledSlotPos( double fUnscaledLogicX, double fSeri double fScaledLogicX(fUnscaledLogicX); doLogicScaling(&fScaledLogicX,NULL,NULL); fScaledLogicX = CategoryPositionHelper::getScaledSlotPos( fScaledLogicX, fSeriesNumber ); - //MaybeShiftCategoryX( fScaledLogicX ); return fScaledLogicX; } diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index c5454edcc6fd..0cbcff33bfcd 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -121,7 +121,7 @@ void BubbleChart::calculateMaximumLogicBubbleSize() void BubbleChart::calculateBubbleSizeScalingFactor() { - double fLogicZ=0.5; + double fLogicZ=1.0; drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) ); drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) ); @@ -223,7 +223,7 @@ void BubbleChart::createShapes() m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() )); //update/create information for current group - double fLogicZ = 0.5;//as defined + double fLogicZ = 1.0;//as defined sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale sal_Int32 nEndIndex = VSeriesPlotter::getPointCount(); diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 1c26f0596c78..abb30c2a67a9 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -409,7 +409,7 @@ void PieChart::createShapes() if( !bIsVisible ) continue; - double fLogicZ = -0.5;//as defined + double fLogicZ = -1.0;//as defined double fDepth = this->getTransformedDepth(); //============================================================================= @@ -493,11 +493,11 @@ void PieChart::createShapes() awt::Point aScreenPosition2D( aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, nLabelPlacement , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree - , fUnitCircleInnerRadius, fUnitCircleOuterRadius, 0.0, 0 )); + , fUnitCircleInnerRadius, fUnitCircleOuterRadius, fLogicZ+0.5, 0 )); PieLabelInfo aPieLabelInfo; aPieLabelInfo.aFirstPosition = basegfx::B2IVector( aScreenPosition2D.X, aScreenPosition2D.Y ); - awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, 0.5 ) ) ); + awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, fLogicZ+1.0 ) ) ); aPieLabelInfo.aOrigin = basegfx::B2IVector( aOrigin.X, aOrigin.Y ); //add a scaling independent Offset if requested diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 6ec5e1613c45..f03138d869b7 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1186,53 +1186,12 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() } double VSeriesPlotter::getMinimumX() { - /* - if( m_bCategoryXAxis ) - { - double fRet = 1.0;//first text category (index 0) matches with real number 1.0 - if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() ) - fRet -= 0.5; - else if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) - { - const std::vector< DatePlusIndex >& rDateCategories( m_pExplicitCategoriesProvider->getDateCategories() ); - DBG_ASSERT(!rDateCategories.empty(),"need date values"); - if(!rDateCategories.empty()) - { - DatePlusIndex aFirst = rDateCategories.front(); - fRet = aFirst.fValue; - } - } - return fRet; - } - */ - double fMinimum, fMaximum; this->getMinimumAndMaximiumX( fMinimum, fMaximum ); return fMinimum; } double VSeriesPlotter::getMaximumX() { - /* - if( m_bCategoryXAxis ) - { - //return category count for pure text axis - double fRet = getPointCount();//first category (index 0) matches with real number 1.0 - if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() ) - fRet += 0.5; - else if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) - { - const std::vector< DatePlusIndex >& rDateCategories( m_pExplicitCategoriesProvider->getDateCategories() ); - DBG_ASSERT(!rDateCategories.empty(),"need date values"); - if(!rDateCategories.empty()) - { - DatePlusIndex aLast = rDateCategories.back(); - fRet = aLast.fValue; - } - } - return fRet; - } - */ - double fMinimum, fMaximum; this->getMinimumAndMaximiumX( fMinimum, fMaximum ); return fMaximum; @@ -1309,13 +1268,13 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s double VSeriesPlotter::getMinimumZ() { //this is the default for all charts without a meaningfull z axis - return 0.5; + return 1.0; } double VSeriesPlotter::getMaximumZ() { - if( 3!=m_nDimension ) - return 0.5; - return m_aZSlots.size()+0.5; + if( 3!=m_nDimension || !m_aZSlots.size() ) + return getMinimumZ()+1; + return m_aZSlots.size(); } namespace diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx index 6bd25d8f92e3..42c7a90a0116 100644 --- a/chart2/source/view/inc/PlottingPositionHelper.hxx +++ b/chart2/source/view/inc/PlottingPositionHelper.hxx @@ -75,7 +75,7 @@ public: inline bool isSameForGivenResolution( double fX, double fY, double fZ , double fX2, double fY2, double fZ2 ); - inline bool isStrongLowerXRequested() const; + inline bool isStrongLowerRequested( sal_Int32 nDimensionIndex ) const; inline bool isLogicVisible( double fX, double fY, double fZ ) const; inline void doLogicScaling( double* pX, double* pY, double* pZ, bool bClip=false ) const; inline void doUnshiftedLogicScaling( double* pX, double* pY, double* pZ, bool bClip=false ) const; @@ -125,8 +125,8 @@ public: void setTimeResolution( long nTimeResolution, const Date& rNullDate ); virtual void setScaledCategoryWidth( double fScaledCategoryWidth ); - void MaybeShiftCategoryX( double& fScaledXValue ) const; - void DoShiftCategoryXIfShiftIsIndicated( bool bAllowShift ); + void AllowShiftXAxisPos( bool bAllowShift ); + void AllowShiftZAxisPos( bool bAllowShift ); protected: //member ::std::vector< ExplicitScaleData > m_aScales; @@ -149,7 +149,8 @@ protected: //member Date m_aNullDate; double m_fScaledCategoryWidth; - bool m_DoShiftCategoryXIfShiftIsIndicated; + bool m_bAllowShiftXAxisPos; + bool m_bAllowShiftZAxisPos; }; //describes wich axis of the drawinglayer scene or sreen axis are the normal axis @@ -292,19 +293,23 @@ bool PlottingPositionHelper::isSameForGivenResolution( double fX, double fY, dou return (bSameX && bSameY && bSameZ); } -bool PlottingPositionHelper::isStrongLowerXRequested() const +bool PlottingPositionHelper::isStrongLowerRequested( sal_Int32 nDimensionIndex ) const { - if( !m_aScales.empty() ) - return m_DoShiftCategoryXIfShiftIsIndicated && m_aScales[0].ShiftedCategoryPosition; + if( m_aScales.empty() ) + return false; + if( 0==nDimensionIndex ) + return m_bAllowShiftXAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition; + else if( 2==nDimensionIndex ) + return m_bAllowShiftZAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition; return false; } bool PlottingPositionHelper::isLogicVisible( double fX, double fY, double fZ ) const { - return fX >= m_aScales[0].Minimum && ( isStrongLowerXRequested() ? fX < m_aScales[0].Maximum : fX <= m_aScales[0].Maximum ) + return fX >= m_aScales[0].Minimum && ( isStrongLowerRequested(0) ? fX < m_aScales[0].Maximum : fX <= m_aScales[0].Maximum ) && fY >= m_aScales[1].Minimum && fY <= m_aScales[1].Maximum - && fZ >= m_aScales[2].Minimum && fZ <= m_aScales[2].Maximum; + && fZ >= m_aScales[2].Minimum && ( isStrongLowerRequested(2) ? fZ < m_aScales[2].Maximum : fZ <= m_aScales[2].Maximum ); } void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ, bool bClip ) const @@ -316,12 +321,18 @@ void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ, { if( m_aScales[0].Scaling.is()) *pX = m_aScales[0].Scaling->doScaling(*pX); - MaybeShiftCategoryX(*pX); + if( m_bAllowShiftXAxisPos && m_aScales[0].ShiftedCategoryPosition ) + (*pX) += m_fScaledCategoryWidth/2.0; } if(pY && m_aScales[1].Scaling.is()) *pY = m_aScales[1].Scaling->doScaling(*pY); - if(pZ && m_aScales[2].Scaling.is()) - *pZ = m_aScales[2].Scaling->doScaling(*pZ); + if(pZ) + { + if( m_aScales[2].Scaling.is()) + *pZ = m_aScales[2].Scaling->doScaling(*pZ); + if( m_bAllowShiftZAxisPos && m_aScales[2].ShiftedCategoryPosition) + (*pZ) += 0.5; + } } void PlottingPositionHelper::doUnshiftedLogicScaling( double* pX, double* pY, double* pZ, bool bClip ) const diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 3098005d6bfa..cff3ab3d1c14 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1697,6 +1697,8 @@ sal_Bool ChartView::getExplicitValuesForAxis( } else if( rExplicitScale.AxisType == ::com::sun::star::chart2::AxisType::CATEGORY ) rExplicitScale.Maximum -= 1.0; + else if( rExplicitScale.AxisType == ::com::sun::star::chart2::AxisType::SERIES ) + rExplicitScale.Maximum -= 1.0; } return sal_True; } diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index db195266a0e5..3f77115d9cf4 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -63,7 +63,8 @@ PlottingPositionHelper::PlottingPositionHelper() , m_nTimeResolution( ::com::sun::star::chart::TimeUnit::DAY ) , m_aNullDate(30,12,1899) , m_fScaledCategoryWidth(1.0) - , m_DoShiftCategoryXIfShiftIsIndicated(false) + , m_bAllowShiftXAxisPos(false) + , m_bAllowShiftZAxisPos(false) { } PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper& rSource ) @@ -79,7 +80,8 @@ PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper& rS , m_nTimeResolution( rSource.m_nTimeResolution ) , m_aNullDate( rSource.m_aNullDate ) , m_fScaledCategoryWidth( rSource.m_fScaledCategoryWidth ) - , m_DoShiftCategoryXIfShiftIsIndicated( rSource.m_DoShiftCategoryXIfShiftIsIndicated ) + , m_bAllowShiftXAxisPos( rSource.m_bAllowShiftXAxisPos ) + , m_bAllowShiftZAxisPos( rSource.m_bAllowShiftZAxisPos ) { } @@ -679,18 +681,13 @@ void PlottingPositionHelper::setScaledCategoryWidth( double fScaledCategoryWidth { m_fScaledCategoryWidth = fScaledCategoryWidth; } -void PlottingPositionHelper::MaybeShiftCategoryX( double& fScaledXValue ) const +void PlottingPositionHelper::AllowShiftXAxisPos( bool bAllowShift ) { - if( m_DoShiftCategoryXIfShiftIsIndicated && !m_aScales.empty() ) - { - if(m_aScales[0].ShiftedCategoryPosition) - fScaledXValue += m_fScaledCategoryWidth/2.0; - } + m_bAllowShiftXAxisPos = bAllowShift; } - -void PlottingPositionHelper::DoShiftCategoryXIfShiftIsIndicated( bool bAllowShift ) +void PlottingPositionHelper::AllowShiftZAxisPos( bool bAllowShift ) { - m_DoShiftCategoryXIfShiftIsIndicated = bAllowShift; + m_bAllowShiftZAxisPos = bAllowShift; } /* |