Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

TeeChartPro usage

edited January 2010 in General
Hello,
I'm testing TeeChartPro 8.04 for Delphi 2007 + RB. Right now I'm working on
some reports for statistics and am having doubts about what I'm getting as a
result.

Looking here
http://www.steema.com/uploads/gallery/BarSeries_thumb.jpg
http://www.steema.com/uploads/gallery/PieExploded_tmb.png
http://www.steema.com/uploads/gallery/pieTranparency.png

I would say those are pretty nice looking charts, but that's not what I'm
getting while designing them within RB with the current versions I have.
The charts I'm creating are far from the look of those above. Ok, I'm not
the best designer for sure, but the difference is just too big.

Is there anything special which needs to be done to get such charts as in
the screenshots? Any units, settings, packages etc...

The setting dialog, which appears when editing a chart within a report,
seems not to save the values sometimes.
I saw there is a ChartEditor component, which offers a different settings
dialog, right? Within IDE I can insert only a DBChart, while whithin the
report I can insert a ppDPTeeChart. Where is the difference?

Also within Delphi I can set the language and some other options, which I
seem not to be able to set for the ppDPTeeChart within the report.

Am I doing anything wrong?

Regards,
Mark

Comments

  • edited January 2010
    Hi Mark,

    The TeeChart component is simply a wrapper to the actual TChart component in
    Delphi. The editor used inside the report is identical to the one used on a
    for in the VCL so theoretically anything you can do with a TeeChart in
    Delphi, you can do in ReportBuilder.

    I suggest taking a look at the demos provided with TeeChart and/or
    contacting their support on how to create the advanced charts shown on their
    web site. If there is a limitation with creating such charts from within
    the report, take a look at the following article to work around the issue.

    http://www.digital-metaphors.com/rbWiki/RCL/Chart/How_To...Chart_As_Image

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    Mark:

    I do quite a bit with TeeChart in my app and in reports.

    First, the images you are seeing--I believe they are for the next version of
    TeeChart (version 2010, which they just annouced the beta for:
    http://www.steema.com/entry/15) or the .NET version. The images apper to use
    OpenGL or .NET technology (I belive .NET has its own technology).

    Second, if your charts appear in your app and in your software, you might
    consider just using the chart in your app--and rendering images from there
    for the reports. This is because there are ***a lot**** of configuration
    options in the chart, and getting one configured is difficult
    enough--keeping them looking the same can be a lot of work.

    Even if this is not for you, invariable I post this and someone wants more
    information on the "how do I do this"--so here are some codes snippets:

    To do this, I get the the images from the report (after loading the report
    from a database)--with some conditions that allow me to have images in the
    report that do not get overwritten:

    for I := ComponentCount-1 downto 0 do
    if (Components[I] is TppImage) then
    begin
    lImg := TppImage(Components[I]);
    if (not (lImg.Band is TppPageStyle)) then
    begin
    if (not SameText(Copy(lImg.UserName, 1, 5), 'image')) and
    (Pos('COVER', UpperCase(lImg.UserName)) = 0) then
    begin
    lReportGraphic := TReportGraphic.Create(lImg.UserName,
    {FReportSetup.AutoScale,} lImg);
    lReportGraphic.Rect := Rect(1, 1, Trunc(lImg.spWidth),
    Trunc(lImg.spHeight));
    lImageLst.Add(lReportGraphic);
    end;
    end;
    end;

    I then send the list out to the programs and compare the list of
    TReportGraphic names against the name of the chart. If it is a match, I
    call:

    AssignChartToGraphic(lChart, lRG.Rect, lRG.Graphic);

    I then assign send the TReportGraphicList to the program to get the images.
    I use the name of the image to determine which chart's image gets assigned
    the TReportGraphic. Here is the code for assigning the TChart's image to the
    TReportGraphic.Bitmap or Metafile

    procedure AssignChartToGraphic(aChart: TChart; const aRect: TRect;
    aGraphic: TGraphic);
    var
    lHoldShadow: boolean;
    I: Integer;
    lBoolArray: array of boolean;
    lHoldBevel: TPanelBevel;
    lHoldColor: TColor;
    lHoldGradientVisible: boolean;
    lMetafile: TMetafile;
    lBmp: TBitmap;
    begin

    lHoldGradientVisible := aChart.Gradient.Visible;
    lHoldColor := aChart.Color;
    lHoldBevel := aChart.BevelOuter;
    lHoldShadow := aChart.Shadow.Visible;

    try
    SetLength(lBoolArray, aChart.SeriesCount);
    for I := 0 to aChart.SeriesCount - 1 do // Iterate
    if aChart.Series[I] is TPieSeries then
    begin
    lBoolArray[I] := TPieSeries(aChart.Series[I]).Circled;
    TPieSeries(aChart.Series[I]).Circled := True;
    end
    else
    lBoolArray[I] := True;

    aChart.Gradient.Visible := false;
    aChart.Color := clWhite;
    aChart.BevelOuter := bvNone;
    aChart.Shadow.Visible := False;

    if aGraphic is TMetafile then
    begin
    lMetafile := aChart.TeeCreateMetafile(false, aRect);
    try
    aGraphic.Assign(lMetafile);
    finally
    lMetafile.Free;
    end;
    end
    else
    begin
    lBmp := aChart.TeeCreateBitmap(clWhite, aRect);
    try
    aGraphic.Assign(lBmp);
    finally
    lBmp.Free;
    end;
    end;
    finally
    aChart.Shadow.Visible := lHoldShadow;
    aChart.Gradient.Visible := lHoldGradientVisible;
    aChart.Color := lHoldColor;
    aChart.BevelOuter := lHoldBevel;
    for I := 0 to aChart.SeriesCount - 1 do // Iterate
    if aChart.Series[I] is TPieSeries then
    TPieSeries(aChart.Series[I]).Circled := lBoolArray[I];
    end;
    end;

    Finally, I assign the images back to the TppImages in the reports:

    for I := 0 to lImageLst.Count - 1 do // Iterate
    begin
    lItem := lImageLst[I];
    lImg := lItem.Image as TppImage;
    lImg.Stretch := True;
    if lItem.UseBitmap then
    lImg.Picture.Bitmap.Assign(lItem.Bitmap)
    else
    if (lItem.Metafile.Width > 0) then
    lImg.Picture.Metafile.Assign(lItem.Metafile);
    end; // for

    Hope that helps.

    Ed Dressel


  • edited January 2010
    Thanks Nico,
    I will see, what I can achieve. Just thought there is something special to
    do to get it to work better / properly.

    Mark

  • edited January 2010
    Hi Ed,
    thanks a lot for the detailed reply and the code snippets! I well see, if I
    can make use of it :)

    Since you are doing a lot with TeeChart I still would like to ask, if you
    were / are having problems with some setting not being saved sometimes?
    Within the report that is.
    Looks as if there is a certain order of what can be changed after what and
    what prevents changing of other options etc., but somehow I still didn't
    figure out how this works (if that's the case at all).

    One of the examples:
    the round border of the marks on a pie chart isn't being saved. We change it
    from 16 to 8, save and once we open the settings dialog again, the value is
    16 again. The same for some gradient values etc.

    Maybe you know, what the reason is.

    Mark


  • edited January 2010
    > Looks as if there is a certain order of what can be changed after what and

    Never seen anyting like this--but they have good support (I have the pro
    version--their 2010 version looks very promising).

    Ed Dressel
  • edited January 2010
    Ok,
    thank you.

This discussion has been closed.