how to color a single point of a lineseries lazarus / 55-TAChart ---------------------------------------------------------------------- frederic · 2017-12-19 16:30 dear specialists i have a lineseries  with  showpoints:=true all these points  have the color defined by pointer.brush i want to change the color of one point of the series differently by code is that possible ? fredreic ---------------------------------------------------------------------- wp · 2017-12-19 16:45 When you add a point to the series by calling the Series' Add or AddXY you can specify its color as a parameter: 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 function Add(AValue: Double; AXLabel: String = ''; AColor: TColor = clTAColor): Integer; function AddXY(AX, AY: Double; AXLabel: String = ''; AColor: TColor = clTAColor): Integer; inline;function AddXY(AX, AY: Double; const AYList: array of Double;  AXLabel: String = ''; AColor: TColor = clTAColor): Integer;  e.g. procedure TForm1.FormCreate(Sender: TObject);begin  Chart1LineSeries1.AddXY(0, 10);  Chart1LineSeries1.AddXY(1, 12);  Chart1LineSeries1.AddXY(2, 11, '', clRed);   // <-- this one will be red  Chart1LineSeries1.AddXY(3, 10);end; If you add points to a TListChartSource the calls are similar 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 function Add(AX, AY: Double; const ALabel: String = ''; AColor: TChartColor = clTAColor): Integer;function AddXYList(AX: Double; const AY: array of Double; const ALabel: String = ''; AColor: TChartColor = clTAColor): Integer; If you pass the points via a UserDefinedChartSource then you specify the color in the parameter AItem: 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 procedure TForm1.UserDefinedChartSource1GetChartDataItem(  ASource: TUserDefinedChartSource; AIndex: Integer; var AItem: TChartDataItem);begin  AItem.X := ;  AItem.Y := ;  if AIndex = 2 then AItem.Color := clRed;      // Force point with index 2 to be red.end; ---------------------------------------------------------------------- frederic · 2017-12-19 20:30 thanks wp, so ,when i start with 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 procedure TForm1.FormCreate(Sender: TObject);begin  Chart1LineSeries1.AddXY(0, 10);  Chart1LineSeries1.AddXY(1, 12);  Chart1LineSeries1.AddXY(2, 11);  Chart1LineSeries1.AddXY(3, 10);end;    //an change color by buttonclickprocedure TForm1.Button1Click(Sender: TObject);begin Chart1LineSeries1.AddXY(2, 11, '', clRed);   // <-- this one will be redend;   // and back procedure TForm1.Button2Click(Sender: TObject);begin Chart1LineSeries1.AddXY(2, 11);  // back to the original color settingend;                                   that's simple; only overwriting i hope this is also valid when drag  this specific point; we are going to test it frederic ---------------------------------------------------------------------- wp · 2017-12-19 21:19 Hmmm..., looks strange. In FormCreate you add a point at x=2, y=11 in normal color. In Button1Click you add another point at the same location in red color, and in Button2Click you add another one, now in normal color again. In the end you'll have multiple points at the same location. I guess this is not what you want. In order to colorize an already existing point you should use the method SetColor which is available for most series; it gets the point index and the new color as parameters. If the new color is clDefault (or clTAColor) then the color is restored to the series color. See attached demo. ---------------------------------------------------------------------- frederic · 2017-12-20 08:44 wp, yes, i misinterpreted your answer addxy means :adding a new point(although it has the same xyvalues ),and not replace this explains much of the troubles i got. so dragging is also not a problem anymore because the pointindex is the reference for color modifications of points thanks for leading me out of the tunnel frederic