Hello,
Look at the TCustom3DGridSeries.SetValue procedure:
Code: Select all
procedure TCustom3DGridSeries.SetValue(X, Z: Integer;
const Value: TChartValue);
var tmp : Integer;
begin
if IDirtyGrid then
AddXYZ(x,Value,z)
else
begin
tmp:=GridIndex[x,z];
if tmp<>-1 then YValues.Value[tmp]:=Value
else GridIndex[x,z]:=AddXYZ(x,Value,z);
end;
end;
It calls AddXYZ when it doesn't find a value at the given [X, Z] point.
Note GridIndex may not have index 0 populated; so the way to manipulate it would be:
Code: Select all
var i, tmpMinX, tmpMinZ: Integer;
begin
tmpMinX:=Round(Series1.XValues.MinValue)-1;
tmpMinZ:=Round(Series1.ZValues.MinValue)-1;
for i:=0 to Series1.Count-1 do
Series1.Value[ Round(Series1.XValues.Value[i])-tmpMinX,
Round(Series1.ZValues.Value[i])-tmpMinZ]:=random*1.5-0.5;
end;
ix07 wrote:Is there no way to only update the color values of a grid?
If you want use the ColorRange feature, so to change the colors manipulating the YValues, you can call this after manipulating the
Value array as in the snipped above to force the series to be redrawn:
Code: Select all
Series1.RefreshSeries;
Series1.Repaint;
To directly assign a color in a series point, in general you should set the ValueColor array. Ie:
Code: Select all
var i, tmpMinX, tmpMinZ: Integer;
begin
for i:=0 to Series1.Count-1 do
begin
Series1.ValueColor[i]:=RGB(round(random*255), round(random*255), round(random*255));
end;
end;