Free cookie consent management tool by TermsFeed Policy Generator

Changeset 550


Ignore:
Timestamp:
09/11/08 15:28:07 (16 years ago)
Author:
gkronber
Message:

fixed #267 (DataRowType.Bars is not implemented in DataChart).
Bars can be specified by adding two data points for the lower left and upper right corner.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Charting.Data/Datachart.cs

    r2 r550  
    3434      get { return myTitle; }
    3535      set {
    36         if (myTitle != value) {
     36        if(myTitle != value) {
    3737          myTitle = value;
    3838          OnUpdate();
     
    5555      Group.Add(group);
    5656      dataRowTypes.Add(dataRowType);
    57       if (dataRowType == DataRowType.Lines) {
     57      if(dataRowType == DataRowType.Lines) {
    5858        Group lines = new Group(this);
    5959        group.Add(lines);
     
    7171      Group group = (Group)Group.Primitives[dataRowIndex];
    7272
    73       switch (dataRowType) {
     73      switch(dataRowType) {
    7474        case DataRowType.Lines:
    7575          Group lines = (Group)group.Primitives[1];
    7676          Group points = (Group)group.Primitives[0];
    77           if (points.Primitives.Count > 0) {
     77          if(points.Primitives.Count > 0) {
    7878            FixedSizeRectangle lastRect = (FixedSizeRectangle)points.Primitives[0];
    7979            Line line = new Line(this, lastRect.Point, point, group.Pen);
     
    8585          break;
    8686        case DataRowType.Bars:
     87          if(group.Primitives.Count < 2) {
     88            group.Add(new FixedSizeRectangle(this, point, new Size(0, 0), group.Pen, group.Brush));
     89            if(group.Primitives.Count == 2) {
     90              PointD p = ((FixedSizeRectangle)group.Primitives[0]).Point;
     91              PointD q = ((FixedSizeRectangle)group.Primitives[1]).Point;
     92              double y0 = Math.Min(p.Y, q.Y);
     93              double y1 = Math.Max(p.Y, q.Y);
     94              double x0 = Math.Min(p.X, q.X);
     95              double x1 = Math.Max(p.X, q.X);
     96              Rectangle bar = new Rectangle(this, x0, y0, x1, y1, group.Pen, group.Brush);
     97              bar.ToolTipText = "Height=" + (y1 - y0);
     98              group.Add(bar);
     99            }
     100          }
    87101          break;
    88102        case DataRowType.Points:
    89           FixedSizeRectangle p = new FixedSizeRectangle(this, point, new Size(5, 5), group.Pen, group.Brush);
    90           p.ToolTipText = "(" + point.X.ToString() + " ; " + point.Y.ToString() + ")";
    91           group.Add(p);
     103          FixedSizeRectangle r = new FixedSizeRectangle(this, point, new Size(5, 5), group.Pen, group.Brush);
     104          r.ToolTipText = "(" + point.X.ToString() + " ; " + point.Y.ToString() + ")";
     105          group.Add(r);
    92106          break;
    93107      }
Note: See TracChangeset for help on using the changeset viewer.