Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default postscript piechart

Hello
i'm new to postscript lang and have a code of piechart which is in grey
color. i wanted to make pie chart in color. Here i'm attaching code wat
i written for grey piechart. plz find me solution for this.
Regards

/pidict 10 dict def
pidict begin
/DrawSlice
{ /shade exch def
/end exch def
/start exch def
/label exch def
newpath 0 0 moveto
0 0 radius start end arc
closepath

gsave
shade setgray
fill
grestore
stroke

gsave
start end add 2 div rotate
radius 0 translate
%newpath
%0 0 moveto labelps .8 mul 0 lineto stroke
%labelps 0 translate
0 0 transform
grestore

itransform
/y exch def /x exch def
x y moveto
%x 0 lt
{ label stringwidth pop neg 0 rmoveto }
%if
%y 0 lt { 0 labelps neg rmoveto }
label show
} def

/findgray
{ /i exch def /n exch def
i 2 mod 0 eq
{ i 2 div n 2 div round add n div }
{ i 1 add 2 div n div }
ifelse
} def
%end

/drw-pi
{ pidict begin
/radius exch def
/ycenter exch def /xcenter exch def
/PieArray exch def
/labelps exch def
/title exch def
%gsave
xcenter ycenter translate

%/Helvetica findfont titleps scalefont setfont

%title stringwidth pop 2 div neg radius neg
%titleps 3 mul sub moveto
%title show
/Helvetica findfont labelps scalefont setfont
/nums PieArray length def
/slicecnt 0 def
/curangle 0 def
PieArray

{ /ary exch def
ary aload pop
/per exch def
/label exch def
/perangle per 360 mul def
/slicecnt slicecnt 1 add def
label curangle curangle perangle add
nums slicecnt findgray DrawSlice
/curangle curangle perangle add def
} forall
grestore
end
} def

(pie-chart) 10 12
[
[(AAA) .12 ]
[(BBB) .10 ]
[(CCC) .22 ]
[(DDD) .16 ]
[(EEE) .04 ]
[(FFF) .08 ]
[(GGG) .10 ]
[(HHH) .18 ]
] 306 396 140 drw-pi
showpage

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 329
Default postscript piechart

Hi vijay,

Try asking in comp.lang.postscript. You're much more likely to get help
there than in an Excel forum.

As it is, your code looks like its little more than a slightly touched-up
copy & paste from Program 14 in the Postscript 'Tutorial and Cookbook'.

Hint: lookup setgray, setrgbcolor, sethsbcolor, setcmykcolor, setcolor, and
setpattern in the PostScript 'Language Reference' manual.

Cheers

--
macropod
[MVP - Microsoft Word]


"vijay" wrote in message
oups.com...
Hello
i'm new to postscript lang and have a code of piechart which is in grey
color. i wanted to make pie chart in color. Here i'm attaching code wat
i written for grey piechart. plz find me solution for this.
Regards

/pidict 10 dict def
pidict begin
/DrawSlice
{ /shade exch def
/end exch def
/start exch def
/label exch def
newpath 0 0 moveto
0 0 radius start end arc
closepath

gsave
shade setgray
fill
grestore
stroke

gsave
start end add 2 div rotate
radius 0 translate
%newpath
%0 0 moveto labelps .8 mul 0 lineto stroke
%labelps 0 translate
0 0 transform
grestore

itransform
/y exch def /x exch def
x y moveto
%x 0 lt
{ label stringwidth pop neg 0 rmoveto }
%if
%y 0 lt { 0 labelps neg rmoveto }
label show
} def

/findgray
{ /i exch def /n exch def
i 2 mod 0 eq
{ i 2 div n 2 div round add n div }
{ i 1 add 2 div n div }
ifelse
} def
%end

/drw-pi
{ pidict begin
/radius exch def
/ycenter exch def /xcenter exch def
/PieArray exch def
/labelps exch def
/title exch def
%gsave
xcenter ycenter translate

%/Helvetica findfont titleps scalefont setfont

%title stringwidth pop 2 div neg radius neg
%titleps 3 mul sub moveto
%title show
/Helvetica findfont labelps scalefont setfont
/nums PieArray length def
/slicecnt 0 def
/curangle 0 def
PieArray

{ /ary exch def
ary aload pop
/per exch def
/label exch def
/perangle per 360 mul def
/slicecnt slicecnt 1 add def
label curangle curangle perangle add
nums slicecnt findgray DrawSlice
/curangle curangle perangle add def
} forall
grestore
end
} def

(pie-chart) 10 12
[
[(AAA) .12 ]
[(BBB) .10 ]
[(CCC) .22 ]
[(DDD) .16 ]
[(EEE) .04 ]
[(FFF) .08 ]
[(GGG) .10 ]
[(HHH) .18 ]
] 306 396 140 drw-pi
showpage



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-resizing problem - piechart protist Charts and Charting in Excel 0 June 13th 05 11:48 PM
how do I export an Excel graph to an encapsulated postscript (.ep. Fred Charts and Charting in Excel 1 January 12th 05 03:43 AM


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"