Dash line appearing as straight line

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Dash line appearing as straight line

Post by vinc64 » Tue May 10, 2011 11:39 am

Hi,

In the editor I set the style of a line series to dash lines but in the report where the chart is printed it always appears as a straight line. Any idea why this is happening?

Regards,
Vincenzo

P.S. Cannot attache screen-shots as an error message appears saying the board quota has been reached.

Bert B.
Newbie
Newbie
Posts: 69
Joined: Fri Jun 15, 2007 12:00 am

Re: Dash line appearing as straight line

Post by Bert B. » Tue May 10, 2011 12:36 pm

Which version of Delphi and TeeChart are you using?

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Tue May 10, 2011 1:05 pm

Delphi 2009 and TeeChart Pro V.8.04.11395 Win32

Bert B.
Newbie
Newbie
Posts: 69
Joined: Fri Jun 15, 2007 12:00 am

Re: Dash line appearing as straight line

Post by Bert B. » Tue May 10, 2011 1:22 pm

Hm, I don't have version 8 but I know that 8.04 is not the latest release. My suggestion is to install 8.08 and see if the problem persists.

Yeray
Site Admin
Site Admin
Posts: 8833
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Dash line appearing as straight line

Post by Yeray » Tue May 10, 2011 3:01 pm

Hello,

Yes, please try it with the latest release available at the client area and, if the problem persists, please tell us what reporting component are you using and try to arrange a simple example project we can run as-is to reproduce the problem here.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Tue May 10, 2011 3:42 pm

Hi,

Thanks for your replies. It's not crucial for me to have a dashed line and installing the latest version just to try it out is too much hassle (have to re-install my current version again later).

Regards,
Vincenzo

Yeray
Site Admin
Site Admin
Posts: 8833
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Dash line appearing as straight line

Post by Yeray » Thu May 12, 2011 11:38 am

Hello Vincenzo,

I understand it's not a critical problem but we'll be pleased to take a look at it if we can reproduce it here. But to do so, we'd need to know what reporting component are you using and it would be also really helpful if we could have a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Thu May 12, 2011 2:15 pm

Hi Alonso,

Meanwhile I found out that it has nothing to do with the report component. The line is shown as straight line (instead of dashed) if the vertical axis assigned is the right one (if it's the left it's drawn correctly as dashed). I have created a small example program if you need it, where can I upload it?

Regards,
Vincenzo

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

Re: Dash line appearing as straight line

Post by Narcís » Fri May 13, 2011 9:28 am

Hi Vincenzo,

You can attach files to this forums board in your replies. You can compress your project in a zip packages and attach it to your reply.

Thanks in advance.
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

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Fri May 13, 2011 12:13 pm

Sample program attached.
Attachments
test2.zip
(14.3 KiB) Downloaded 152 times

Yeray
Site Admin
Site Admin
Posts: 8833
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Dash line appearing as straight line

Post by Yeray » Mon May 16, 2011 11:13 am

Hello Vincenzo,

The problem here is that the distance between each two points isn't enough for the Dash pen style to be noticed. Note that the line series is drawn in segments.
Here you have an example:

Code: Select all

uses Chart, Series;

var Chart1: TChart;
    Series1: TLineSeries;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;

  Chart1.Color:=clWhite;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;
  Chart1.Axes.Bottom.Grid.Visible:=false;
  Chart1.Axes.Left.Grid.Visible:=false;

  Series1:=Chart1.AddSeries(TLineSeries) as TLineSeries;
  Series1.Pen.Style:=psDash;
  for i := 0 to 10 do
    Series1.Add(12+i);

  //Series1.Pointer.Visible:=true;

  Chart1.Axes.Bottom.SetMinMax(0, 20);
  Chart1.Axes.Left.SetMinMax(10, 22);

  Chart1.Draw;
end;

procedure TForm1.FormPaint(Sender: TObject);
var YDispl, XDispl, i: Integer;
begin
  YDispl:=300;
  XDispl:=50;
  with Self.Canvas do
  begin
    Pen.Style:=psDash;
    MoveTo(Series1.CalcXPos(0),Series1.CalcYPos(0)+YDispl);
    LineTo(Series1.CalcXPos(Series1.Count-1),Series1.CalcYPos(Series1.Count-1)+YDispl);

    for i:=0 to Chart1[0].Count-2 do
    begin
      MoveTo(Series1.CalcXPos(i)+XDispl, Series1.CalcYPos(i)+YDispl);
      LineTo(Series1.CalcXPos(i+1)+XDispl, Series1.CalcYPos(i+1)+YDispl);
    end;
  end;
end;
An option would be to use psDot style instead of psDash.

Find here a more complete explanation of it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Mon May 16, 2011 12:06 pm

Hi,

Thanks for investigating this, I do understand the explanation but nevertheless it would be good if Teechart would automatically convert to dot (or shorter lines) if dashes cannot be drawn.

Regards,
Vincenzo

Yeray
Site Admin
Site Admin
Posts: 8833
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Dash line appearing as straight line

Post by Yeray » Tue May 17, 2011 11:46 am

Hi Vincenzo,

TeeChart could include it (or better, the option to check it or not, for not to break backwards compatibility) but it would mean many new conditions (one for each segment to be drawn) so it could affect the performance even for those who use psSolid but have thousands of points.
So I'd suggest you to check it in your code. The following works for me here:

Code: Select all

uses Chart, Series, TeCanvas;

var Chart1: TChart;
    Series1: TLineSeries;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    d: double;
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;

  Chart1.Color:=clWhite;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;
  Chart1.Axes.Bottom.Grid.Visible:=false;
  Chart1.Axes.Left.Grid.Visible:=false;

  Series1:=Chart1.AddSeries(TLineSeries) as TLineSeries;
  Series1.Pen.Style:=psDash;
  for i := 0 to 10 do
    Series1.Add(12+i);

  Chart1.Axes.Bottom.SetMinMax(0, 20);
  Chart1.Axes.Left.SetMinMax(10, 22);

  if Series1.Pen.Style=psDash then
  for i:=0 to Series1.Count-2 do
  begin
    d:=TeeDistance(Series1.CalcXPos(i+1)-Series1.CalcXPos(i),Series1.CalcYPos(i+1)-Series1.CalcYPos(i));
    if (d < 25) then
    begin
      Series1.Pen.Style:=psDot;
      exit;
    end;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: Dash line appearing as straight line

Post by vinc64 » Tue May 17, 2011 1:09 pm

Hi,

Thanks for the code sample and I understand that for performance reasons it wouldn't be a good idea to include the automatic switch.

Regards,
Vincenzo

Andreas iCD
Newbie
Newbie
Posts: 12
Joined: Mon Jan 17, 2011 12:00 am

Re: Dash line appearing as straight line

Post by Andreas iCD » Thu Dec 15, 2011 10:02 am

Hello,
in my TeeChart project (using TeeChart 2010 and Delphi 2010) I found the same problem as discussed in these posts/replys. However, I observed that this problem seems to be somewhat more general: even a dot-style series "melts" into a solid line if the number of points per page exceeds a certain level (Zooming such a line would restore the dot style).
The chart applications that I am developing with TeeChart, usually contain more than 5 line series within the chart. Of course, to distinguish them from each other it is necessary to use not only different colors but also different styles (solid, dash, dot...).

So, in my opinion the pen style appearance of a series should not be affected by the number of series points, although I can imagine that handling this won't be an easy job for the component developers :(
Do you see any chance, to solve this problem in one of the next releases?

Regards,
Andreas

Post Reply