Ignore:
Timestamp:
08/17/2009 08:42:41 PM (3 years ago)
Author:
guyru
Message:

Render legend in the SimplePiePlot? widget

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/statistics_dialog.cpp

    r206 r208  
    4646        games_started = new wxStaticText(this, wxID_ANY, wxT("")); 
    4747        games_finished = new wxStaticText(this, wxID_ANY, wxT("")); 
    48         histogram = new simple_pie_plot::SimplePiePlot(this, wxID_ANY); 
     48        pie_plot = new simple_pie_plot::SimplePiePlot(this, wxID_ANY); 
    4949        statistics_reset_date = new wxStaticText(this, wxID_ANY, wxT("")); 
    5050} 
     
    6464 
    6565        vector<int> score_dist = m_stats->score_distribution(); 
    66         vector<double> dist (score_dist.begin(), score_dist.end()); 
    67         histogram->SetData(dist); 
     66        vector<double> dist; 
     67        vector<wxString> labels; 
     68        for (int i; i<score_dist.size(); i++) { 
     69                if (score_dist[i]) { 
     70                        assert(score_dist[i]>0); 
     71                        dist.push_back(score_dist[i]); 
     72                        tmp = wxString::Format(wxT("%i - %i"), 
     73                                i*statistics::score_distribution_granuality, 
     74                                (i+1)*statistics::score_distribution_granuality); 
     75                        labels.push_back(tmp); 
     76                } 
     77        } 
     78        pie_plot->SetData(dist, labels); 
    6879} 
    6980 
     
    7990 
    8091        wxStaticBoxSizer* score_distribution = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Score Distribution") ), wxHORIZONTAL); 
    81         score_distribution->Add(histogram, 1, wxEXPAND, 10); 
     92        score_distribution->Add(pie_plot, 1, wxEXPAND, 10); 
    8293        top_sizer->Add(score_distribution,10,wxEXPAND, 10); 
    8394 
Note: See TracChangeset for help on using the changeset viewer.