From 646d6bcb9a3558b84530bbd714ca700ddbaf0f28 2012-02-09 15:55:28 From: sauimone Date: 2012-02-09 15:55:28 Subject: [PATCH] removed old code from barcharts --- diff --git a/src/barchart/barchartseriesbase.cpp b/src/barchart/barchartseriesbase.cpp index 48012fe..f944cb7 100644 --- a/src/barchart/barchartseriesbase.cpp +++ b/src/barchart/barchartseriesbase.cpp @@ -10,115 +10,10 @@ BarChartSeriesBase::BarChartSeriesBase(QObject *parent) : QChartSeries(parent) ,mModel(*(new BarChartModel(this))) // TODO: is this ok? { - qDebug() << "BarChartSeriesBase::BarChartSeriesBase"; } -/* -bool BarChartSeriesBase::setModel(QAbstractItemModel* model) -{ - mModel = model; - return true; -} -*/ -/* -bool BarChartSeriesBase::setData(QList& data) -{ - mData = &data; - return true; -} -*/ -/* -int BarChartSeriesBase::min() -{ - Q_ASSERT(mModel->rowCount() > 0); - Q_ASSERT(mModel->columnCount() > 0); - - // TODO: make min and max members and update them when data changes. - // This is slower since they are checked every time, even if data is same since previous call. - int min = INT_MAX; - - for (int i=0; i rowCount(); i++) { - for(int j=0; jcolumnCount(); j++) { - int temp = mModel->data(mModel->index(i,j)).toInt(); - if (temp < min) { - min = temp; - } - } - } - return min; -} - -int BarChartSeriesBase::max() -{ - Q_ASSERT(mModel->rowCount() > 0); - Q_ASSERT(mModel->columnCount() > 0); - - // TODO: make min and max members and update them when data changes. - // This is slower since they are checked every time, even if data is same since previous call. - int max = INT_MIN; - - for (int i=0; i rowCount(); i++) { - for(int j=0; jcolumnCount(); j++) { - int temp = mModel->data(mModel->index(i,j)).toInt(); - if (temp > max) { - max = temp; - } - } - } - return max; -} - -int BarChartSeriesBase::maxColumnSum() -{ - Q_ASSERT(mModel->rowCount() > 0); - Q_ASSERT(mModel->columnCount() > 0); - - int max = INT_MIN; - - for (int col=0; col columnCount(); col++) { - int sum = columnSum(col); - if (sum > max) { - max = sum; - } - } - return max; -} - -int BarChartSeriesBase::countRows() -{ - return mModel->rowCount(); -} - -int BarChartSeriesBase::countColumns() -{ - return mModel->columnCount(); -} - -int BarChartSeriesBase::countTotalItems() -{ - return mModel->rowCount() * mModel->columnCount(); -} - -int BarChartSeriesBase::valueAt(int row, int column) -{ - QModelIndex index = mModel->index(row,column); - return mModel->data(index).toInt(); -} - -int BarChartSeriesBase::columnSum(int column) -{ - int sum(0); - int count = mModel->rowCount(); - - for (int row = 0; row < count; row++) { - sum += mModel->data(mModel->index(row,column)).toInt(); - } - return sum; -} -*/ int BarChartSeriesBase::addData(QList data) { - qDebug() << "BarChartSeriesBase::addData"; return mModel.addData(data); } @@ -130,45 +25,21 @@ void BarChartSeriesBase::removeData(int id) qreal BarChartSeriesBase::min() { return mModel.min(); - /* Delegated to model - int count = mData->count(); - int min = INT_MAX; - - for (int i=0; iat(i) < min) { - min = mData->at(i); - } - } - return min; - */ } qreal BarChartSeriesBase::max() { return mModel.max(); - /* Delegated to model - int count = mData->count(); - int max = INT_MIN; - - for (int i=0; iat(i) > max) { - max = mData->at(i); - } - } - return max; - */ } int BarChartSeriesBase::countColumns() { return mModel.countColumns(); -// return mData->count(); } qreal BarChartSeriesBase::valueAt(int series, int item) { return mModel.valueAt(series,item); -// return mData->at(item); } qreal BarChartSeriesBase::maxColumnSum() diff --git a/src/barchart/barlabel.cpp b/src/barchart/barlabel.cpp index aa63668..3437334 100644 --- a/src/barchart/barlabel.cpp +++ b/src/barchart/barlabel.cpp @@ -6,7 +6,6 @@ BarLabel::BarLabel(QGraphicsItem* parent) : ChartItem(parent) { } - void BarLabel::set(QString label) { mLabel = label; diff --git a/src/barchart/stackedbargroup.cpp b/src/barchart/stackedbargroup.cpp index 82db63e..299e3af 100644 --- a/src/barchart/stackedbargroup.cpp +++ b/src/barchart/stackedbargroup.cpp @@ -3,7 +3,6 @@ #include "barlabel_p.h" #include "separator_p.h" #include -//#include QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -48,7 +47,7 @@ void StackedBarGroup::layoutChanged() Bar* bar = reinterpret_cast (childItems().at(itemIndex)); // TODO: width settable per bar? - // TODO: how to get color for series(x) from theme? + // TODO: theme stuff // mTheme->themeForSeries(); bar->resize(mBarDefaultWidth, barHeight); bar->setColor(mColors.at(row));