diff options
author | Ingrid Halama <iha@openoffice.org> | 2004-01-05 13:46:41 +0000 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2004-01-05 13:46:41 +0000 |
commit | d0d3bb651995acba84a30ef9756a3d38f3ac2e35 (patch) | |
tree | b23792a62fea6c59a9da4bd98c40bff453cd068c /chart2 | |
parent | 8fba250e94c570ffd10c7172aab5621316397459 (diff) |
changed matching: first category index matches to real number 1.0 (not 0.0 anymore)
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 9 |
4 files changed, 18 insertions, 13 deletions
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index d0ed6b4c6ec3..04dfd0b66a98 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -58,13 +58,15 @@ public: void updateSeriesCount( double fSeriesCount ); /*only enter the size of x stacked series*/ double getStartCategoryIndex() const { - sal_Int32 nStart = static_cast<sal_Int32>(getLogicMinX() + 1.49);//@todo +0.5 if clipping of half categories is implemented + //first category (index 0) matches with real number 1.0 + sal_Int32 nStart = static_cast<sal_Int32>(getLogicMinX() - 0.5); if( nStart < 0 ) nStart = 0; return nStart; } double getEndCategoryIndex() const { - sal_Int32 nEnd = static_cast<sal_Int32>(getLogicMaxX() + 0.5); + //first category (index 0) matches with real number 1.0 + sal_Int32 nEnd = static_cast<sal_Int32>(getLogicMaxX() - 0.5); if( nEnd < 0 ) nEnd = 0; return nEnd; @@ -345,7 +347,7 @@ void BarChart::createShapes() getSeriesGroupShape(*aSeriesIter, xSeriesTarget) ); //collect data point information (logic coordinates, style ): - double fLogicX = m_pPosHelper->getSlotPos( (double)nCatIndex, fSlotX ); + double fLogicX = m_pPosHelper->getSlotPos( (*aSeriesIter)->getX( nCatIndex ), fSlotX ); double fLogicBarHeight = (*aSeriesIter)->getY( nCatIndex ); if( ::rtl::math::isNan( fLogicBarHeight )) //no value at this category continue; diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index ad3877fd172c..14f1d2bb2145 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -59,13 +59,15 @@ public: DataPointGeometry transformLogicGeom( const DataPointGeometry& rGeom, sal_Int32 nDim ); double getStartCategoryIndex() const { - sal_Int32 nStart = getLogicMinX() + 0.5; + //first category (index 0) matches with real number 1.0 + sal_Int32 nStart = static_cast<sal_Int32>(getLogicMinX() - 0.5); if( nStart < 0 ) nStart = 0; return nStart; } double getEndCategoryIndex() const { - sal_Int32 nEnd = getLogicMaxX() + 0.5; + //first category (index 0) matches with real number 1.0 + sal_Int32 nEnd = static_cast<sal_Int32>(getLogicMaxX() - 0.5); if( nEnd < 0 ) nEnd = 0; return nEnd; @@ -319,10 +321,10 @@ void PieChart::createShapes() aSeriesIter = pSeriesList->begin(); bool bIsVisible; - double fInnerXRadius = m_pPosHelper->getInnerRadius( (double)nCatIndex, bIsVisible ); + double fInnerXRadius = m_pPosHelper->getInnerRadius( (double)nCatIndex+1.0, bIsVisible ); if( !bIsVisible ) continue; - double fOuterXRadius = m_pPosHelper->getOuterRadius( (double)nCatIndex ); + double fOuterXRadius = m_pPosHelper->getOuterRadius( (double)nCatIndex+1.0 ); double fOuterYRadius = fOuterXRadius; //the radii are already clipped and had scaling now diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 3d2a159b22fe..1ffac050f0c9 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -757,7 +757,7 @@ void VSeriesPlotter::setMappedProperties( double VSeriesPlotter::getMinimumX() { if( m_bCategoryXAxis ) - return -0.5; + return 0.5;//first category (index 0) matches with real number 1.0 double fMinimum, fMaximum; this->getMinimumAndMaximiumX( fMinimum, fMaximum ); @@ -769,7 +769,7 @@ double VSeriesPlotter::getMaximumX() { //return category count sal_Int32 nPointCount = getPointCount( m_aXSlots ); - return nPointCount-0.5; + return nPointCount+0.5;//first category (index 0) matches with real number 1.0 } double fMinimum, fMaximum; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 0effc6c55e9b..8ffcc20b0873 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -2,9 +2,9 @@ * * $RCSfile: VDataSeries.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: bm $ $Date: 2003-12-17 16:43:19 $ + * last change: $Author: iha $ $Date: 2004-01-05 14:46:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -259,7 +259,7 @@ double VDataSeries::getX( sal_Int32 index ) const else { if( 0<=index && index < m_YValues_Double.getLength() ) - return index; + return index+1;//first category (index 0) matches with real number 1.0 } double fNan; ::rtl::math::setNan( & fNan ); @@ -283,9 +283,10 @@ uno::Sequence< double > VDataSeries::getAllX() const if(!m_xData_XValues.is() && !m_XValues_Double.getLength() && m_YValues_Double.getLength()) { //init x values from category indexes + //first category (index 0) matches with real number 1.0 m_XValues_Double.realloc( m_YValues_Double.getLength() ); for(sal_Int32 nN=m_XValues_Double.getLength();nN--;) - m_XValues_Double[nN] = nN; + m_XValues_Double[nN] = nN+1; } return m_XValues_Double; } |