Changeset 1080


Ignore:
Timestamp:
01/07/09 15:28:14 (12 years ago)
Author:
whackl
Message:

added new chart diagram (#397)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.cs

    r1028 r1080  
    116116      ListViewItem curEventLogEntry;
    117117
    118       foreach (EventLogEntry ele in HiveClientEventLog.Entries) {
    119         curEventLogEntry = GenerateEventEntry(ele);
    120         lvLog.Items.Add(curEventLogEntry);
    121       }
    122       lvJobDetail.Sort();
     118      //databinding on listview?
     119      if (HiveClientEventLog != null && HiveClientEventLog.Entries != null) {
     120        foreach (EventLogEntry ele in HiveClientEventLog.Entries) {
     121          curEventLogEntry = GenerateEventEntry(ele);
     122          lvLog.Items.Add(curEventLogEntry);
     123        }
     124        lvJobDetail.Sort();
     125      }
    123126    }
    124127
     
    134137    }
    135138
    136     private void UpdateGraph(int jobsDone, int jobsAborted) {
     139    private void UpdateGraph(JobStatus[] jobs) {
    137140      ZedGraphControl zgc = new ZedGraphControl();
    138141      GraphPane myPane = zgc.GraphPane;
     
    146149      myPane.Legend.IsVisible = false; // no legend
    147150
    148       myPane.Fill.Color = Color.FromKnownColor(KnownColor.Control);
     151      myPane.Fill.Color = this.BackColor;
    149152
    150153      myPane.Chart.Fill.Type = FillType.None;
    151154      myPane.Fill.Type = FillType.Solid;
    152155
    153       double sum = (double)jobsDone + jobsAborted;
    154       double perDone = (double)jobsDone / sum * 100;
    155       double perAborted = (double)jobsAborted / sum * 100;
    156 
    157       myPane.AddPieSlice(perDone, Color.Green, 0.1, "");
    158       myPane.AddPieSlice(perAborted, Color.Red, 0.1, "");
    159 
     156      double allProgress = 0;
     157      double done = 0;
     158
     159      if (jobs.Length == 0) {
     160        myPane.AddPieSlice(100, Color.Green, 0.1, "");
     161      } else {
     162        for (int i = 0; i < jobs.Length; i++) {
     163          allProgress += jobs[i].Progress;         
     164        }
     165
     166        done = allProgress / jobs.Length;
     167
     168        myPane.AddPieSlice(done, Color.Green, 0.1, "");
     169        myPane.AddPieSlice(1-done, Color.Red, 0.1, "");
     170      }
    160171      //Hides the slice labels
    161172      PieItem.Default.LabelType = PieLabelType.None;
     
    216227        }
    217228
    218         UpdateGraph(sc.JobsDone, sc.JobsAborted);
     229        UpdateGraph(sc.Jobs);
    219230
    220231        if (sc.Status == NetworkEnumWcfConnState.Connected) {
Note: See TracChangeset for help on using the changeset viewer.