I am however unable to do this at runtime:
As an example, I'd like to shift every TAxisItem of the bottom axis by 0.5 to the right. Please see the following code snippet (in Delphi): It has no effect on the chart. However, All the TAxisItems already report my altered value. Is there something I'm doing wrong? I have a feeling I'm missing some kind of TChartAxis::Invalidate().
Code: Select all
procedure TMyForm.Button1Click(Sender: TObject);
const
someOffset: Single = 0.5;
var
axis: TChartAxis;
axisItem: TAxisItem;
begin
axis := Chart.Axes.Bottom;
for axisItem in axis.Items do
axisItem.Value := axisItem.Value + someOffset;
// This even outputs the new and correct values
for axisItem in axis.Items do
self.Caption := self.Caption + ' ' + axisItem.Value.ToString();
end;