Hi wpThanks for keeping with me on this; I can appreciate how tough this is. I erased one post that I made prior to finding the FDrawItem pointer. In that post I wrote that I could not reproduce it on a clean project that just created some data in TLineSeries with a dual Y axis as per the tutorial, so I assume I am triggering this in my code somehow. Then I started re-ordering the assignments inside the ClearBounds routine, and the first assignment always triggered the access fault (but only in my big application). Then I saw that FDrawItem wasn't assigned just before the AV.Also in that post : the IDE registers an AV when I load the project. I have not rebuilt the IDE with the modified ClearBounds code.
The steps for my clean program (that always works with 2 Y axes) and my big app were similar
1) I used 2 TLineSeries that are created in the IDE for the Chart, the data is assigned via AddXY(). In the test code this takes place in FormCreate, in the big app it hasn't happened yet. In the big app the TLineSeries data is frequently Cleared and restocked as new data arrives.
2) In the big app FormCreate I trigger a rebuild of the Chart contents, which does the Clear/restock. This is just eye candy to make the Chart look ready to go ... no data is present. I still get the AV after commenting out the rebuild.
The modification to 2 axes in both cases was
a) add another Y axis, Alignment as calRight, set the AxisIndexY for the second LineSeries to be 2 for the new Y axis.
b) test : program runs, but the two axes are the same range, as predicted by tutorial.
c) Drop 2 TChartAxisTransform onto the chart, renamed to LeftAxisTransform & RightAxisTransform. Opened the editor for each, and added a AutoScale element, which were then renamed to LeftAutoscaleTransform and RightAutoscaleTransform
Compile & runs correctly, but the axes remain on same range. If I save, exit, rerun IDE there is no AV triggered during load.
d) Assigned the LeftAxisTransform and RightAxisTransforms to the Transformations property of the original and new Y axes with Chart.
Compiles fine, but triggers the AV. Back in the IDE FDrawData is NIL.
From what I can see, FDrawData is only assigned in the call to the base class TAxisTransform.SetChart().
procedure TAxisTransform.SetChart(AChart: TObject);
begin
if GetDrawDataClass = nil then exit;
FDrawData := DrawData.Find(AChart, Self);
if FDrawData <> nil then exit;
FDrawData := GetDrawDataClass.Create(AChart, Self);
DrawData.Add(FDrawData);
end;