File: noguidemo.lpr

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (46 lines) | stat: -rw-r--r-- 1,372 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
program noguidemo;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF}
  Interfaces, Classes, tachartlazaruspkg { you can add units after this },
  FPCanvas, FPImage, FPImgCanv,
  TAGraph, TASeries, TADrawerFPCanvas in '../../TADrawerFPCanvas.pas', TADrawerCanvas, TADrawUtils;

var
  chart: TChart;
  bs: TBarSeries;
  img: TFPMemoryImage;
  c: TFPImageCanvas;
  d: IChartDrawer;
begin
  chart := TChart.Create(nil);
  chart.LeftAxis.Marks.LabelFont.Name := 'Arial';
  chart.LeftAxis.Marks.LabelFont.Size := 10;
  chart.LeftAxis.Marks.LabelFont.Orientation := 450;
  chart.LeftAxis.Marks.Frame.Visible := true;
  chart.LeftAxis.Marks.Frame.Style := psSolid;
  chart.LeftAxis.Marks.Frame.FPColor := colBlack;
  chart.LeftAxis.Grid.FPColor := colDkGray;
  chart.BottomAxis.Marks.Visible := false;
  chart.BottomAxis.Grid.FPColor := colDkGray;
  chart.Color := $FFA0A0;
  chart.BackColor := $FFFFFF;
  bs := TBarSeries.Create(nil);
  chart.AddSeries(bs);
  bs.AddXY(1, 10);
  bs.AddXY(2, 7);
  bs.AddXY(3, 8);
  img := TFPMemoryImage.Create(chart.Width, chart.Height);
  c := TFPImageCanvas.Create(img);
  d := TFPCanvasDrawer.Create(c);
  d.DoGetFontOrientation := @CanvasGetFontOrientationFunc;
  chart.Draw(d, Rect(0, 0, chart.Width, chart.Height));
  img.SaveToFile('test.png');
  c.Free;
  img.Free;
  bs.Free;
  chart.Free;
end.