Page 1 of 1

Get error when trying to set Series17.MultiArea:= maNone

Posted: Wed Feb 13, 2013 1:22 pm
by 16464672
I have created a chart that shows 2 series as Horizontal Areas, and have placed a checkbox on the form to allow the user to selected whether the 2 series be stacked or not; both series are in the same stackgroup. See code below;

procedure TMainForm.CBoxBacklogClick(Sender: TObject);
begin
if MainForm.CBoxBacklog.Checked then Series17.MultiArea:= maStacked
else Series17.MultiArea:= maNone;
end;

Sadly when I attempt to compile this code I get the error

[dcc32 Error] Main.pas(345): E2010 Incompatible types: 'TMultiArea' and 'TMenuAnimations'

for the line else Series17.MultiArea:= maNone;

The compiler happily accepts maStacked so why does it fail on maNone?

Re: Get error when trying to set Series17.MultiArea:= maNone

Posted: Wed Feb 13, 2013 2:34 pm
by yeray
Hi,

It seems there's another type (TMenuAnimations) declaring an enumeration with the same name maNone, and the IDE is taking the first one instead of the second, causing this error.
You can force the second to be used instead of the first by using TMultiArea(maNone) isntead of just maNone.

Re: Get error when trying to set Series17.MultiArea:= maNone

Posted: Wed Feb 13, 2013 2:55 pm
by 16464672
Hi Yeray

Thanks for that; the code now compiles; however, though the series can be stacked, they do not "un stack" when MultiArea is set to TMultiarea(maNone).

I have also called Refresh for the DBChart but without any success.

Please advise.

Many thanks

Rob

Re: Get error when trying to set Series17.MultiArea:= maNone

Posted: Wed Feb 13, 2013 4:22 pm
by yeray
Hi Rob,

This seems to work fine for me here in a simple application with just a chart on the form:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 2 do
  with Chart1.AddSeries(TAreaSeries) as TAreaSeries do
  begin
    FillSampleValues;
    MultiArea:=maStacked;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  (Chart1[0] as TAreaSeries).MultiArea:=TMultiArea(maNone);
end;
Does the above simple example work fine for you?
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.