diff --git a/Graphs/gBarChart.cpp b/Graphs/gBarChart.cpp index 621e9ec1..68865b12 100644 --- a/Graphs/gBarChart.cpp +++ b/Graphs/gBarChart.cpp @@ -240,7 +240,6 @@ void UsageChart::SetDay(Day * day) Layer::SetDay(day); //m_empty=true; // if (!day) return; - m_empty=false; m_values.clear(); m_miny=9999999; @@ -255,6 +254,7 @@ void UsageChart::SetDay(Day * day) m_fday=0; qint64 tt; + int days=0; for (QMap >::iterator d=m_profile->daylist.begin();d!=m_profile->daylist.end();d++) { tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t(); dn=tt/86400; @@ -271,8 +271,10 @@ void UsageChart::SetDay(Day * day) m_values[dn][1]=total; if (totalm_maxy) m_maxy=total; + days++; } } + if (!days) m_empty=true; else m_empty=false; //m_maxy=ceil(m_maxy); //m_miny=floor(m_miny); m_miny=0; diff --git a/mainwindow.cpp b/mainwindow.cpp index 1a9ce115..446ca595 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -185,11 +185,9 @@ void MainWindow::Startup() if (daily) daily->ReloadGraphs(); - /*if (overview) { + if (overview) { overview->ReloadGraphs(); - overview->UpdateGraphs(); - - }*/ + } qprogress->hide(); qstatus->setText(""); @@ -229,11 +227,9 @@ void MainWindow::on_action_Import_Data_triggered() profile->Save(); if (daily) daily->ReloadGraphs(); - /*if (overview) { + if (overview) { overview->ReloadGraphs(); - overview->UpdateGraphs(); - - } */ + } //qDebug() << "overview->ReloadGraphs();"; } qstatus->setText(""); diff --git a/overview.cpp b/overview.cpp index 63517695..4ed9a703 100644 --- a/overview.cpp +++ b/overview.cpp @@ -55,7 +55,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : const int default_height=180; AHI=new gGraph(GraphView,"AHI Chart",default_height,2); UC=new gGraph(GraphView,"Usage Chart",default_height,2); - Layer *uc=new UsageChart(profile); + uc=new UsageChart(profile); UC->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin); gXAxis *gx=new gXAxis(); gx->setUtcFix(true); @@ -77,7 +77,16 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : AHI->AddLayer(bc); AHI->AddLayer(new gXGrid()); + //ReloadGraphs(); +} +Overview::~Overview() +{ + //delete day; + delete ui; +} +void Overview::ReloadGraphs() +{ bc->SetDay(NULL); AHI->MinX(); AHI->MaxX(); @@ -87,14 +96,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : UC->MaxX(); GraphView->ResetBounds(); - } -Overview::~Overview() -{ - //delete day; - delete ui; -} - /* ui->setupUi(this); profile=Profiles::Get(pref["Profile"].toString()); diff --git a/overview.h b/overview.h index af89de47..a471a88b 100644 --- a/overview.h +++ b/overview.h @@ -27,7 +27,7 @@ public: explicit Overview(QWidget *parent,gGraphView *shared=NULL); ~Overview(); - //void ReloadGraphs(); + void ReloadGraphs(); //void UpdateGraphs();