本文整理汇总了C++中Stub::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ Stub::getData方法的具体用法?C++ Stub::getData怎么用?C++ Stub::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stub
的用法示例。
在下文中一共展示了Stub::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slot_get_graph
/*!
* Function: slot_get_graph
* Description: When "Get Graph" is clicked, this function is responsible for generating the graph based on the data passed,
* a full description of each part is given below
* @param bool check when it is check
*/
void MainWindow::slot_get_graph(bool)
{
Stub *stub = new Stub(); //! stub contains data for testing purpose.
//! This is the variable for bar width; the value will be calculated and scaled accordingly, depending on how
//! many checkboxes were selected
double barWidth = 0;
double i = 0; //! loop index; counts how many checkboxes where checked
int barsAdded = 0;
//! Creating the legend box
ui -> customPlot -> legend -> clearItems();
ui -> customPlot -> axisRect()->insetLayout()->setInsetAlignment(0,Qt::AlignTop|Qt::AlignRight);
ui -> customPlot -> legend -> setVisible(true);
ui->customPlot->clearPlottables(); //! clear the graph
//! Set graph interval
ui->customPlot->xAxis->setAutoTickStep(0);
ui->customPlot->xAxis->setTicks(1);
ui->customPlot->xAxis->setTickStep(1.0);
ui->customPlot->xAxis->setSubTickCount(0);
chartcolour *colourSelect = new chartcolour();
ui->customPlot->legend->clearItems(); //!Clears the existing data from the legend
ui->customPlot->axisRect()->setAutoMargins(QCP::msLeft | QCP::msTop | QCP::msBottom);
ui->customPlot->axisRect()->setMargins(QMargins(0,0,150,0));
ui->customPlot->axisRect()->insetLayout()->setInsetPlacement(0, QCPLayoutInset::ipFree);
ui->customPlot->axisRect()->insetLayout()->setInsetRect(0, QRectF(1.1,0,0.1,0.1));
//! Scaling the bar width based on the number of cities checked
if (ui->barrie->isChecked()) {
++i;
}
if (ui->calgary->isChecked()) {
++i;
}
if (ui->hamilton->isChecked()) {
++i;
}
if (ui->london->isChecked()) {
++i;
}
if (ui->ottawa->isChecked()) {
++i;
}
if (ui->sudbury->isChecked()) {
++i;
}
if (ui->thunderBay->isChecked()) {
++i;
}
if (ui->toronto->isChecked()) {
++i;
}
if (ui->windsor->isChecked()) {
++i;
}
if (ui->winnipeg->isChecked()) {
++i;
}
//! Calculating the new bar width
double totalWidth = 0.8;
barWidth = totalWidth / i;
double setBack = totalWidth/2;
double offset = 0;
//! Plot data and create a bar graph for Barrie if this city is selected
if(ui->barrie->isChecked()) { //! if barrie is checked
QCPBars *myBars = new QCPBars(ui->customPlot->xAxis, ui->customPlot->yAxis);
myBars->setWidth(barWidth);
myBars->setBrush(QBrush(QColor(colourSelect->getColour(barsAdded))));
myBars->setName("Barrie");
ui->customPlot->addPlottable(myBars);
//! Barrie data
QVector<double> barrieDatatemp = stub->getData("Barrie");
QVector<double> barrieData;
QVector<double> valueYears;
offset = (barWidth*barsAdded)+(barWidth/2);
/*!
Checks which years are checked. Plots the years selected, and scales the graph accordingly.
*/
//.........这里部分代码省略.........
开发者ID:vvo3,项目名称:Data-Visualization-Software-for-Ontario-Municipal-Benchmarking-Initiative,代码行数:101,代码来源:mainwindow.cpp