diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 22:38:03 +0000 |
commit | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch) | |
tree | 99e72842fe687baea16376a147619b6048d7e441 /libkdchart/KDChartParamsWrapper.cpp | |
download | kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip |
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdchart/KDChartParamsWrapper.cpp')
-rw-r--r-- | libkdchart/KDChartParamsWrapper.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libkdchart/KDChartParamsWrapper.cpp b/libkdchart/KDChartParamsWrapper.cpp new file mode 100644 index 0000000..49e5166 --- /dev/null +++ b/libkdchart/KDChartParamsWrapper.cpp @@ -0,0 +1,73 @@ +#include "KDChartParamsWrapper.h" +#include <KDChartParams.h> + +KDChartParamsWrapper::KDChartParamsWrapper( KDChartParams* data ) :QObject(0), _data(data) +{ +} + +const KDChartAxisParams* KDChartParamsWrapper::axisParams( uint n ) const +{ + const KDChartAxisParams& a = _data->axisParams( n ); + return &a; +} + +void KDChartParamsWrapper::setExplodeValues( QVariant explodeList ) +{ + if ( !explodeList.type() == QVariant::List ) + return; + QValueList<QVariant> list = explodeList.toList(); + + QValueList<int> res; + for( QValueList<QVariant>::Iterator it = list.begin(); it != list.end(); ++it ) { + int x = (*it).toInt(); + res.append(x); + } + _data->setExplodeValues( res ); +} + +void KDChartParamsWrapper::setExplodeFactors( QVariant factors ) +{ + if ( !factors.type() == QVariant::List ) + return; + + QValueList<QVariant> list = factors.toList(); + + KDChartParams::ExplodeFactorsMap res; + int i = 0; + for( QValueList<QVariant>::Iterator it = list.begin(); it != list.end(); ++it, ++i ) { + res[i] = (*it).toDouble(); + } + _data->setExplodeFactors( res ); +} + +void KDChartParamsWrapper::setAxisLabelStringParams( uint n, QVariant axisLabelStringList, QVariant axisShortLabelStringList, + const QString& valueStart, const QString& valueEnd ) +{ + QStringList l1 = axisLabelStringList.toStringList(); + QStringList l2 = axisShortLabelStringList.toStringList(); + _data->setAxisLabelStringParams( n, &l1, &l2, valueStart, valueEnd ); +} + +void KDChartParamsWrapper::setAxisLabelTextParams( uint n, + bool axisSteadyValueCalc, + QVariant axisValueStart, + QVariant axisValueEnd, + double axisValueDelta, + int axisDigitsBehindComma, + int axisMaxEmptyInnerSpan, + int takeLabelsFromDataRow, + int labelTextsDataRow, + const QVariant& axisLabelStringList, + const QVariant& axisShortLabelsStringList, + int axisValueLeaveOut, + int axisValueDeltaScale ) { + + QStringList l1 = axisLabelStringList.toStringList(); + QStringList l2 = axisShortLabelsStringList.toStringList(); + + _data->setAxisLabelTextParams( n, axisSteadyValueCalc, axisValueStart, axisValueEnd, axisValueDelta, axisDigitsBehindComma, axisMaxEmptyInnerSpan, + (KDChartAxisParams::LabelsFromDataRow) takeLabelsFromDataRow, labelTextsDataRow, &l1, &l2, + axisValueLeaveOut, (KDChartAxisParams::ValueScale) axisValueDeltaScale ); +} + +#include "KDChartParamsWrapper.moc" |