MCPcopy Create free account
hub / github.com/KDAB/KDChart / MainWindow

Method MainWindow

examples/EmptyValues/mainwindow.cpp:24–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22using namespace KDChart;
23
24MainWindow::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}

Callers

nothing calls this directly

Calls 6

loadFromCSVMethod · 0.80
setVerticalRangeMethod · 0.80
setModelMethod · 0.45
addAxisMethod · 0.45
replaceDiagramMethod · 0.45
coordinatePlaneMethod · 0.45

Tested by

no test coverage detected