예제 #1
0
/**
 * @brief WidgetLineChart::drawYear draw a given year on the line chart
 * @param sel the index of the selected year
 */
void WidgetLineChart::drawYear(const int &sel) {
    QList<QListWidgetItem*> tempList = ui->listLineChartMunicipality->selectedItems();
    int i = 0;
    for(QList<QListWidgetItem*>::Iterator it = tempList.begin(); it != tempList.end(); ++it) {
        QListWidgetItem *tempItem = *it;
        Municipality tempMuni = _meas->findMuni(tempItem->text());
        try {
            ui->widgetLineChart_2->graph(i)->addData(_meas->yearRange().at(sel).toInt(),tempMuni.getYear(_meas->yearRange().at(sel)).value());
        } catch(std::string s) {
        }
        ui->widgetLineChart_2->graph(i)->setName(tempMuni.name());
        ++i;
    }

}
예제 #2
0
/**
 * @brief WidgetCompLineChart::drawYear2 draw year for the second measure
 * @param sel the index of the year to draw
 * @param offset the offset in the list of graphs
 */
void WidgetCompLineChart::drawYear2(const int &sel,const int &offset)
{
    QList<QListWidgetItem*> tempList = ui->listLineChartMunicipality_4->selectedItems();
    int i = 0;
    for(QList<QListWidgetItem*>::Iterator it = tempList.begin(); it != tempList.end(); ++it) {
        QListWidgetItem *tempItem = *it;
        Municipality tempMuni = _meas2->findMuni(tempItem->text());
        try {
            ui->widgetCompLineChart_2->graph(i+offset)->addData(_ylist->at(sel).toInt(),tempMuni.getYear(_meas2->yearRange().at(sel)).value());
            ui->widgetCompLineChart_2->graph(i+offset)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle) );
        } catch(std::string s) {
        }
        ui->widgetCompLineChart_2->graph(i+offset)->setName(tempMuni.name()+ ":" + _meas2->id());
        ++i;
    }

}