@@ -224,7 +224,6 void QBarSeries::setLabelsVisible(bool visible) | |||
|
224 | 224 | QBarSeriesPrivate::QBarSeriesPrivate(QBarCategories categories, QBarSeries *q) : |
|
225 | 225 | QAbstractSeriesPrivate(q), |
|
226 | 226 | m_categories(categories), |
|
227 | m_model(0), | |
|
228 | 227 | m_mapCategories(-1), |
|
229 | 228 | m_mapBarBottom(-1), |
|
230 | 229 | m_mapBarTop(-1), |
@@ -394,7 +393,7 void QBarSeriesPrivate::setModelMapping(int categories, int bottomBoundry, int t | |||
|
394 | 393 | } |
|
395 | 394 | |
|
396 | 395 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { |
|
397 | QBarSet* barSet = new QBarSet(QString("Column: %1").arg(i + 1)); | |
|
396 | QBarSet* barSet = new QBarSet(m_model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString()); | |
|
398 | 397 | for(int m = 0; m < m_model->rowCount(); m++) |
|
399 | 398 | *barSet << m_model->data(m_model->index(m, i), Qt::DisplayRole).toDouble(); |
|
400 | 399 | q->appendBarSet(barSet); |
@@ -405,7 +404,7 void QBarSeriesPrivate::setModelMapping(int categories, int bottomBoundry, int t | |||
|
405 | 404 | } |
|
406 | 405 | |
|
407 | 406 | for (int i = m_mapBarBottom; i <= m_mapBarTop; i++) { |
|
408 | QBarSet* barSet = new QBarSet(QString("Row: %1").arg(i + 1)); | |
|
407 | QBarSet* barSet = new QBarSet(m_model->headerData(i, Qt::Vertical, Qt::DisplayRole).toString()); | |
|
409 | 408 | for(int m = 0; m < m_model->columnCount(); m++) |
|
410 | 409 | *barSet << m_model->data(m_model->index(i, m), Qt::DisplayRole).toDouble(); |
|
411 | 410 | q->appendBarSet(barSet); |
@@ -48,7 +48,6 protected: | |||
|
48 | 48 | QList<QBarSet *> m_barSets; |
|
49 | 49 | QBarCategories m_categories; |
|
50 | 50 | |
|
51 | QAbstractItemModel* m_model; | |
|
52 | 51 | int m_mapCategories; |
|
53 | 52 | int m_mapBarBottom; |
|
54 | 53 | int m_mapBarTop; |
@@ -51,6 +51,7 TableWidget::TableWidget(QWidget *parent) | |||
|
51 | 51 | // tableView->setMinimumSize(340, 480); |
|
52 | 52 | // tableView->setItemDelegate(new QStyledItemDelegate); |
|
53 | 53 | m_chart = new QChart; |
|
54 | m_chart->legend()->setVisible(true); | |
|
54 | 55 | m_chartView = new QChartView(m_chart); |
|
55 | 56 | m_chartView->setRenderHint(QPainter::Antialiasing); |
|
56 | 57 | m_chartView->setMinimumSize(640, 480); |
@@ -140,6 +141,8 void TableWidget::updateChartType(bool toggle) | |||
|
140 | 141 | // For the radioButton that was enabled. |
|
141 | 142 | if (toggle) { |
|
142 | 143 | m_chart->removeAllSeries(); |
|
144 | m_chart->axisX()->setNiceNumbersEnabled(false); | |
|
145 | m_chart->axisY()->setNiceNumbersEnabled(false); | |
|
143 | 146 | |
|
144 | 147 | // renable axes of the chart (pie hides them) |
|
145 | 148 | // x axis |
@@ -321,8 +324,10 void TableWidget::updateChartType(bool toggle) | |||
|
321 | 324 | } |
|
322 | 325 | |
|
323 | 326 | |
|
327 | if (!m_barRadioButton->isChecked()) | |
|
324 | 328 | m_chart->axisX()->setRange(0, 500); |
|
325 | 329 | m_chart->axisY()->setRange(0, 120); |
|
330 | m_chart->legend()->setVisible(true); | |
|
326 | 331 | |
|
327 | 332 | // repaint table view colors |
|
328 | 333 | m_tableView->repaint(); |
General Comments 0
You need to be logged in to leave comments.
Login now