Uwe Heim-Bertgen
Uwe Heim-Bertgen

Reputation: 1

TChart ColorBand is being compressed when dragged beyond current chart area

A ColorBand (ChartTool) assigned to Bottom axis on a TChart Component will be compressed when beeing dragged beyond start or end of Bottom axis. ColorBand.StartValue and ColorBand.Endvalue will both take either Start- or Endvalue of Bottom Axis.

Earlier versions of Chart used to preserve the Start- And EndValues of Colorbands, even if the Bands were not visible within the current Bottom axis area.

Upvotes: 0

Views: 42

Answers (1)

Yeray
Yeray

Reputation: 5039

As explained at #2698, that change was part of a bug fix and from TeeChart v2023.38 you should set the NoLimitDrag property of the TColorLineTools to True. Ie:

uses Chart, Series, TeeTools;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);

  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;
    Color:=clWhite;
    Gradient.Visible:=False;
    Walls.Back.Color:=clWhite;
    Walls.Back.Gradient.Visible:=False;
    Legend.Hide;
    View3D:=False;

    with TPointSeries(AddSeries(TPointSeries)) do
    begin
      FillSampleValues(100);
      Pointer.Size:=2;
    end;

    with TColorBandTool(Tools.Add(TColorBandTool)) do
    begin
      Axis:=Axes.Bottom;
      StartValue:=20;
      EndValue:=70;
      StartLine.NoLimitDrag:=True;
      EndLine.NoLimitDrag:=True;
    end;
  end;
end;

Note the NoLimitDrag property of the TColorLineTool(s) inside the TColorBandTool is False by default.
Before v2023.38 setting those NoLimitDrag properties to False/True made no difference, and you could still drag the ColorBand out of the chart without limits.
From TeeChart v2023.38, NoLimitDrag property is considered. As per default, False, those ColorLine values are limited to the bounds of the chart. However, setting the NoLimitDrag property to True does change that behaviour, and you can then drag the ColorBand outside the chart bounds without limits.

Upvotes: 0

Related Questions