Refreshing while the cursor moves lazarus / 55-TAChart ---------------------------------------------------------------------- Davidous · 2019-07-04 19:20 Hello All! It seems that I always have new questions. I'm working on a MouseMove event. When the cursor is moved a line (that is originally a TPanel) moves with it. My problem is, that it seems to resresh only after a while, until that time I can see many white lines. You can see that on the attached picture. Is there a way to somehow improve the refresh rate of the TPanel and not to see that many white lines? ---------------------------------------------------------------------- RAW · 2019-07-04 20:17 Set the panel to DoubleBuffered:= True; I don't know if I understand this, but maybe you should reconsider the whole design?  by the way: Form.DoubleBuffered:= True or Panel.DoubleBuffered:= True won't help you if there is a serious mistake inside your code ... ---------------------------------------------------------------------- Davidous · 2019-07-04 20:39 Doublebuffered:=True didn't help. I have four synched graphs under each other and when I doubleclick one of them I want a vertical line to appear. It's top is the top of the first graph and it's bottom is the bottom of the fourth graph. Right now this vertical line is that TPanel. I have no better solution so far, but that does not mean, that there is none ---------------------------------------------------------------------- RAW · 2019-07-04 20:59 I can move a panel without problems. Ok, it's not like opengl but no problems at all, so I don't think the panel is the problem. ---------------------------------------------------------------------- Davidous · 2019-07-04 21:36 Thank you for your help. My last try was just to refresh the graphs and it worked! ---------------------------------------------------------------------- lucamar · 2019-07-04 23:05 Have you considered using a less weighty component (a TShape or a TBevel)? Using a panel for this sounds ... wasteful, somehow ---------------------------------------------------------------------- wp · 2019-07-05 08:45 Why don't you use the machinery built into TAChart? Please follow these steps (see attached demo): Add a TConstantLine series to each chart. Set their "LineStyle" to lsVertical, "Position" such that the vertical lines are in the center of the x axis (just a good initial value): in the demo the x axis ranges between 0 and 10, so I put the lines to 5. Set the "Pen.Color" to an appropriate line color.Add a TChartTools component to each chart. Link the "Tools" property of each chart to the corresponding component.Double-click on the first ChartTools component, add a "Data point drag" tool.Set the "Shift" property of the drag tool to an appropriate combination of shift parameters, e.g. [ssLeft, ssCtrl] to activate the tool with the left mouse button while CTRL is pressed.Set the "AffectedSeries" property of the drag tool to the index of the TConstantLine series to avoid unintentional dragging of true data pointsRepeat for the ChartTools component of the 2nd chart.Now you can drag - at runtime - the vertical constant line series by dragging the vertical bar with the left mouse button and holding the CTRL key down. The second bar, however, is not yet synchronizedWrite event handlers for the "OnDrag" event of the drag tool to synchronize the line of the other chart. The handler should also inhibit dragging the vertical line out of the data range. This is how I did it in the demo, you can assign this code to the "OnDrag" event of both drag tools: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.ChartToolset1DataPointDragTool1Drag(  ASender: TDataPointDragTool; var AGraphPoint: TDoublePoint);var  ex: TDoubleRect;begin  // Avoid dragging beyond the chart's axis range  ex := ASender.Chart.LogicalExtent;  if AGraphPoint.X < ex.a.x then    AGraphPoint.X := ex.a.x  else if AGraphPoint.X > ex.b.x then    AGraphPoint.X := ex.b.x;   // Synchronize the position of the ConstantLine series in the other chart.  if ASender.Chart = Chart1 then    Chart2ConstantLine1.Position := AGraphPoint.X  else if ASender.Chart = Chart2 then    Chart1ConstantLine1.Position := AGraphPoint.X;end; ---------------------------------------------------------------------- Davidous · 2019-07-05 23:42 Thank you!