Issue with LinePen.Style

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
gilbert
Newbie
Newbie
Posts: 21
Joined: Fri Sep 28, 2012 12:00 am

Issue with LinePen.Style

Post by gilbert » Mon Jun 09, 2014 8:19 am

For LinePen.Style=Dotted,

If bottom axis with is more the dotted line show properly,
if the bottom axis width is less the dotted line is not shown properly , it shown as solid line,

I have attached the Screenshot , please provide the solution to solve the issue
Attachments
DottedLine.png
DottedLine.png (35.58 KiB) Viewed 7441 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Issue with LinePen.Style

Post by Christopher » Mon Jun 09, 2014 9:29 am

gilbert wrote:I have attached the Screenshot , please provide the solution to solve the issue
Using the latest version of TeeChart and the following code:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Line line = new Line(tChart1.Chart);

      line.Add(0, 50);
      line.Add(10, 50);

      tChart1.Axes.Left.SetMinMax(0, 100);

      line.LinePen.Width = 3;
      line.LinePen.Style = DashStyle.Dash;
    }
I get the following chart:
line1.PNG
line1.PNG (6.03 KiB) Viewed 7413 times
this seems to render correctly. Does the above code work for you? Which version of TeeChart are you using?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

gilbert
Newbie
Newbie
Posts: 21
Joined: Fri Sep 28, 2012 12:00 am

Re: Issue with LinePen.Style

Post by gilbert » Tue Jun 10, 2014 5:36 am

Please add these many points and reduce the width, as shown in the picture

private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Line line = new Line(tChart1.Chart);

line.Add(0, 50);
line.Add(0, 50);
line.Add(1, 50);
line.Add(2, 50);
line.Add(3, 50);
line.Add(4, 50);
line.Add(5, 50);
line.Add(6, 50);
line.Add(7, 50);
line.Add(8, 50);
line.Add(9, 50);
line.Add(10, 50);

tChart1.Axes.Left.SetMinMax(0, 100);

line.LinePen.Width = 3;
line.LinePen.Style = DashStyle.Dash;
}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Issue with LinePen.Style

Post by Narcís » Thu Jun 12, 2014 1:26 pm

Hi gilbert,

Thanks for your feedback.

The difference here is in the number of points that need to be plotted. Christopher Ireland only added two points to the series. A line segment needs to be painted between those 2 points and the segment is long enough to be able to fit the dashed pen. You are adding a much higher number of points within the same X values range and chart width. This means a higher number of point to point segments that need to be painted and that those segments will be much shorter. Therefore, with a narrower chart, there won't be enough space for the segments to be painted as dashed lines as segments overlap. Given that, you can improve that behavior decreasing LinePen.Width and setting LinePen.DashCap to Triangle, for example:

Code: Select all

      line.LinePen.Width = 2;
      line.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Dash;
      line.LinePen.DashCap = System.Drawing.Drawing2D.DashCap.Triangle;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply