I have an PA chart containing two pens in a pane.
When I use the box zoom, ONLY the active pen Y-axis is adjusted.
before box zoom:
after box zoom:
now the data from the first pen is visualized wrong.
I have made an autoscale cicode which corrects this (after pushing the magnification button top right
)
FUNCTION PAAutoScale_bak( STRING sPAName = "", INT nPane = 1)
OBJECT hPen1;
OBJECT hPen2;
OBJECT hAnalyst;
OBJECT hPanes;
OBJECT hPane;
OBJECT hPens;
STRING sPVMax;
STRING sPVMin;
REAL rPVMax;
REAL rPVMin;
REAL rSpanHi;
REAL rSpanLo;
hAnalyst = ObjectByName(sPAName);
hPanes = _ObjectGetProperty(hAnalyst,"Panes");
hPane = _ObjectCallMethod(hPanes,"get_Item",nPane);
hPens = _ObjectGetProperty(hPane,"Pens");
hPen1 = _OBJECTCallMethod(hPens, "get_item", 1);
hPen2 = _OBJECTCallMethod(hPens, "get_item", 2);
sPVMax = _ObjectCallMethod(hPen1, "GetStatistic", "Maximum");
sPVMin = _ObjectCallMethod(hPen1, "GetStatistic", "Minimum");
IF StrToReal(sPVMin) < 400 THEN
sPVMin = "400";
END
rPVMax = StrToReal(sPVMax);
rPVMin = StrToReal(sPVMin);
rSpanHi = rPVMax + (rPVMax-rPVMin)*0.2;
rSpanLo = rPVMin - (rPVMax-rPVMin)*0.2;
// Message window voor Max - Min waarden
STRING strMessage;
STRING sNewLine = "^n";
STRING ScaleMax = rSpanHi;
STRING ScaleMin = rSpanLo;
strMessage="Max: " + sPVMax + sNewLine + "Min: " + sPVMin + sNewLine + "Scale Max: " + ScaleMax + sNewLine + "Scale Min: " + ScaleMin;
//Message("Info Scales", strMessage,32);
_OBJECTCallMethod(hPen1, "PutVerticalAxisSpan", rSpanLo, rSpanHi);
_OBJECTCallMethod(hPen2, "PutVerticalAxisSpan", rSpanLo, rSpanHi);
END
this corrects the Y-axis scale for both pens like:

Is there a way to trigger the code to be run after the box zoom event?
I do not want to trigger this 'scaling' code every x seconds to correct the Y-axis.
If anyone knows how to do this, much appreciated.

