| 22 | using namespace KDChart; |
| 23 | |
| 24 | MainWindow::MainWindow(QWidget *parent) |
| 25 | : QWidget(parent) |
| 26 | { |
| 27 | auto *chartLayout = new QHBoxLayout(this); |
| 28 | m_chart = new Chart(); |
| 29 | chartLayout->addWidget(m_chart); |
| 30 | |
| 31 | m_model.loadFromCSV(":/data"); |
| 32 | |
| 33 | // Set up the diagram |
| 34 | m_bars = new BarDiagram(); |
| 35 | m_bars->setModel(&m_model); |
| 36 | m_bars->addAxis(new CartesianAxis(m_bars)); |
| 37 | |
| 38 | m_chart->coordinatePlane()->replaceDiagram(m_bars); |
| 39 | |
| 40 | auto *plane = dynamic_cast<CartesianCoordinatePlane *>(m_chart->coordinatePlane()); |
| 41 | Q_ASSERT(plane); |
| 42 | // The values in the model are all zero, so set the size of the plane |
| 43 | // to something that is non-zero manually |
| 44 | plane->setVerticalRange(QPair<qreal, qreal>(-2.0, 2.0)); |
| 45 | } |
nothing calls this directly
no test coverage detected