Page 1 of 1

I can not remove the shadow (marks)

Posted: Mon Jun 13, 2011 5:49 pm
by 16858904
The shadow of the marks does not work on DBChart (TeeChart Standard v2011 VCL - Delphi 7)

At runtime:

/ / does not work
MyDBChart.Series [0]. Marks.Shadow.Visible: = False;

/ / does not work
MyDBChart.Series [0]. Marks.Shadow.Transparency: = 100;

/ / This works fine
MyDBChart.Series [0]. Marks.FontSeriesColor: = True;

How do I remove the shadow?

Re: I can not remove the shadow (marks)

Posted: Wed Jun 15, 2011 9:18 am
by yeray
Hello Pense,

I'm not able to reproduce the problem here. Are you using the latest version available (v2011.03.30407)?
The three lines you mentioned seem to work as expected for me here with a TPointSeries and a TBarSeries.

Re: I can not remove the shadow (marks)

Posted: Thu Jun 16, 2011 4:18 am
by 16858904
Oi Yeray,

Obrigado por responder ao meu post. O cenário do meu problema é o seguinte:

No formulário eu tenho um Button e um DBChart apenas, além de 3 procedimentos. O problema todo foi provocado por um pequeno algoritmo no evento OnShow do formulário que oculta todas as Marks cujo valor seja igual a zero (YValue = 0).

procedure TForm1.FormCreate(Sender: TObject);
begin
(DBChart1.AddSeries(TBarSeries) as TBarSeries).FillSampleValues();
end;

procedure TForm1.FormShow(Sender: TObject);
var i: integer;
begin
// exemplo
DBChart1.Series[0].YValue[1]:= 0;

// após executar este algoritmo, o evento do botão deixa de funcionar
// Exit;
with DBChart1.Series[0] do
for i:= 0 to (Count-1) do
Marks.Visible:= YValue>0;
end;

// Evento atribuído ao botão (TButton) que está no Formulário
procedure TForm1.BtnShadowClick(Sender: TObject);
begin
with DBChart1.Series[0].Marks.Shadow do
Visible:= not Visible;
end;

Re: I can not remove the shadow (marks)

Posted: Thu Jun 16, 2011 8:51 am
by narcis
Hi Pense,

I could reproduce the issue here now and added it (TV52015618) to the defect list to be investigated. As an alternative, there's a much easier way to hide marks which is using the OnGetMarkText event as shown here:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBChart1.AddSeries(TBarSeries.Create(Self)).FillSampleValues;
  DBChart1[0].OnGetMarkText := Series1GetMarkText;
end;

procedure TForm1.FormShow(Sender: TObject);
//var i: integer;
begin
  DBChart1[0].YValue[1]:= 0;

  //Hidding Marks with Y = 0 in loop below makes marks shadow not responsive
  //Exit;
  {with DBChart1[0] do
    for i:= 0 to (Count-1) do
      Marks[i].Visible:= YValue[i]>0;
  }
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with DBChart1[0].Marks.Shadow do
    Visible:= not Visible;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  if MarkText=IntToStr(0) then MarkText:='';
end;
Doing so marks shadow visibility can be toggled.

Hope this helps!

Re: I can not remove the shadow (marks)

Posted: Thu Jun 16, 2011 1:46 pm
by 16858904
Oi Narcís,

Sim, está resolvido. Muito obrigado!

Ficou assim:

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
ValueIndex: Integer; var MarkText: String);
begin
if Sender.YValue[ValueIndex] = 0 then
MarkText:='';
end;