ich muss in einem Programm zusätzliche Achsen in einem TChart erstellen. Es gibt zwar:
Code: Alles auswählen
Chart.AxisList.Add;
Code: Alles auswählen
External SIGSEGV
Wer kann mir weiterhelfen?
Gruß, Linkat
Code: Alles auswählen
Chart.AxisList.Add;
Code: Alles auswählen
External SIGSEGV
Code: Alles auswählen
procedure TForm1.Button1Click(Sender: TObject);
var
axis : TChartAxis;
begin
axis := TChartAxis.Create(Chart1.AxisList);
axis.Alignment := calRight;
end;
Code: Alles auswählen
unit TestU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TAGraph, TATransformations, TASources, Forms,
Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
//Chart1: TChart;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var chart :TChart;
axis :TChartAxisTransformations;
begin
chart:=TChart.Create(Form1);
chart.Parent:=Form1;
chart.Title.Visible:=True;
axis:=TChartAxisTransformations.Create(chart);
Variante 1 --> axis.alignment:=calRight; //Error: identifier idents no member "alignment"
Variante 2 --> chart.AxisList.Axes[2].Alignment:=calRight; //Error: identifier not found "calRight"
end;
end.
Code: Alles auswählen
axis :TChartAxis
Code: Alles auswählen
axis.Alignment:=calRight;
Code: Alles auswählen
chart.AxisList.Axes[2].Alignment:=calRight;
Code: Alles auswählen
Error: identifier not found "calRight"
Code: Alles auswählen
uses
..., TAChartAxis, TAChartAxisUtils, ...
procedure TForm1.FormCreate(Sender: TObject);
var
chart :TChart; // Gefahr: Der Chart existiert damit nur während "FormCreate"!
axis :TChartAxis;
begin
chart:=TChart.Create(Form1);
chart.Parent:=Form1;
chart.Title.Visible:=True;
axis:=TChartAxis.Create(chart.AxisList); // Der Owner der ChartAxis ist die AxisList, nicht der Chart!
axis.Alignment := calRight;
end;
Code: Alles auswählen
TAChartAxisUtils