diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-12-30 06:22:04 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-29 08:09:28 +0100 |
commit | 91e1d305a14a17e7d728b3b5055c65a67582715d (patch) | |
tree | 92d34b68f66c7e6996c2b8b86cf36a8c34eea714 /chart2 | |
parent | f47d81a059ba69f00e51b3a1a11ec7d4c17c01ad (diff) |
implement time based charting based on new approach
The old approach does not work with the current implementation of the
OpenGL backend. We now need to repaing every time the whole chart.
Change-Id: I2151a3f016c6ceecaec2d45db0cb967cfee59af6
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/inc/ChartModel.hxx | 5 | ||||
-rw-r--r-- | chart2/inc/ChartView.hxx | 17 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/inc/VDataSeries.hxx | 11 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 3 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 23 |
6 files changed, 67 insertions, 2 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 4a7031bbc100..af0d6988f15d 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -120,6 +120,8 @@ private: sal_Int32 m_nInLoad; sal_Bool volatile m_bUpdateNotificationsPending; + bool mbTimeBased; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xChartView; // for the ref count ChartView* mpChartView; @@ -579,6 +581,9 @@ public: // normal methods ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > getNumberFormatsSupplier(); + + bool isTimeBased() const; + void setTimeBased(bool bTimeBased); }; } // namespace chart diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 80ef459e09fb..80f0d27c571b 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -51,6 +51,21 @@ namespace chart { class VCoordinateSystem; class DrawModelWrapper; class SeriesPlotterContainer; +class VDataSeriesGroup; + +struct TimeBasedInfo +{ + TimeBasedInfo(): + bTimeBased(false), + nFrame(0), + m_pZSlots(NULL) {} + + bool bTimeBased; + size_t nFrame; + + // only valid when we are in the time based mode + ::std::vector< ::std::vector< VDataSeriesGroup > >* m_pZSlots; +}; /** * The ChartView is responsible to manage the generation of Drawing Objects @@ -237,6 +252,8 @@ private: //member sal_Bool m_bSdrViewIsInEditMode; ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes; + + TimeBasedInfo maTimeBased; }; } diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index c29a10e7da6c..842501fee785 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1346,6 +1346,16 @@ OUString SAL_CALL ChartModel::dump() return OUString(); } +bool ChartModel::isTimeBased() const +{ + return mbTimeBased; +} + +void ChartModel::setTimeBased(bool bTimeBased) +{ + mbTimeBased = bTimeBased; +} + } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index be0fab624f63..bbd903c860f1 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -62,6 +62,11 @@ class VDataSeries : boost::noncopyable public: VDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xDataSeries ); + // for time based charting + VDataSeries( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xDataSeries, + VDataSeries* pOldSeries, double nPercent); + virtual ~VDataSeries(); ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > @@ -140,7 +145,7 @@ public: void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole ); - //this is only temporarily here for area chart: + //this is only tempohttps://www.google.de/search?q=minka+kelly&safe=off&tbm=isch&tbo=u&source=univ&sa=X&ei=x36_Uv6ZF9Kf7ga-rYGIAg&ved=0CK4BEIke&biw=1920&bih=1043#q=minka+kelly&safe=off&tbm=isch&tbs=isz:lrarily here for area chart: ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D; sal_Int32 m_nPolygonIndex; double m_fLogicMinX; @@ -250,6 +255,10 @@ private: //member sal_Int32 m_nMissingValueTreatment; bool m_bAllowPercentValueInDataLabel; + + // for time based charting + VDataSeries* mpOldSeries; + double mnPercent; }; } //namespace chart diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index a4b0fb68e0ab..97cc4f8f68e0 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -384,6 +384,9 @@ protected: VDataSeries* getFirstSeries() const; + // ugly hack to cache the data for the next turn + const std::vector< std::vector< VDataSeriesGroup > >& getData(); + protected: PlottingPositionHelper* m_pMainPosHelper; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 72cefdebfbac..2f170ebae9ce 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -465,7 +465,14 @@ double VDataSeries::getXValue( sal_Int32 index ) const if(m_aValues_X.is()) { if( 0<=index && index<m_aValues_X.getLength() ) + { fRet = m_aValues_X.Doubles[index]; + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_X.Doubles[index]; + fRet = nOldVal + (fRet - nOldVal) * mnPercent; + } + } else ::rtl::math::setNan( &fRet ); } @@ -487,7 +494,14 @@ double VDataSeries::getYValue( sal_Int32 index ) const if(m_aValues_Y.is()) { if( 0<=index && index<m_aValues_Y.getLength() ) + { fRet = m_aValues_Y.Doubles[index]; + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_Y.Doubles[index]; + fRet = nOldVal + (fRet - nOldVal) * mnPercent; + } + } else ::rtl::math::setNan( &fRet ); } @@ -548,7 +562,14 @@ double VDataSeries::getY_Last( sal_Int32 index ) const } double VDataSeries::getBubble_Size( sal_Int32 index ) const { - return m_aValues_Bubble_Size.getValue( index ); + double nNewVal = m_aValues_Bubble_Size.getValue( index ); + if(mpOldSeries) + { + double nOldVal = mpOldSeries->m_aValues_Bubble_Size.getValue( index ); + nNewVal = nOldVal + (nNewVal - nOldVal) * mnPercent; + } + + return nNewVal; } bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const |