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
This commit is contained in:
Markus Mohrhard 2013-12-30 06:22:04 +01:00
parent f47d81a059
commit 91e1d305a1
6 changed files with 67 additions and 2 deletions

View file

@ -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

View file

@ -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;
};
}

View file

@ -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: */

View file

@ -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

View file

@ -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;

View file

@ -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