Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1793

Summary: The AreaLines series doesn't hide when the AreaLines is set to false and alpha transparency is added
Product: .NET TeeChart Reporter: sandra pazos <sandra>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED NOTABUG    
Severity: normal CC: chris
Priority: Normal    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/support/viewtopic.php?f=4&t=16432&sid=723644df5c386b78ce9ae76b3d7727d4
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: screenshot
screenshot2

Description sandra pazos 2017-02-21 04:07:53 EST
The AreaLines series doesn't hide when the AreaLines is set to false and alpha transparency is added. 
The code below shows the problem: 
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            var area = new Steema.TeeChart.Styles.Area();
            area.AreaLines.Visible = false;
            area.LinePen.Visible = false;
            area.Color = Color.Purple;
            area.Transparency = 50;
            area.FillSampleValues();
            tChart1.Chart.Series.Add(area);}
Comment 1 christopher ireland 2017-03-01 04:34:43 EST
Created attachment 727 [details]
screenshot

This problem occurs outside of TeeChart as can be seen in the screenshot attached. The code to reproduce this is the following:

 public partial class UserControl1 : Control
  {
    public UserControl1()
    {
      InitializeComponent();

      ControlStyles s =
  ControlStyles.AllPaintingInWmPaint |
  ControlStyles.ResizeRedraw |
  ControlStyles.UserPaint |
  ControlStyles.SupportsTransparentBackColor |
  ControlStyles.Selectable |
  ControlStyles.StandardClick |
  ControlStyles.StandardDoubleClick;

      SetStyle(s, true);

			SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
    }

    public static void DoArea(Graphics g, Rectangle r)
    {
      g.SmoothingMode = SmoothingMode.HighQuality;
      SolidBrush brush = new SolidBrush(Color.FromArgb(150, Color.Purple));   

      int count = 15;
      int width = r.Width / count;
      Random rnd = new Random();
      Point oldRightTop = Point.Empty;

      for (int i = 0; i < count; i++)
      {
        Rectangle shape = Rectangle.FromLTRB(r.Left + (width * i), r.Height - rnd.Next(r.Height), r.Left + (width * (i + 1)), r.Bottom);

        Point leftTop = shape.Location;
        Point rightTop = new Point(shape.Right, shape.Top);
        Point rightBottom = new Point(shape.Right, shape.Bottom);
        Point leftBottom = new Point(shape.Left, shape.Bottom);

        Point[] points = new Point[] { oldRightTop == Point.Empty ? leftTop : oldRightTop, rightTop, rightBottom, leftBottom };
        g.FillPolygon(brush, points);

        oldRightTop = rightTop;
      }
    }

    protected override void OnPaint(PaintEventArgs e)
    {
      DoArea(e.Graphics, e.ClipRectangle);
    }

    protected override void OnResize(EventArgs e)
    {
      Invalidate();
    }
  }

The screenshot is this UserControl1 placed on a Windows Form.
Comment 2 christopher ireland 2017-03-01 04:37:44 EST
Created attachment 728 [details]
screenshot2

This is not a bug, as the problem occurs in a UserControl quite independently of TeeChart. To remedy this issue, please use SmoothingMode.HighSpeed (result seen in screenshot2):

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Graphics3D.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;

      tChart1.Aspect.View3D = false;
      var area = new Steema.TeeChart.Styles.Area();
      area.AreaLines.Visible = false;
      area.LinePen.Visible = false;
      area.Color = Color.Purple;
      area.Transparency = 50;
      area.FillSampleValues();
      tChart1.Chart.Series.Add(area);
    }