I have this code being part of an indicator for NT7.
The code centers the chart within the chart window so that the last price is at y/2 of the chart.
private void CentrePrice_Click(object sender, EventArgs e)
{ double yAxisSize;
if (this.ChartControl.YAxisRangeTypeRight == YAxisRangeType.Fixed)
{yAxisSize = this.ChartControl.FixedPanelMaxRight -
this.ChartControl.FixedPanelMinRight;
}
else
{this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
yAxisSize = this.ChartControl.Bounds.Height * TickSize / yAxisPixelsPerTick;
}
double center = this.GetCurrentBid();
if (CurrentBar != this.LastBarIndexPainted)
center = Close[CurrentBar - this.LastBarIndexPainted];
this.ChartControl.FixedPanelMaxRight = center + (yAxisSize / 2);
this.ChartControl.FixedPanelMinRight = center - (yAxisSize / 2);
ChartControl.ChartPanel.Invalidate();
}
NT8 does not contain the NT7 ChartControl functions:
ChartControl.YAxisRangeTypeRight,
YAxisRangeType.Fixed
ChartControl.FixedPanelMaxRight
ChartControl.Bounds.Height
yAxisPixelsPerTick
Is there a way to code this in NT8?
Thanks

Comment