TeeChart Pro 2013 and TDottedGrayPen

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Errol
Newbie
Newbie
Posts: 75
Joined: Thu Jul 11, 2013 12:00 am

TeeChart Pro 2013 and TDottedGrayPen

Post by Errol » Mon Feb 17, 2014 4:52 am

I have recently upgraded from TeeChart 8 to TeeChart 2013. I now have a problem with the Get_DottedGrayPen in the following code. Grid is now interpreted as TAxisGridPen, not TDottedGrayPen.

Code: Select all

procedure TformMultipleUnitPrint.Get_AxisTicks(doc:TDOMDocumentXPath;sprefix:string;
  aAxis:TChartAxis);

const
  sGRIDCENT = '/ticks/gridcentered';
  sTICKLEONLY = '/ticks/tickonlabelsonly';
  sTICKLEN = '/ticks/ticklength';
  sTICKINNERLEN = '/ticks/tickinnerlength';

begin
  with aAxis do
  begin
    GridCentered := XMLReadBoolean(doc,sPrefix+sGRIDCENT,GridCentered);
    TickOnLabelsOnly:=XMLReadBoolean(doc,sPrefix+sTICKLEONLY,TickOnLabelsOnly);
    TickLength := XMLReadInteger(doc,sPrefix+sTICKLEN,TickLength);
    TickInnerLength:=XMLReadInteger(doc,sPrefix+sTICKINNERLEN,TickInnerLength);
    Get_ChartAxisPen(doc,sPrefix+'/ticks/axis',Axis);
    Get_DottedGrayPen(doc,sPrefix+'/ticks/grid',Grid);    /// <<< Problem here >>>
    Get_DarkGrayPen(doc,sPrefix+'/ticks/ticksmain',Ticks);
    Get_DarkGrayPen(doc,sPrefix+'/ticks/ticksinner',TicksInner);
  end;
end;

procedure TformMultipleUnitPrint.Get_DottedGrayPen(doc:TDOMDocumentXPath;sP:string;
  aPen:TDottedGrayPen);

const
  sCOL = '/colour';
  sENDSTYLE = '/endstyle';
  sSMALLDOTS = '/smalldots';
  sSTYLE = '/style';
  sVISIBLE = '/visible';
  sWIDTH = '/width';

var
  sResult : string;

begin
  with aPen do
  begin
    Visible := XMLReadBoolean(doc,sP+sVISIBLE,Visible);
    SmallDots := XMLReadBoolean(doc,sP+sSMALLDOTS,SmallDots);
    Width := XMLReadInteger(doc,sP+sWIDTH,Width);
    Color := XMLReadColor(doc,sP+sCOL,Color);

{** end style}
    sResult := ReturnXResult(doc,sP+sENDSTYLE);
    if (sResult <> '') then
    begin
      if (sResult = 'esRound') then
        EndStyle := esRound
      else if (sResult = 'esSquare') then
        EndStyle := esSquare
      else if (sResult = 'esFlat') then
        EndStyle := esFlat;
    end;

{** style}
    sResult := ReturnXResult(doc,sP+sSTYLE);
    if (sResult <> '') then
    begin
      if (sResult = 'psSolid') then
        Style := psSolid
      else if (sResult = 'psDash') then
        Style := psDash
      else if (sResult = 'psDot') then
        Style := psDot
      else if (sResult = 'psDashDot') then
        Style := psDashDot
      else if (sResult = 'psDashDotDot') then
        Style := psDashDotDot
      else if (sResult = 'psClear') then
        Style := psClear
      else if (sResult = 'psInsideFrame') then
        Style := psInsideFrame;
    end;
  end;
end;


Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeChart Pro 2013 and TDottedGrayPen

Post by Yeray » Mon Feb 17, 2014 10:50 am

Hello Errol,

It would be helpful if you could simplify it to the maximum, but still in a project you can send us and we can run as-is to reproduce the problem here.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Errol
Newbie
Newbie
Posts: 75
Joined: Thu Jul 11, 2013 12:00 am

Re: TeeChart Pro 2013 and TDottedGrayPen

Post by Errol » Mon Feb 17, 2014 8:39 pm

As I did not write this code and am not familiar with this part of TeeChart, it will take much work to write a test program that reproduces this error. This code worked with TeeChart 8 and now doesn't work with TeeChart 2013. It appears that Grid is now interpreted as a property of TAxisGridPen whereas formerly it must have been interpreted as a property of TDottedGrayPen. Has there been a change of properties for these classes?

I have simplified the problem code and copied it below.

Code: Select all

procedure TformMultipleUnitPrint.Get_AxisTicks(doc:TDOMDocumentXPath;sprefix:string;
  aAxis:TChartAxis);

begin
  with aAxis do
    Get_DottedGrayPen(doc,sPrefix+'/ticks/grid',Grid);  // this line fails because Grid is not  a TDottedGrayPen type
end;

procedure TformMultipleUnitPrint.Get_DottedGrayPen(doc:TDOMDocumentXPath;sP:string;
  aPen:TDottedGrayPen);

begin
// code
end;

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart Pro 2013 and TDottedGrayPen

Post by Narcís » Wed Feb 19, 2014 3:07 pm

Hi Errol,

Both classes, TDottedGrayPen and TAxisGridPen inherit from TTeePen. Just change TformMultipleUnitPrint.Get_DottedGrayPen signature so that aPen is a TAxisGridPen instance. For example:

Code: Select all

procedure TformMultipleUnitPrint.Get_DottedGrayPen(doc:TDOMDocumentXPath;sP:string;
  aPen:TAxisGridPen);

begin
// code
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Errol
Newbie
Newbie
Posts: 75
Joined: Thu Jul 11, 2013 12:00 am

Re: TeeChart Pro 2013 and TDottedGrayPen

Post by Errol » Wed Feb 19, 2014 7:56 pm

Narcis - your suggested change seems to have fixed the problem as the code now compiles. Thanks.

Post Reply