Drawing a dotted line

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Drawing a dotted line

Post by Newbie » Wed Jun 08, 2005 8:34 pm

Hi,

I have created a chart, TeeChart 7.02, drawing 2 TLineSeries, each line is about 2000 points. One of them needs to be dotted or dashed style. When setting TLinePen to dotted (small dots True), you don't see a dotted line because the dots are drawn between points. And with 2000 points in a trace, you don't see them. That is obvious. However, I need to have this one line dotted, without reducing points. I have done it now by using AddNullXY every .. points, but I assume there must be an easy way to get a dotted line right away, no matter how many points are in the trace?

Thanks in advance,

Davy

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

Post by Narcís » Thu Jun 09, 2005 11:44 am

Hi Davy,

Using v7.04 (latest version available at our customer download area) and the code below you can cleary see Series2 being small-dotted.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(2000);
  Series2.FillSampleValues(2000);
  Series2.Pen.SmallDots:=true;
end;
If you don't succedd on this could you please send us an example we can run "as-is" to reproduce the problem here?

You can post your examples at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
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

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Thu Jun 09, 2005 6:44 pm

Hi Narcis,

Have tried your code with 7.04 and that works well indeed.

My code is a bit different as you might assume
Note when zooming in you see a dotted line between points.

Code: Select all


procedure TForm1.Button2Click(Sender: TObject);
// This code does not draw a dotted line
var
  i: integer;
  j: double;
begin
  for i := 0 to Chart1.SeriesCount - 1 do
    Chart1.Series[i].Clear;
  j := 0;
  for i := 0 to 1999 do
  begin
    Series1.AddXY(i,j);
    Series2.AddXY(i,j + 50);
    j := j + 0.2;
    // j := j + 1; // Makes no difference
  end;
  Series2.Pen.SmallDots := True;
end;

Any clue?

Thanks a lot for your efforts,

Davy

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

Post by Narcís » Fri Jun 10, 2005 8:14 am

Hi Davy,

I can reproduce the problem with your code. It happens because your points are very close one to another. You could try using another pen style as dots, for example, and increase its size. However it won't work because it will end making a thick line.

Depending on how are your points distributed you can play a little with pen styles and sizes to see if there's a combination that fits your needs.
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

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Fri Jun 10, 2005 5:48 pm

Hi Narcis,

Playing around with pen styles and so on does not makes any sense in this application. Infact, the graph is used as a sweepchart with a pre-defined no of points, where every 200 ms a point is overwritten with a new one, so the graph cycles around every 2000 / 5 = 400 seconds. It is an data acquisition application. If I reduce points, customer information gets lost.

I think it is a bit of un-intended behavior of the chart, because FillSampleValues does what it should do. Could Steema address this please?

Kind regards,

Davy

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Tue Jun 14, 2005 10:21 pm

Hi Narcis,

I have not seen any reply to my last message yet, therefore again:
I think it is a bit of un-intended behavior of the chart, because FillSampleValues does what it should do. Could Steema address this please?
Kind regards,

Davy

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jun 15, 2005 9:24 am

Hi Davy,
I think it is a bit of un-intended behavior of the chart, because FillSampleValues does what it should do. Could Steema address this please?
FillSampleValues works in the same manner, but it normally does not reproduce a straight line. If you modify the following lines in your code you will see the same as using FillSampleValues :

Code: Select all

  for i := 0 to 1999 do
  begin
    Series1.AddXY(i,j);
    Series2.AddXY(i,Random(350) + 50);
    j := j + 0.2;
  end;
A solution for this problem could be using TFastLineSeries instead of TLineSeries.

Post Reply