Page 1 of 1
LineSeries using psDash
Posted: Wed Apr 22, 2009 8:04 am
by 10048056
Hello,
Is it possible to use psDash with thick lines? With
Series: TChartSeries;
it works fine with
Series.Pen.Style := psDash;
provided
Series.Pen.Width := 1;
With width greater than 1 it comes out like a bad solid line.
I'm using 100 points.
Many thanks in advance.
Ian
Posted: Wed Apr 22, 2009 9:10 am
by yeray
Hi Ian,
What is the height of your chart? I've tested it here and, to see a continous line, you need a chart with a height smaller than 130. Here is the code I've used:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
var series1: TLineSeries;
begin
Chart1.Align := alClient;
Chart1.View3D := False;
series1 := TLineSeries.Create(nil);
Chart1.AddSeries(series1);
series1.FillSampleValues(100);
series1.Pen.Style := psDash;
series1.Pen.Width := 4;
end;
procedure TForm1.Chart1Resize(Sender: TObject);
begin
Chart1.Title.Text.Text := 'Chart Height: ' + IntToStr(Chart1.Height) + ' Width: ' + IntToStr(Chart1.Width);
end;
Please, take a look at
this thread where this was discussed before too.
Yes but...
Posted: Wed Apr 22, 2009 10:38 am
by 10048056
Thanks Yeray
I've just had a look at the thread you mention and I'm not surprised that the problem is that the data points are too close together so that it starts drawing after each point. If the points are closer than the length of the dashes, then there is no chance of a space. I encountered this problem years ago when I wrote my own graphics routines, but got round it with a bit of geometry (not difficult). I think my problem was a combination of the graph size and number of points - I think I can get round it.
One point to note about the randomly filled graphs is that the total length of the curve is quite big. For a smooth function, such as a sine curve, or straight line, I think the problem would be encountered earlier (in terms of the graph getting smaller).
Anyway, I think I can sort this out now, so many thanks.
Best regards, Ian