I searched the web for a few hours then read every forum entry but did not see a solution...
I would like to update pie data programmically. What I am doing does not show up. Using Lazarus 1.8.4 and I am a newbie to Lazarus but not to programming.
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Chart1: TChart;
ChartToolset1: TChartToolset;
ChartToolset1ZoomMouseWheelTool1: TZoomMouseWheelTool;
Prov1: TPieSeries;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Chart1Resize(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
Values: array[1..5] of double = (22, 20, 20, 5, 12);
Colours: array[1..5] of TColor = (clRed, clYellow, clFuchsia, clGreen, clBlue);
Labels: array[1..5] of string = ('', '', '', '', '');
implementation
{$R *.lfm}
uses
Math, TAChartUtils, TATextElements, TATypes;
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
Count: integer;
begin
Form1.Caption := 'Election Game';
Prov1 := TPieSeries.Create(Chart1);
Chart1.Title.Text.Strings[0] := 'Province 1';
Chart1.Title.Font.Size := 10;;
Chart1.Title.Visible := true;
Prov1.Marks.Style := TSeriesMarksStyle(smsNone);
Prov1.Marks.Distance:= 5;
for Count := 1 to 5 do
Prov1.AddPie(Values[count], Labels[count], Colours[Count]);
Chart1.AddSeries(Prov1);
Chart1.AxisVisible := false;
end;
procedure TForm1.Chart1Resize(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Count: integer;
begin
Values[5] := Values[5]+2;
Values[1] := Values[1]-2;
Prov1.SetXValue(4,Values[5]);
Prov1.SetXValue(0,Values[5]);
end;
What am I missing here?