Patterns to fill pie areas

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Patterns to fill pie areas

Post by SIRIUS » Mon Mar 02, 2009 3:54 pm

How can we DEFINE and select the patterns to fill pie areas using TeeChart Pro 7.0. The printer we use forces monochromatic images and we need to define 13 different styles to fill (shading patterns and cross-hatch patterns).
We need an answer as soon as possible because our customer wants to print tomorrow.

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

Post by Narcís » Mon Mar 02, 2009 4:21 pm

Hi SIRIUS,

I'm afraid it's not possible to define different brush style/pattern for each pie slice in a pie series.
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

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

Post by Narcís » Mon Mar 02, 2009 4:48 pm

Hi SIRIUS,

Sorry but a colleague pointed me out that it is possible to set a different pattern for each slice as shown in the code below. However, it's not possible to set different patterns and colors at the same time.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
  Series1.ColorEachPoint:=false;
end;

function TForm1.Series1BeforeAdd(Sender: TChartSeries): Boolean;
begin
  if Series1.Count>0 then
    if Series1.Count=1 then
    begin
       Series1.UsePatterns := true;
       Chart1.Canvas.Brush.Color := clblue;
       Chart1.Canvas.Brush.Style := bsDiagCross;
    end;
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

SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Post by SIRIUS » Mon Mar 02, 2009 9:20 pm

Thanks Narcis for your quick answer.
We need to compose the pie as showed in the figure below keeping the sequence 1,2 3 4 etc. with the showed styles. It is possible ?
Image

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

Post by Narcís » Tue Mar 03, 2009 11:06 am

Hi Sirius,

You can set slices with different patterns using code below but you can't specify which pattern will be used.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
Series1.ColorEachPoint := false;
Series1.UsePatterns := true;
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

SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Post by SIRIUS » Tue Mar 03, 2009 1:52 pm

We have verified that after six patterns your sw repeats the same styles. We need to show a pie with 13 different styles in a monochromatic way (no color) and with styles mentioned below:
- Solid color white
- Cross
- Cross small
- Diagonal
- Gray (20%)
- Back diagonal
- Gray (40%)
- Gray (10%)
- Gray (60%)
- Gray (80%)
- Cross diagonal
- Diagonal small
- Solid black

Is that possible or even more to increase up to 20 different styles for a pie with 20 slices ?

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

Post by Narcís » Tue Mar 03, 2009 3:50 pm

Hi Sirius,

The only option would be being a TeeChart source code customer and modify where brushes are assigned. The problem is that graphics.pas there are less brush styles defined than what you request:

Code: Select all

  TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical,
    bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);
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

SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Post by SIRIUS » Wed Mar 04, 2009 4:32 pm


SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Post by SIRIUS » Thu Mar 05, 2009 6:13 pm

We need an asnwer to our inquiry dated yesterday as sson as possíble because our customer is waiting for the soltion to build a pie with 13 different patterns according to the sample sent to you on March 2th.
The hard code we have tried did not work !!

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

Post by Yeray » Mon Mar 09, 2009 1:40 pm

Hi Sirius,

Excuse us for the delay. We've been doing some tests and finally noticed that this solution works fine in 2D pies but not for 3D. So we'll try to solve it for further releases.
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

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

Post by Narcís » Wed Mar 11, 2009 11:44 am

Hi Sirius,

As an update, we have added support for using brush images in 3D too so in next v8 maintenance release code below will work fine.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, TeeComma;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TPieSeries;
    TeeCommander1: TTeeCommander;
    procedure FormCreate(Sender: TObject);
    procedure Chart1AfterDraw(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  TPieSeriesAccess=class(TPieSeries);
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(10);
  Series1.UsePatterns := true;
  Series1.ColorEachPoint := false;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var b : TBitmap;
begin
  Chart1.Canvas.Brush.Color := clRed;
  Chart1.Canvas.Brush.Style := bsFDiagonal;
  TPieSeriesAccess(Series1).DrawPie(2);
  b := TBitmap.Create();
  b.LoadFromFile('C:\temp\Copy.bmp');
  Chart1.Canvas.Brush.Bitmap := b;
  TPieSeriesAccess(Series1).DrawPie(8);
  Chart1.Canvas.Brush.Color := clyellow;
  Chart1.Canvas.Brush.Style := bsSolid;
  TPieSeriesAccess(Series1).DrawPie(5);
end;

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

SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Define the pie size (diameter)

Post by SIRIUS » Wed Mar 25, 2009 9:26 pm

Thanks for the answer about the previous question.
We need to build pies with the same diameter even if the labels used for the areas and the areas sizes are differents. How can do it ? See the following figures Image and
Image

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

Post by Yeray » Thu Mar 26, 2009 9:56 am

Hi Sirius,

Are your different pies in different charts or in the same?
Having multiple pies in the same chart, all them should have the same radius.

Anyway, have you tried these properties?

Code: Select all

Series1.CustomXRadius := 50;
Series1.CustomYRadius := 50;
Series1.Circled := true;
Finally, you may be interested in looking at the demo at All features/Chart styles/Standard/Pie/Multiple Pies
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

SIRIUS
Newbie
Newbie
Posts: 9
Joined: Wed Jan 05, 2005 5:00 am
Location: brasil
Contact:

Post by SIRIUS » Thu Mar 26, 2009 11:38 am

I apologize for the mistake attaching the figures.
The figure of the pies generated using your sw is the following one:
Image
where we can see that in oder to place the labels, the pie size is reduced. The customer wants that all pies have the same radio in an independet way of the label sizes.
We will try with your explanation.
Thanks a lot.

Post Reply