From a7553dae596be94abc6b71964d4383667f04b8e2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 23 Jul 2008 22:07:17 +0000 Subject: pstricks-add (18jul08) git-svn-id: svn://tug.org/texlive/trunk@9735 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/pstricks-add/pstricks-add.tex | 882 +++++++++++++++------ 1 file changed, 656 insertions(+), 226 deletions(-) (limited to 'Master/texmf-dist/tex/generic/pstricks-add') diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index b4af4db6b5d..635b5af75d3 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 25 2008-06-06 10:33:45Z herbert $ +%% $Id: pstricks-add.tex 37 2008-07-11 13:39:23Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -29,8 +29,8 @@ \ifx\MultidoLoaded\endinput\else \input multido \fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi % -\def\fileversion{3.05} -\def\filedate{2008/06/12} +\def\fileversion{3.07} +\def\filedate{2008/06/30} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -163,6 +163,9 @@ \global#2=\the\pst@dimm% \endgroup% } +\def\pst@int#1{\expandafter\pst@@int#1..\@nil} +\def\pst@@int#1.#2.\@nil{#1} + % %--------------------------------------- small stuff ------------------------------- \define@boolkey[psset]{pstricks-add}[Pst@]{CMYK}[true]{} @@ -274,6 +277,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Begin patch TN; Date (YY-MM-DD): 04-07-17; 2nd part \def\psls@dashed{% + \psk@linecap\space setlinecap \ifpsdashadjust [ \psk@dash ] \pst@linetype\space \tx@DashLine \else @@ -1330,14 +1334,86 @@ %%%%%%%%%%% %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% Euclide Algorithm (macro by Jean-Come Charpentier) +% #1 : numerator (number.unit) (e.g. 4.\pi or 3.\ell or 12.a) +% #2 : denominator +\def\psIrFrac#1#2{{% + % extrait le num'erateur et l'unit'e + \ps@extract@unit#1\@nil + % d'enominateur + \pst@cntb=#2\relax + \pst@cntc=\@ne + % test du signe et op'erandes toutes positives + \ifnum\pst@cnta<\z@ + \pst@cntc=-\pst@cntc + \pst@cnta=-\pst@cnta + \fi + \ifnum\pst@cntb<\z@ + \pst@cntc=-\pst@cntc + \pst@cntb=-\pst@cntb + \fi + \ifnum\pst@cntc=\@ne + \def\ps@ir@sign{}% + \else + \def\ps@ir@sign{-}% + \fi + % calcul pgcd + \loop + \pst@cntd=\pst@cnta + \pst@cntc=\pst@cnta + \divide\pst@cntd\pst@cntb + \multiply\pst@cntd\pst@cntb + \advance\pst@cntc-\pst@cntd + \ifnum\pst@cntc>\z@ + \pst@cnta=\pst@cntb + \pst@cntb=\pst@cntc + \repeat + % pgcd dans \ir@r + \pst@cntc=\pst@cntb + \pst@cnta=\ps@ir@num + \pst@cntb=#2\relax + % op'erandes toutes positives + \ifnum\pst@cnta<\z@ + \pst@cnta=-\pst@cnta + \fi + \ifnum\pst@cntb<\z@ + \pst@cntb=-\pst@cntb + \fi + % division par le pgcd + \divide\pst@cnta\pst@cntc + \divide\pst@cntb\pst@cntc + % affichage + \ifnum\pst@cnta=\z@ + 0% + \else\ifnum\pst@cnta=\@ne + \ifnum\pst@cntb=\@ne + \ps@ir@sign\ps@ir@unit% + \else + \frac{\ps@ir@sign\ps@ir@unit}{\the\pst@cntb}% + \fi + \else + \ifnum\pst@cntb=\@ne + \ps@ir@sign\the\pst@cnta\ps@ir@unit% + \else + \frac{\ps@ir@sign\the\pst@cnta\ps@ir@unit}{\the\pst@cntb}% + \fi + \fi\fi +}} +% +\def\ps@extract@unit#1.#2\@nil{% + \pst@cnta=#1\relax + \def\ps@ir@num{#1}% sauvegarde (le pgcd 'ecrase la valeur \ir@a) + \def\ps@ir@unit{#2}% +} +% \define@key[psset]{pstricks-add}{labelFontSize}{\def\psk@labelFontSize{#1}}% \define@boolkey[psset]{pstricks-add}[Pst@]{mathLabel}[true]{% - \ifPst@mathLabel + \ifPst@mathLabel% \def\pshlabel##1{$\psk@labelFontSize##1$}% - \def\psvlabel##1{$\psk@labelFontSize##1$} - \else + \def\psvlabel##1{$\psk@labelFontSize##1$}% + \else% \def\pshlabel##1{\psk@labelFontSize##1}% - \def\psvlabel##1{\psk@labelFontSize##1} + \def\psvlabel##1{\psk@labelFontSize##1}% \fi} %\psset{labelFontSize={},mathLabel} % @@ -1388,34 +1464,49 @@ % \define@key[psset]{pstricks-add}{trigLabelBase}{\pst@getint{#1}{\psk@trigLabelBase}} \psset{trigLabelBase=0} - +% +\define@boolkey[psset]{pstricks-add}[Pst@]{trigLabelsSimplify}[true]{} +\psset[pstricks-add]{trigLabelsSimplify=true} +% \define@boolkey[psset]{pstricks-add}[Pst@]{trigLabels}[true]{% \ifPst@trigLabels - \def\pst@@@hlabel##1{\pshlabel{##1}} + \def\pst@@@hlabel##1{\pshlabel{##1}}% + \ifPst@trigLabelsSimplify + \def\pshlabel##1{% + \ifPst@mathLabel + $\psk@labelFontSize\psIrFrac{##1.\pi}{\psk@trigLabelBase}$ + \else + \psk@labelFontSize$\psIrFrac{##1.\pi}{\psk@trigLabelBase}$ + \fi}% + \else \def\pshlabel##1{% - \ifnum\psk@trigLabelBase<2 - \def\de@nominator{\@ne}\else\def\de@nominator{\psk@trigLabelBase}\fi - \def\pst@tempA{##1} + \ifnum\psk@trigLabelBase<\tw@ + \def\de@nominator{\@ne}% + \else + \def\de@nominator{\psk@trigLabelBase}% + \fi + \def\pst@tempA{##1}% \pst@abs{\pst@tempA}\pst@cntm \pst@mod{\pst@cntm}{\de@nominator}\pst@cntp % cntb=##1 modulo trigLabelBase \ifnum\@ne>\pst@cntp % 1 > modulo -> then we have pi/x - \pst@cnto=\pst@cntm \divide\pst@cnto by \de@nominator - \ifPst@mathLabel + \pst@cnto=\pst@cntm + \divide\pst@cnto\de@nominator + \ifPst@mathLabel% $\psk@labelFontSize - \ifnum\pst@tempA<0 -\fi% + \ifnum\pst@tempA<\z@ -\fi \ifnum\pst@cnto=\@ne % #1 = trigLabelBase \pi % print pi \else \the\pst@cnto\pi % print \pst@cnto/\de@nominator pi - \fi$ + \fi$% \else - \psk@labelFontSize - \ifnum\pst@tempA<0 -\fi% - \ifnum\pst@cnto=\@ne % #1 = trigLabelBase - $\pi$ % print pi + \psk@labelFontSize% + \ifnum\pst@tempA<\z@ -\fi + \ifnum\pst@cnto=\@ne % #1 = trigLabelBase + $\pi$% % print pi \else - \the\pst@cnto$\pi$ % print \pst@cnto/\de@nominator pi - \fi + \the\pst@cnto$\pi$% % print \pst@cnto/\de@nominator pi + \fi \fi \else \ifPst@mathLabel @@ -1423,57 +1514,100 @@ \ifnum\pst@cntp=\@ne % < 1 pi? \if\pst@cntm=\@ne \frac{\pi}{\de@nominator} % pi/x - \else\ifnum\pst@tempA=-1 \frac{-\pi}{\de@nominator} - \else \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator} - \else\frac{\pst@tempA\pi}{\de@nominator} % (x pi)/y - \fi\fi\fi + \else + \ifnum\pst@tempA=\m@ne + \frac{-\pi}{\de@nominator} + \else + \ifnum\pst@tempA=\@ne + \frac{\pi}{\de@nominator} + \else + \frac{\pst@tempA\pi}{\de@nominator} (x pi)/y + \fi + \fi + \fi \else - \ifnum\pst@tempA=1 \frac{\pi}{\de@nominator} - \else\ifnum\pst@tempA=\de@nominator \pi - \else\frac{\pst@tempA\pi}{\de@nominator} - \fi\fi\fi$ + \ifnum\pst@tempA=\@ne + \frac{\pi}{\de@nominator} + \else + \ifnum\pst@tempA=\de@nominator + \pi + \else + \frac{\pst@tempA\pi}{\de@nominator} + \fi + \fi + \fi$% \else - \psk@labelFontSize + \psk@labelFontSize% \ifnum\pst@cntp=\@ne % < 1 pi? - \if\pst@cntm=\@ne - $\frac{\pi}{\de@nominator}$ % pi/x - \else\ifnum\pst@tempA=-1 $\frac{-\pi}{\de@nominator}$ - \else \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ - \else$\frac{\pst@tempA\pi}{\de@nominator}$ % (x pi)/y - \fi\fi\fi + \ifnum\pst@cntm=\@ne + $\frac{\pi}{\de@nominator}$% % pi/x + \else + \ifnum\pst@tempA=\m@ne + $\frac{-\pi}{\de@nominator}$% + \else + \ifnum\pst@tempA=\@ne + $\frac{\pi}{\de@nominator}$% + \else + $\frac{\pst@tempA\pi}{\de@nominator}$% (x pi)/y + \fi + \fi + \fi \else - \ifnum\pst@tempA=1 $\frac{\pi}{\de@nominator}$ - \else\ifnum\pst@tempA=\de@nominator $\pi$ - \else$\frac{\pst@tempA\pi}{\de@nominator}$ - \fi\fi\fi + \ifnum\pst@tempA=\@ne + $\frac{\pi}{\de@nominator}$% + \else + \ifnum\pst@tempA=\de@nominator + $\pi$% + \else + $\frac{\pst@tempA\pi}{\de@nominator}$% + \fi + \fi + \fi \fi - \fi% + \fi }% + \fi \else \def\pst@@@hlabel##1{% \edef\@xyDecimals{\psk@xDecimals}% - \ifnum\psk@ticks<\tw@ % ticks=all|x + \ifnum\psk@ticks<\tw@% ticks=all|x \ifx\psk@xlogBase\@empty - \pshlabel{\psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% - \else% - \pshlabel{\psk@labelFontSize\psk@xlogBase\textsuperscript{\expandafter\@stripDecimals##1..\@nil }} - \fi% - \fi% - } + \pshlabel{% + \psk@labelFontSize\expandafter\@LabelComma##1..\@nil\psk@xlabelFactor}% + \else + \pshlabel{% + \psk@labelFontSize\psk@xlogBase% + \textsuperscript{\expandafter\@stripDecimals##1..\@nil}}% + \fi + \fi + }% \ifPst@mathLabel - \def\pshlabel##1{$\psk@labelFontSize##1$}\else + \def\pshlabel##1{$\psk@labelFontSize##1$}% + \else \def\pshlabel##1{\psk@labelFontSize##1}% - \fi - \fi + \fi% + \fi% } \psset{trigLabels=false} % %logLines=all|x|y|none (0,1,2,3) \define@key[psset]{pstricks-add}{logLines}{\pst@expandafter\psset@@logLines{#1}\@nil\psk@logLines} \def\psset@@logLines#1#2\@nil#3{% - \ifx#1a\let#3\z@\else - \ifx#1x\let#3\@ne\else - \ifx#1y\let#3\tw@\else + \ifx#1a + \let#3\z@ + \Pst@maxxTickstrue\Pst@maxyTickstrue + \set@xticksize{0 4pt}\set@yticksize{0 4pt}% + \else + \ifx#1x + \let#3\@ne + \Pst@maxxTickstrue\Pst@maxyTicksfalse + \set@xticksize{0 4pt}% + \else + \ifx#1y + \let#3\tw@ + \Pst@maxyTickstrue\Pst@maxxTicksfalse + \set@yticksize{0 4pt}% + \else \ifx#1n\let#3\thr@@\else \@pstrickserr{Bad argument: `#1#2'}\@ehpa \fi\fi\fi\fi} @@ -1522,14 +1656,14 @@ \def\pst@@@vlabel#1{% \edef\@xyDecimals{\psk@yDecimals}% % \psk@yLabel% - \ifodd\psk@ticks % ticks=all||y (0,2) - \else - \ifx\psk@ylogBase\@empty + \ifodd\psk@ticks% ticks=all||y (0,2) + \else% + \ifx\psk@ylogBase\@empty% % \ifPst@comma \psvlabel{\expandafter\@LabelComma#1..\@nil\psk@ylabelFactor}% % \else\psvlabel{#1\psk@ylabelFactor}\fi% \else% - \psvlabel{\psk@ylogBase\textsuperscript{\expandafter\@stripDecimals#1..\@nil }} + \psvlabel{\psk@ylogBase\textsuperscript{\expandafter\@stripDecimals#1..\@nil }}% \fi% \fi% } @@ -1582,8 +1716,8 @@ } % \def\psxs@axes{{% - \ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}\fi% - \ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}\fi% + \ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}\fi% + \ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}{y}\fi% }} \def\psaxes{\pst@object{psaxes}} \def\psaxes@i{\pst@getarrows\psaxes@ii} @@ -1601,8 +1735,8 @@ \begingroup% \pssetxlength\pst@dimc{#5}% ur-x \pssetylength\pst@dimd{#6}% ur-y - \ifdim\pst@dimc<\z@ \ifdim\pst@dimd<\z@ % axes show to left and down - \addbefore@par{xlabelPos=top,ylabelPos=right}\fi\fi + \ifdim\pst@dimc<\z@\ifdim\pst@dimd<\z@% axes show to left and down + \addbefore@par{xlabelPos=top,ylabelPos=right}\fi\fi% \setbox\pst@hbox=\hbox\bgroup% \use@par% now the same with an optional unit=... in par \pssetxlength\pst@dimg{#1}% o-x @@ -1611,15 +1745,15 @@ \pssetylength\pst@dimb{#4}% ll-y \pssetxlength\pst@dimc{#5}% ur-x \pssetylength\pst@dimd{#6}% ur-y - % If minimum values are negative in log mode, we modify Ox - % (respectively Oy) if this was not done by the user - % X axis labels (\psk@log = 0 or 1) +% If minimum values are negative in log mode, we modify Ox +% (respectively Oy) if this was not done by the user +% X axis labels (\psk@log = 0 or 1) % % Whole thing will be translated to origin: - \advance\pst@dima-\pst@dimg% Dist. from ll-x to o-x - \advance\pst@dimb-\pst@dimh% Dist. from ll-y to o-y - \advance\pst@dimc-\pst@dimg% Dist. from ur-x to o-x - \advance\pst@dimd-\pst@dimh% Dist. from ur-y to o-y + \advance\pst@dima by -\pst@dimg% Dist. from ll-x to o-x + \advance\pst@dimb by -\pst@dimh% Dist. from ll-y to o-y + \advance\pst@dimc by -\pst@dimg% Dist. from ur-x to o-x + \advance\pst@dimd by -\pst@dimh% Dist. from ur-y to o-y % Make lines/arrows or frame: \@nameuse{psxs@\psk@axesstyle}% \psxs@axes or \psxs@frame \ifPst@yAxis% @@ -1627,7 +1761,7 @@ \ifdim\pst@dima=\z@\else\showoriginfalse\fi% \ifnum\psk@dy=\z@% \pst@dimg=\psk@Dy\psyunit% - \ifdim\pst@dimg<\p@ \pst@cnta=\psk@Dy \edef\psk@Dy{-\the\pst@cnta}\fi % v.1.21 + \ifdim\pst@dimg<\p@\pst@cnta=\psk@Dy\edef\psk@Dy{-\the\pst@cnta}\fi% v.1.21 \edef\psk@dy{\number\pst@dimg}% \fi% \ifPst@xAxis\else\showorigintrue\fi% @@ -1641,8 +1775,8 @@ \ifdim\pst@dimb=\z@\else\showoriginfalse\fi% \ifnum\psk@dx=\z@% \pst@dimg=\psk@Dx\psxunit% - \ifdim\pst@dimg<\p@ \pst@cnta=\psk@Dx \edef\psk@Dx{-\the\pst@cnta} % v.1.21 - \fi % v.1.21 + \ifdim\pst@dimg<\p@\pst@cnta=\psk@Dx\edef\psk@Dx{-\the\pst@cnta}% v.1.21 + \fi% v.1.21 \edef\psk@dx{\number\pst@dimg}% \fi% \ifPst@yAxis\else\showorigintrue\fi% @@ -1656,7 +1790,7 @@ \pssetxlength\pst@dimg{#1}% \pssetylength\pst@dimh{#2}% \leavevmode\psput@cartesian\pst@hbox% - \endgroup + \endgroup% \ignorespaces% } % @@ -1700,25 +1834,50 @@ \pst@yticksizeC=\pst@dimo% left \fi% } -\define@key[psset]{}{ticksize}{\set@xticksize{#1}\set@yticksize{#1}} -\define@key[psset]{pstricks-add}{xticksize}{\set@xticksize{#1}} -\define@key[psset]{pstricks-add}{yticksize}{\set@yticksize{#1}}% overwrites the definition in pstricks +\newif\ifPst@maxxTicks +\newif\ifPst@maxyTicks +\define@key[psset]{}{ticksize}{% + \psDEBUG[key:ticksize]{setting ticksize} + \def\pst@tempA{max}% + \def\pst@tempB{#1}% + \ifx\pst@tempA\pst@tempB + \psDEBUG[key:ticksize]{setting ticksize to max} + \Pst@maxxTickstrue\Pst@maxyTickstrue + \set@xticksize{0 4pt}\set@yticksize{0 4pt}% + \else + \psDEBUG[key:ticksize]{setting ticksize to user values} + \Pst@maxxTicksfalse\Pst@maxyTicksfalse% + \set@xticksize{#1}\set@yticksize{#1}% + \fi} +\define@key[psset]{pstricks-add}{xticksize}{% + \def\pst@tempA{max}% + \def\pst@tempB{#1}% + \ifx\pst@tempA\pst@tempB + \Pst@maxxTickstrue\set@xticksize{0 4pt}% + \psDEBUG[key:xticksize]{setting ticksize to max} + \else\set@xticksize{#1}\Pst@maxxTicksfalse\fi} +\define@key[psset]{pstricks-add}{yticksize}{% + \def\pst@tempA{max}% + \def\pst@tempB{#1}% + \ifx\pst@tempA\pst@tempB + \psDEBUG[key:yticksize]{setting ticksize to max} + \Pst@maxyTickstrue\set@yticksize{0 4pt}% + \else\set@yticksize{#1}\Pst@maxyTicksfalse\fi}% overwrites the definition in pstricks %\psset{ticksize=-4pt 4pt} % -% full= 0, top=1, bottom=-1 => 0 1 2 +% full= 0, top=1, bottom=-1, inner=2 => -1 0 1 2 \def\psset@tickstyle#1{\pst@expandafter\psset@@tickstyle{#1}\@nil}% overwrite it \def\psset@@tickstyle#1#2\@nil{% - \ifx#1f\let\psk@tickstyle\z@\else - \ifx#1t\let\psk@tickstyle\@ne + \ifx#1f\let\psk@tickstyle\z@\else % full + \ifx#1t\let\psk@tickstyle\@ne % top \edef\psk@xticksize{0 \pst@number\pst@xticksizeB}% \edef\psk@yticksize{0 \pst@number\pst@yticksizeB}% - \else - \ifx#1b\let\psk@tickstyle\m@ne + \else\ifx#1b\let\psk@tickstyle\m@ne % bottom \edef\psk@xticksize{\pst@number\pst@xticksizeA 0}% \edef\psk@yticksize{\pst@number\pst@yticksizeA 0}% - \else - \@pstrickserr{Bad tick style: `#1#2'}\@ehpa - \fi\fi\fi + \else\ifx#1i\let\psk@tickstyle\tw@% % inner (for frame) + \else\@pstrickserr{Bad tick style: `#1#2'}\@ehpa + \fi\fi\fi\fi } % \define@key[psset]{pstricks-add}{subticks}{\def\psk@xsubticks{#1}\def\psk@ysubticks{#1}} @@ -1784,11 +1943,10 @@ % \newif\ifis@yAxis% % -\def\psxs@@axes#1#2#3#4#5{% llx,lly,urx,ury,exch,arrowA,arrowB +\def\psxs@@axes#1#2#3#4#5#6{% llx,lly,urx,ury,exch,x|y,arrowA,arrowB \pst@killglue% \begin@SpecialObj% - \def\pst@tempA{#5}% - \ifx\pst@tempA\@empty\relax% + \ifx#6x\relax% % x-axis? \is@yAxisfalse% \ifnum\psk@dx=\z@% \pst@dimg=\psk@Dx\psxunit% @@ -1797,7 +1955,7 @@ \else% \is@yAxistrue% \ifnum\psk@dy=\z@% - \pst@dimg=\psk@Dy\psyunit% + \pst@dimg=\psk@Dy\psyunit% \def\psk@dy{\number\pst@dimg}% \fi% \fi% @@ -1848,11 +2006,11 @@ /MinValue { \ifis@yAxis yStart \else xStart \fi \ifx\psk@arrowA\@empty\else \psk@arrowsize\space CLW mul add \psk@arrowlength\space mul - viceversa { sub epsilon add } { add epsilon sub } ifelse \fi } def - /MaxValue { \ifis@yAxis yEnd \else xEnd \fi + viceversa { sub epsilon add }{ add epsilon sub } ifelse \fi } def + /MaxValue { \ifis@yAxis yEnd \else xEnd \fi \ifx\psk@arrowB\@empty\else \psk@arrowsize\space CLW mul add \psk@arrowlength\space mul - viceversa { add epsilon sub } { sub epsilon add } ifelse \fi } def + viceversa { add epsilon sub }{ sub epsilon add } ifelse \fi } def /logLines { \ifnum\psk@logLines=\z@ true \else % all axes \ifnum\psk@logLines<\tw@ % x axis @@ -1874,7 +2032,7 @@ \else\@nameuse{psls@\psxsubticklinestyle}\fi stroke} def %\iffalse % start ticks --------------------------------------------------------- - 0 dT MaxValue { % the positive part of the axes + 0 dT MaxValue 1 add{ % the positive part of the axes /cntTick exch def % the index logLines { % log lines? gsave @@ -1882,8 +2040,15 @@ /dx exch def % save index /x cntTick dT dx log mul add def % x abs MaxValue abs le { % out of range? - x minTickline #5\space moveto - x maxTickline #5\space lineto + \ifis@yAxis + \ifPst@maxyTicks true \else false \fi + \else + \ifPst@maxxTicks true \else false \fi + \fi + { x minTickline #5 moveto + x maxTickline #5 lineto } + { x tickstart STsize mul #5 moveto + x tickend STsize mul #5 lineto } ifelse } if } for subTwidth SLW subTColor % set line width and subtick color @@ -1891,27 +2056,41 @@ grestore % restore main tick status stroke /dsubT 0 def % no other subticks - } if + } if % end logLines dsubT abs 0 gt { % du we have subticks? gsave % save graphic state % start subticks ---------------------------------------------------------- /cntsubTick cntTick dsubT add def subTNo 1 sub { cntsubTick abs MaxValue abs le { % out of range? - cntsubTick tickstart STsize mul #5\space moveto - cntsubTick tickend STsize mul #5\space lineto + \ifis@yAxis + \ifPst@maxyTicks true \else false \fi + \else + \ifPst@maxxTicks true \else false \fi + \fi + { cntsubTick minTickline STsize mul #5 moveto + cntsubTick maxTickline STsize mul #5 lineto } + { cntsubTick tickstart STsize mul #5 moveto + cntsubTick tickend STsize mul #5 lineto } ifelse }{ exit } ifelse /cntsubTick cntsubTick dsubT add def } repeat - subTwidth SLW subTColor % set line width and subtick color + subTwidth SLW subTColor % set line width and subtick color subLSstroke % end subticks ---------------------------------------------------------- - grestore % restore tick status + grestore % restore tick status } if gsave - cntTick tickstart #5\space moveto % line begin main Tick - cntTick tickend #5\space lineto % lineto tick end - Twidth SLW TColor % set line width and tick color + \ifis@yAxis + \ifPst@maxyTicks true \else false \fi + \else + \ifPst@maxxTicks true \else false \fi + \fi + { cntTick minTickline #5 moveto + cntTick maxTickline #5 lineto } + { cntTick tickstart #5 moveto % line begin main Tick + cntTick tickend #5 lineto } ifelse % lineto tick end + Twidth SLW TColor % set line width and tick color LSstroke grestore } for @@ -1930,8 +2109,15 @@ /dx exch def % save index /x cntTick dT dx log mul add def % x abs MinValue abs le { % out of range? - x minTickline #5\space moveto - x maxTickline #5\space lineto + \ifis@yAxis + \ifPst@maxyTicks true \else false \fi + \else + \ifPst@maxxTicks true \else false \fi + \fi + { x minTickline #5 moveto + x maxTickline #5 lineto } + { x tickstart STsize mul #5 moveto + x tickend STsize mul #5 lineto } ifelse } if } for /dsubT 0 def @@ -1945,8 +2131,8 @@ /cntsubTick cntTick dsubT add def subTNo 1 sub { cntsubTick abs MinValue abs le { % out of range? - cntsubTick tickstart STsize mul #5\space moveto - cntsubTick tickend STsize mul #5\space lineto + cntsubTick tickstart STsize mul #5 moveto + cntsubTick tickend STsize mul #5 lineto }{ exit } ifelse /cntsubTick cntsubTick dsubT add def } repeat % for @@ -1956,8 +2142,8 @@ grestore % restore main state } if gsave - cntTick tickstart #5\space moveto % line begin main Tick - cntTick tickend #5\space lineto % lineto tick end + cntTick tickstart #5 moveto % line begin main Tick + cntTick tickend #5 lineto % lineto tick end Twidth SLW TColor % set line width and tick color LSstroke grestore @@ -1965,27 +2151,38 @@ % end ticks ---------------------------------------------------------- %\fi } if% - }% + }% end of \pscode \end@SpecialObj% \ignorespaces% }% % +% \def\psxs@frame{% \begin@SpecialObj% - \addto@pscode{% - \pst@number\pst@dima \pst@number\pst@dimb moveto \pst@number\pst@dimc \pst@number\pst@dimb L - \pst@number\pst@dimc \pst@number\pst@dimd L \pst@number\pst@dima \pst@number\pst@dimd L - closepath}% + \addto@pscode{ % the frame + \pst@number\pst@dima \pst@number\pst@dimb moveto % lower left + \pst@number\pst@dimc \pst@number\pst@dimb L % upper left + \pst@number\pst@dimc \pst@number\pst@dimd L % upper right + \pst@number\pst@dima \pst@number\pst@dimd L % lower right + closepath + }% \pst@stroke% \psk@fillstyle% \end@SpecialObj% \let\psk@arrowA\@empty% \let\psk@arrowB\@empty% -% \pst@dima=0pt\pst@dimb=0pt% -% \psset{xticksize=0 \pst@dimd,yticksize=0 \pst@dimc}% \pst@xticksizeC=\z@\pst@yticksizeC=\z@% - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}% - \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}% + \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}% x axis + \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ exch }{y}% y axis + \ifnum\psk@tickstyle=\tw@ % llx,lly,urx,ury,exch,x|y,arrowA,arrowB + \psDEBUG[psxs@frame]{psk@tickstyle=2 (inner)}% + \psDEBUG[psxs@frame]{pst@dima=\pst@number\pst@dima}% + \psDEBUG[psxs@frame]{pst@dimb=\pst@number\pst@dimb}% + \psDEBUG[psxs@frame]{pst@dimc=\pst@number\pst@dimc}% + \psDEBUG[psxs@frame]{pst@dimd=\pst@number\pst@dimd}% + \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimd add }{x}% % upper x axis + \psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{ neg \pst@number\pst@dimc add exch }{y}% right y axis + \fi% } % % #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max @@ -1997,7 +2194,7 @@ \ifnum\pst@cnta=\z@\else% \pst@dimb=\psk@dx sp% % Space between ticks. \ifPst@yAxis\else\showorigintrue\fi% - \ifnum\psk@labels<\tw@ \ifPst@xAxis\pst@@hlabels\fi\fi% + \ifnum\psk@labels<\tw@\ifPst@xAxis\pst@@hlabels\fi\fi% \showoriginfalse% \fi% \fi% @@ -2005,30 +2202,32 @@ % Knows \pst@dimb and \pst@cnta \def\pst@@hlabels{% \psDEBUG[pst@@hlabels]{xticksizeC=\the\pst@xticksizeC}% - \vbox to\z@{% + \setbox\z@=\vbox{% save all in a box \ifcase\psk@xlabelPos \vskip-\pst@xticksizeA\vskip\pslabelsep\or - \vskip-1ex\or% - \vskip-\pst@xticksizeB\vskip-\pslabelsep\vskip-1ex% - \fi% + \vskip-1ex\or + \vskip-\pst@xticksizeB\vskip-\pslabelsep\vskip-1ex + \fi + \ifnum\pst@cnta<\z@ \pst@dimb=-\pst@dimb\fi \hbox to\z@{% - \ifnum\pst@cnta<\z@\pst@dimb=-\pst@dimb\fi% \ifshoworigin\hbox to \z@{\hss\pst@@@hlabel{\psk@Ox}\hss}\fi% \mmultido{\nA=\psk@Ox+\psk@Dx}{\pst@cnta}{% \hskip\pst@dimb\hbox to \z@{\hss% - \ifdim\nA pt=\z@ \pst@@@hlabel{0}\else\expandafter\pst@@@hlabel{\nA}\fi% prevent -0, doesn't work with \ifnum + \ifdim\nA pt=\z@ \pst@@@hlabel{0}% + \else\expandafter\pst@@@hlabel{\nA}% + \fi% prevent -0, doesn't work with \ifnum \hss}% }\hss% - } -}}% - + }% + }\ht\z@\z@ \dp\z@\z@ \box\z@}% set all values to zero +% % #1:Max/Min in pt from origin; #2:arrow; #3:min; #4:max % \psk@labels 0:all; 1:x; 2:y; 3:none \def\pst@vlabels#1#2#3#4{% \ifdim#1=\z@\else% \ifx#2\empty\else\advance#1\ifdim#1>\z@-\fi7\pslinewidth\fi% - \pst@cnta=#1\relax % % Distance (in sp) to end. - \divide\pst@cnta\psk@dy\relax % % Number of ticks/labels + \pst@cnta=#1\relax% % % Distance (in sp) to end. + \divide\pst@cnta\psk@dy\relax% % Number of ticks/labels \ifnum\pst@cnta=\z@\else% \pst@dima=\psk@dy sp% % Space between ticks. % \ifPst@xAxis\else\showorigintrue\fi% @@ -2049,8 +2248,8 @@ \offinterlineskip% \ifshoworigin% \vbox to \z@{\vss\hbox to\z@{% - \ifcase\psk@ylabelPos - \hss\pst@@@vlabel{\psk@Oy}\hskip\pslabelsep\hskip-\pst@yticksizeA\or + \ifcase\psk@ylabelPos% + \hss\pst@@@vlabel{\psk@Oy}\hskip\pslabelsep\hskip-\pst@yticksizeA\or% \hskip\pslabelsep\hss\pst@@@vlabel{\psk@Oy}\hss\or % right labels \hskip\pst@yticksizeB\hskip\pslabelsep\pst@@@vlabel{\psk@Oy}% \fi}\vss}% @@ -2060,10 +2259,11 @@ \vbox to \z@{% \vss\hbox to\z@{% \ifcase\psk@ylabelPos% and also check for -0 - \hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hskip\pslabelsep\hskip-\pst@yticksizeA\or - \hskip\pslabelsep\hss\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hss\or % right labels - \hskip\pst@yticksizeB\hskip\pslabelsep\ifdim\nA pt=\z@ \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% - \fi}\vss} + \hss\ifdim\nA pt=\z@% + \pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hskip\pslabelsep\hskip-\pst@yticksizeA\or% + \hskip\pslabelsep\hss\ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi\hss\or% % right labels + \hskip\pst@yticksizeB\hskip\pslabelsep\ifdim\nA pt=\z@\pst@@@vlabel{0}\else\pst@@@vlabel{\nA}\fi% + \fi}\vss}% }\vss}% } % @@ -3093,28 +3293,26 @@ [ \pst@colorA ] aload length 1 eq { dup dup } if 3 array astore tx@addDict begin GTriangle end % PS part }% - \if@star\pspolygon(#1)(#2)(#3)\fi% draw borderline + \if@star\pspolygon[fillstyle=none](#1)(#2)(#3)\fi% draw borderline \def\pst@linetype{2}% \end@ClosedObj% -}} +}\ignorespaces} % -\define@key[psset]{pstricks-add}{dicescale}{\def\psk@dicescale{#1}} \def\psdice{\pst@object{psdice}} \def\psdice@i#1{{% - \pst@killglue - \psset{framearc=0.3,linewidth=1pt,dicescale=1.0}% + \pst@killglue% + \addbefore@par{framearc=0.3,linewidth=1pt}% \use@par% - \psscalebox{\psk@dicescale}{% \psframe(-0.5,-0.5)(0.5,0.5)% + \ifodd#1 \qdisk(0,0){0.1\psunit}\else\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}\fi \ifcase#1% - \or\qdisk(0,0){3pt}% - \or\qdisk(-0.3,-0.3){3pt}\qdisk(0.3,0.3){3pt}% - \or\psdice@i{1}\psdice@i{2}% - \or\qdisk(-0.3,0.3){3pt}\qdisk(-0.3,-0.3){3pt}% - \qdisk(0.3,0.3){3pt}\qdisk(0.3,-0.3){3pt}% - \or\psdice@i{1}\psdice@i{4}% - \or\psdice@i{4}\qdisk(-0.3,0){3pt}\qdisk(0.3,0){3pt}% - \fi}% + \or\or\or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 3 + \or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 4 + \or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 5 + \qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit} + \or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 6 + \qdisk(-0.3,0){0.1\psunit}\qdisk(0.3,0){0.1\psunit}% + \fi% \ignorespaces% }} % @@ -3152,100 +3350,333 @@ \ignorespaces% } % -\newdimen\pie@ColorIndex -\newdimen\pie@ColorStep -\newcount\pie@Toggle -\newif\if@pieSep -\newif\if@pieUserColor -% -\define@key[psset]{pstricks-add}{pieColor}{\pst@expandafter\psk@@pieColor{#1}\@nil} -\def\psk@@pieColor#1#2\@nil{% - \ifx#1r\def\psk@pieColor{2}\else - \ifx#1c\def\psk@pieColor{380}\else\def\psk@pieColor{0}\fi\fi} -\psset[pstricks-add]{pieColor=gray}% gray, color, randomColor -% -\define@key[psset]{pstricks-add}{pieSep}{\pst@getlength{#1}\psk@pieSep} -\psset[pstricks-add]{pieSep=10pt} +\newdimen\chart@ColorIndex +\newdimen\chart@ColorStep +\newdimen\pst@chartHeight +\newdimen\pst@chartStackDepth +\newdimen\pst@chartStackWidth +\newcount\chart@Toggle +\newif\if@chartSep +\newif\if@chartUserColor +% +\define@key[psset]{pstricks-add}{chartStyle}{\def\psk@chartStyle{#1}} +\psset[pstricks-add]{chartStyle=pie}% p)ie P)ie-3d-view h)istogram H)istogram-3dview +% +\define@key[psset]{pstricks-add}{chartColor}{\pst@expandafter\psk@@chartColor{#1}\@nil} +\def\psk@@chartColor#1#2\@nil{% + \ifx#1r\def\psk@chartColor{2}\else + \ifx#1c\def\psk@chartColor{380}\else\def\psk@chartColor{0}\fi\fi} +\psset[pstricks-add]{chartColor=gray}% gray, color, randomColor +% +\define@key[psset]{pstricks-add}{chartSep}{\pst@getlength{#1}\psk@chartSep} +\define@key[psset]{pstricks-add}{chartStack}{\pst@getint{#1}\psk@chartStack} +\define@key[psset]{pstricks-add}{chartStackDepth}{\pssetylength\pst@chartStackDepth{#1}} +\define@key[psset]{pstricks-add}{chartStackWidth}{\pssetxlength\pst@chartStackWidth{#1}} +\define@key[psset]{pstricks-add}{chartHeight}{\pssetylength\pst@chartHeight{#1}} +\psset[pstricks-add]{chartSep=10pt,chartStack=0,chartStackDepth=2cm,chartStackWidth=2cm, + chartHeight=5mm} % \define@key[psset]{pstricks-add}{userColor}{% - \pie@Toggle=0 - \def\pie@option{#1} - \ifx\pie@option\@empty\@pieUserColorfalse + \chart@Toggle=0 + \def\chart@option{#1} + \ifx\chart@option\@empty\@chartUserColorfalse \else - \@pieUserColortrue - \expandafter\psk@@pieUserColor#1,,\@nil + \@chartUserColortrue + \expandafter\psk@@chartUserColor#1,,\@nil \fi} -\def\psk@@pieUserColor#1,#2,#3\@nil{% - \advance\pie@Toggle by \@ne% - \xglobal\colorlet{pieFillColor\the\pie@Toggle}{#1}% -% \typeout{pie:colorlet:pieFillColor\the\pie@Toggle=#1} - \def\pie@option{#2} - \ifx\pie@option\@empty\else\psk@@pieUserColor#2,#3,\@nil\fi}% +\def\psk@@chartUserColor#1,#2,#3\@nil{% + \advance\chart@Toggle by \@ne% + \xglobal\colorlet{chartFillColor\the\chart@Toggle}{#1}% + \def\chart@option{#2} + \ifx\chart@option\@empty\else\psk@@chartUserColor#2,#3,\@nil\fi}% \psset[pstricks-add]{userColor={}} -\def\psPie{\pst@object{psPie}} -\def\psPie@i#1#2#3{% #1:values #2:separated pies #3:radius - \pst@killglue - \begingroup - \pst@dimm=0pt\pst@cnta=1% - \psforeach{\pie@tempA}{#1}{% + +\def\psChart{\pst@object{psChart}} +\def\psChart@i#1#2#3{% +% #1:values #2:separated charts +% #3 radius->pie; max height->histogram + \pst@killglue% + \global\pssetylength\pst@chartHeight{#3}% + \global\let\pst@chartRadius\pst@chartHeight% + \begingroup% + \def\psk@chartValues{#1}% + \def\psk@chartSepValues{#2}% only valid for a pie chart + \pst@dimm=\z@% sum of all entries (for a pie) + \pst@cnta=1% number of entries + \pst@dimn=\z@% greatest entry + \psforeach{\chart@tempA}{#1}{% \global\advance\pst@cnta by \@ne % no of entries - \global\advance\pst@dimm by \pie@tempA pt} + \global\advance\pst@dimm by \chart@tempA pt % sum of all entries + \pst@dima=\chart@tempA pt + \ifdim\pst@dima>\pst@dimn \global\pst@dimn=\pst@dima\fi}% \addbefore@par{dimen=outer}% + \typeout{: pst@par=\pst@par}% \begin@SpecialObj% - \pst@getlength{#3}\pie@Radius - \ifnum\psk@pieColor>0 - \pie@ColorStep=400\p@\else\pie@ColorStep=\p@\fi % the "numerical color" - \divide\pie@ColorStep by \pst@cnta% % step =1/no or 400/no -% \typeout{psPie:colorStep: \pst@number\pie@ColorStep}% - \pie@ColorIndex=\psk@pieColor pt% % the start color (gray or wave) + \ifnum\psk@chartColor>0 + \chart@ColorStep=400\p@\else\chart@ColorStep=\p@\fi % the "numerical color" + \divide\chart@ColorStep by \pst@cnta% % step =1/no or 400/no + \chart@ColorIndex=\psk@chartColor pt% % the start color (gray or wave) + \psDEBUG[psChart]{psk@chartStack=\psk@chartStack}% + \@nameuse{pscs@\psk@chartStyle}% + \end@SpecialObj% + \endgroup% + \ignorespaces% +} +% +\def\pscs@pie{% \degrees[\pst@number\pst@dimm]% % instead of 360 degrees - \def\pie@alpha{0}% + \def\chart@alpha{0}% \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0% - \global\pie@Toggle=1 - \psforeach{\pie@tempA}{#1}{% - \global\advance\pst@dimm by \pie@tempA pt% - \global\advance\pst@dimn by \pie@alpha pt% - \def\pst@tempB{\pst@number\pie@ColorIndex}% -% \typeout{psPie:wave:color: \pst@tempB}% + \global\chart@Toggle=1 + \ifpsshadow% create shadow first + \psforeach{\chart@tempA}{\psk@chartValues}{% + \global\advance\pst@dimm by \chart@tempA pt% + \global\advance\pst@dimn by \chart@alpha pt% + \global\advance\pst@cnta by \@ne% + \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart + \global\@chartSepfalse% + \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta + \global\@chartSeptrue\fi}% + \if@chartSep + \pswedge(\psk@chartSep pt;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% + \else + \pswedge{\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm} + \fi% + \global\let\chart@alpha\chart@tempA% + } + \psshadowfalse% + \fi% + \def\chart@alpha{0}% + \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0% + \psforeach{\chart@tempA}{\psk@chartValues}{% + \global\advance\pst@dimm by \chart@tempA pt% + \global\advance\pst@dimn by \chart@alpha pt% + \def\pst@tempB{\pst@number\chart@ColorIndex}% + \psDEBUG[psChart:wave:color]{\pst@tempB}% \global\advance\pst@cnta by \@ne% - \if@pieUserColor\else - \def\pie@FillColor{pieFillColor\the\pst@cnta} - \ifnum\psk@pieColor>0 \xglobal\definecolor{\pie@FillColor}{wave}{\pst@tempB}% - \else\xglobal\definecolor{\pie@FillColor}{gray}{\pst@tempB}\fi% + \if@chartUserColor\else + \def\chart@FillColor{chartFillColor\the\pst@cnta} + \ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}% + \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi% \fi - \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the pie - \global\@pieSepfalse% - \psforeach{\pie@tempC}{#2}{\ifnum\pie@tempC=\the\pst@cnta - \global\@pieSeptrue\fi}% - \if@pieSep - \pswedge[linecolor={pieFillColor\the\pst@cnta},fillstyle=solid,fillcolor={pieFillColor\the\pst@cnta}]% - (\psk@pieSep pt;\pst@number\pst@dimo){#3}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% - \pst@dima=\pie@Radius pt \advance\pst@dima by \psk@pieSep pt - \pnode(\pst@dima;\pst@number\pst@dimo){psPie\the\pst@cnta}% - \pnode(.75\pst@dima;\pst@number\pst@dimo){psPieI\the\pst@cnta}% - \pnode(1.5\pst@dima;\pst@number\pst@dimo){psPieO\the\pst@cnta}% + \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart + \global\@chartSepfalse% + \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta + \global\@chartSeptrue\fi}% + \if@chartSep + \pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% + (\psk@chartSep pt;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% + \pst@dima=\pst@chartRadius\advance\pst@dima by \psk@chartSep pt + \pnode(\pst@dima;\pst@number\pst@dimo){psChart\the\pst@cnta}% + \pnode(.75\pst@dima;\pst@number\pst@dimo){psChartI\the\pst@cnta}% + \pnode(1.5\pst@dima;\pst@number\pst@dimo){psChartO\the\pst@cnta}% \else - \pswedge[linecolor={pieFillColor\the\pst@cnta},fillstyle=solid,fillcolor={pieFillColor\the\pst@cnta}]% - {#3}{\pst@number\pst@dimn}{\pst@number\pst@dimm} - \pnode(#3;\pst@number\pst@dimo){psPie\the\pst@cnta}% - \pst@dima=\pie@Radius pt - \pnode(.75\pst@dima;\pst@number\pst@dimo){psPieI\the\pst@cnta}% - \pnode(1.5\pst@dima;\pst@number\pst@dimo){psPieO\the\pst@cnta}% + \pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% + {\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm} + \pnode(\pst@chartRadius;\pst@number\pst@dimo){psChart\the\pst@cnta}% + \pst@dima=\pst@chartRadius + \pnode(.75\pst@dima;\pst@number\pst@dimo){psChartI\the\pst@cnta}% + \pnode(1.5\pst@dima;\pst@number\pst@dimo){psChartO\the\pst@cnta}% \fi% - \global\let\pie@alpha\pie@tempA% - \global\advance\pie@Toggle by \@ne - \ifnum\pie@Toggle<3 - \global\advance\pie@ColorIndex by 2\pie@ColorStep + \global\let\chart@alpha\chart@tempA% + \global\advance\chart@Toggle by \@ne + \ifnum\chart@Toggle<3 + \global\advance\chart@ColorIndex by 2\chart@ColorStep \else - \global\pie@Toggle=0 - \global\advance\pie@ColorIndex by -\pie@ColorStep% + \global\chart@Toggle=0 + \global\advance\chart@ColorIndex by -\chart@ColorStep% \fi% }% end foreach - \end@SpecialObj% - \endgroup% - \ignorespaces% } +% +\def\pscs@histogram{% + \def\chart@maxValue{\pst@number\pst@dimn}% max of the data + \pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight + \psDEBUG[pscs@histogram]{chart@maxValue=\chart@maxValue} + \psDEBUG[pscs@histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg} + \psDEBUG[pscs@histogram]{pst@chartHeight=\the\pst@chartHeight} + \pst@dimo=28.46\pst@dimg + \edef\pst@chartUnit{\pst@number\pst@dimo} +% \psaxes[axesstyle=frame, +% dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight) + \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0% + \global\chart@Toggle=1 + \psforeach{\chart@tempA}{\psk@chartValues}{% + \global\advance\pst@dimm by \chart@tempA pt% + \def\pst@tempB{\pst@number\chart@ColorIndex}% + \psDEBUG[psChart:wave:color]{\pst@tempB}% + \global\advance\pst@cnta by \@ne% + \if@chartUserColor\else + \def\chart@FillColor{chartFillColor\the\pst@cnta} + \ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}% + \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi% + \fi + \psframe[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0) + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add \chart@tempA\space \pst@chartUnit\space div) + \pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}% + \pnode(!\the\pst@cnta\space \chart@tempA\space 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}% + \pnode(!\the\pst@cnta\space \chart@tempA\space \pst@chartUnit\space div){psChartT\the\pst@cnta}% + \global\advance\chart@Toggle by \@ne + \ifnum\chart@Toggle<3 + \global\advance\chart@ColorIndex by 2\chart@ColorStep + \else + \global\chart@Toggle=0 + \global\advance\chart@ColorIndex by -\chart@ColorStep% + \fi% + }% end foreach +} +% +\def\pst@stackList{} +\def\addbefore@stackList#1{% + \ifx\pst@stackList\@empty + \xdef\pst@stackList{#1}% + \else + \toks@{#1}% + \pst@toks\expandafter{\pst@stackList}% + \xdef\pst@stackList{\the\toks@,\the\pst@toks}% + \fi% +} +% +\def\pscs@Histogram{% + \psDEBUG[pscs@Histogram]{psk@chartStack=\psk@chartStack}% + \def\chart@maxValue{\pst@number\pst@dimn}% max of the data + \pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight + \psDEBUG[pscs@Histogram]{chart@maxValue=\chart@maxValue}% + \psDEBUG[pscs@Histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg}% + \psDEBUG[pscs@Histogram]{pst@chartHeight=\the\pst@chartHeight}% + \pst@dimo=28.46\pst@dimg% + \edef\pst@chartUnit{\pst@number\pst@dimo}% +% \psaxes[axesstyle=frame, +% dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight) + \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0% + \global\chart@Toggle=1 % for color toggling + \pst@cntn=0 % stacked step + \pst@cnto=0 % for a stacked view + \pst@cntp=\psk@chartStack % for a stacked view + \def\pst@stackList{} + \psDEBUG[pscs@Histogram]{psk@chartStack=\the\pst@cntp}% + \psforeach{\chart@tempA}{\psk@chartValues}{% the loop + \ifnum\pst@cntp>0 % stacked version? + \advance\pst@cnto by \@ne % increase + \psDEBUG[pscs@Histogram]{chart@tempA=\chart@tempA}% + \expandafter\addbefore@stackList\expandafter{\chart@tempA}% + \psDEBUG[pscs@Histogram]{stack list=\pst@stackList}% + \ifnum\pst@cnto=\pst@cntp % draw? + \pst@cnto=\psk@chartStack\advance\pst@cnto by \m@ne + \psforeach{\chart@tempB}{\pst@stackList}{% the stack loop + \global\pst@cnta=\pst@cntn % we do not need the value + \psDEBUG[pscs@Histogram]{pst@cnto=\the\pst@cnto}% + \psDEBUG[pscs@Histogram]{pst@chartStackDepth=\the\pst@chartStackDepth}% + \psDEBUG[pscs@Histogram]{pst@chartStackWidth=\the\pst@chartStackWidth}% + \edef\pst@tempA{\the\pst@cnto}% + \psDEBUG[pscs@Histogram]{pst@tempA=\pst@tempA}% + \ifnum\pst@cnto>0 + \pst@dima=\pst@chartStackDepth% + \pst@dimb=\pst@chartStackWidth% + \divide \pst@dima by \pst@tempA% + \divide \pst@dimb by \pst@tempA% + \else\pst@dima=\z@ \pst@dimb=\z@% + \fi% + \rput(\the\pst@dima, \the\pst@dimb){\pscs@Histogram@i{\chart@tempB}} + \advance\pst@cnto by \m@ne % decrease stack counter + }% + \advance\pst@cntn by \tw@ % increase + \def\pst@stackList{}% reset stack list + \pst@cnto=0 % reset stack counter + \fi% + \else% + \pscs@Histogram@i{\chart@tempA}% non stacked version + \fi% + }% end foreach +} +% +\def\pscs@Histogram@i#1{% draw the 3d-like bar + \def\pst@tempB{\pst@number\chart@ColorIndex}% + \global\advance\pst@cnta by \@ne% + \if@chartUserColor\else + \def\chart@FillColor{chartFillColor\the\pst@cnta} + \ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}% + \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi% + \fi + \pspolygon[fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0)% ll + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add \psk@chartSep\space 56.92 div)% 'lr + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add + \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur + (!\the\pst@cnta\space \psk@chartSep\space 56.92 div sub + \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ul + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul + \psline% + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div) + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul + \psline% + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div) + (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add + \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur + \pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}% + \pnode(!\the\pst@cnta\space #1 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}% + \pnode(!\the\pst@cnta\space #1 \pst@chartUnit\space div){psChartT\the\pst@cnta}% + \global\advance\chart@Toggle by \@ne + \ifnum\chart@Toggle<3 + \global\advance\chart@ColorIndex by 2\chart@ColorStep + \else + \global\chart@Toggle=0 + \global\advance\chart@ColorIndex by -\chart@ColorStep% + \fi% + \global\advance\chart@ColorIndex by 1pt +} +% +\def\psCancel{\pst@object{psCancel}}% by Stefano Baroni 2008-06-21 +\def\psCancel@i{\pst@makebox\psCancel@ii} +\def\psCancel@ii{% + \begingroup + \solid@star + \use@par + \pst@dima=\pslinewidth + \advance\pst@dima by \psframesep + \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima + \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima + \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima + \setbox\pst@hbox=\hbox{% + \ifpsboxsep\kern\pst@dima\fi + \begin@ClosedObj + \addto@pscode{ + \psk@cornersize % arcradius boolean + \pst@number\pst@dima neg + \pst@number\pst@dimb neg + \pst@number\pst@dimc + \pst@number\pst@dimd + .5 + \if@star \tx@Frame \else + CLW mul /a ED % the middle of the line + 3 -1 roll 2 copy gt { exch } if + a sub /y2 ED + a add /y1 ED + 2 copy gt { exch } if + a sub /x2 ED + a add /x1 ED + pop pop % delete arc values + x1 y1 moveto + x2 y2 lineto + x2 y1 moveto + x1 y2 lineto + \fi + }% + \def\pst@linetype{2}% + \showpointsfalse + \end@ClosedObj + \box\pst@hbox + \ifpsboxsep\kern\pst@dima\fi% + }% + \ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi + \leavevmode\box\pst@hbox + \endgroup% +} +% \def\resetOptions{% \@zero=0% \def\pst@linetype{0}% @@ -3325,7 +3756,6 @@ arcsep=0,radius=.25cm,% ref=c,rot=0,labelsep=5pt,refangle=0,% intSeparator={,},% - dicescale=1.0,% %%%%%%%%% pst-plot %%%%%%%%%%%%% labelFontSize={},% StepType=lower, % alternative SumType=upper -- cgit v1.2.3