Updating Pie Data lazarus / 55-TAChart ---------------------------------------------------------------------- ccanute · 2018-05-27 02:05 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? ---------------------------------------------------------------------- wp · 2018-05-27 09:00 First of all: if you post code within your text please enclose it with [code=Pascal] and [/code] tags - this will format the text as pascal code and make it more readable. And, since you seem to have a test project, pack the .pas, .lfm, .lpi and .lpr files into a common .zip and upload it here under "Attachements and other options" - a compilable project helps me in understanding and verifying your issue. Back to your question. The pie series interprets the x,y data provided in a special way: The x value is the distance of the pie from the center (in units of the pie radius) if the pie series' Exploded is set to true. Otherwise x is ignoredThe y value is the "size" of the pie (to be more precise: the pie angle after normalizing the sum of all pie y values to the full circle at 360°)If you add data points by calling the pie series' AddPie the provided values go into the y channel. But your button click routine puts the modified values into the x channel. And x is ignored unless Exploded is true. So, if you use "Prov1.SetYValue(...)" the chart should work correctly. If you want to use the Exploded feature don't add data by AddPie because it increments x with each value added. Instead, use AddXY where you can specify the x value explicitely, e.g. if you want to "explode" the first pie by one quarter of the pie radius do this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  x: Double;...  for Count := 1 to 5 do begin    if Count=1 then x := 0.25 else x := 0;   // units are fractions of the pie radius    Prov1.AddXY(x, values[Count], Labels[Count], Colours[Count]);    end;  Prov1.Exploded := true; Another remark: Since the identifier smsNone has type TSeriesMarksStyle there is no need to cast it explicitely to this type: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Prov1.Marks.Style := smsNone; // instead of: TSeriesMarksStyle(smsNone);