Page 1 of 1

Lines are jagged

Posted: Thu Jun 10, 2010 2:13 pm
by 10548297
I am finding it difficult to create a line graph with nice smooth lines between points. For example, in the TChart below I consider the lines to be very "jagged":
jaggedlines.JPG
jaggedlines.JPG (18.55 KiB) Viewed 2881 times
Below is a graph I found off another website:
goodgraph.JPG
goodgraph.JPG (11.07 KiB) Viewed 2880 times
(see it for real: http://www.maani.us/xml_charts/index.ph ... bmenu=Line )

I just can't seem to create charts which have nice smooth lines. It seems a lot of other graphic solutions are rendering charts with much greater eye appeal.

Re: Lines are jagged

Posted: Fri Jun 11, 2010 1:06 pm
by yeray
Hi mSchenkel,

You could use AntiAlias to get nicer smoothed lines:
chart.png
chart.png (33.8 KiB) Viewed 2855 times

Code: Select all

uses Series, TeeAntialias, TeeThemes;

procedure TForm1.FormCreate(Sender: TObject);
var AntiAliasCanvas: TAntiAliasCanvas;
    i: Integer;
begin
  Chart1.View3D:=false;

  AntiAliasCanvas:=TAntiAliasCanvas.Create;
  Chart1.Canvas:=AntiAliasCanvas;

  ApplyChartTheme(TBlackIsBackTheme, Chart1);

  for i:=0 to 1 do
  with Chart1.AddSeries(TFastLineSeries) as TFastLineSeries do
  begin
    Pen.Width:=2;
    FillSampleValues;
  end;
end;