Hi Feng,
To draw a polyline with its fill area, do
polyline->Draw("f");
By default, only the contour is drawn.
Rene Brun
Feng Xiong wrote:
>
> Dear Rooters,
>
> I have a problem with how to fill a polygon with some color. I used
> class TPolyLine to draw the polygon and since TPolyLine is inherited from
> TAttFill, I set its fill color and style as follows:
>
> {
> // A simple macro to test the use of PolyLine
>
> Int_t n=7;
> Float_t x[] = {1,2,3,3,2,1,1};
> Float_t y[] = {4,7,8,6,2,3,4};
>
> c = new TCanvas("c", "Canvas");
> c->Range(0,0,10,10);
>
> TPolyLine *polyLine = new TPolyLine(n, x, y, "F");
> polyLine->SetLineColor(4);
> polyLine->SetFillColor(2);
> polyLine->SetFillStyle(1001);
> polyLine->Draw();
>
> c->Print("polyline.ps");
> }
>
> But it does not work(it only shows the colored line, with no fill
> whatever). Is there some problem with TPolyLine class and is there anyway
> to solve my problem? Many thanks!
>
> Feng
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET