diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex | 1047 |
1 files changed, 520 insertions, 527 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex index a1122b91370..541c7de8d48 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex @@ -9,34 +9,34 @@ \ProvidesFileRCS{pgfmoduledatavisualization.code.tex} -\usepgfmodule{oo,shapes} -\usepgflibrary{fpu} +\usepgfmodule{oo,shapes}% +\usepgflibrary{fpu}% -% This module defines the basic framework for data visualization. +% This module defines the basic framework for data visualization. % In order to visualize data, you first need data. The format for this % data is not specified, indeed, different formats are possible. A % data point is created each time the command \pgfdatapoint is % used. The "parameters" of the data point are just the current values -% of the keys or macros in the current scope. +% of the keys or macros in the current scope. % % A set of data points created using the \pgfdata command. % When a data point is created, a number of signals are emitted, see % the description of \pgfdatapoint. To actually visualize something, % objects should be created that listen to these signals and that -% handle them. +% handle them. % % The following class manages a data visualization \pgfooclass{data visualization} -{ +{% % Class data visualization % % This class is used to "manage" a data visualization. It provides % methods for hooking into the data visualization process and its % constructor initializes the signals that are issued during a data - % visualization. + % visualization. % % When a data visualization object is created, a whole bunch of % signal objects. You should then create objects that connect to @@ -77,20 +77,20 @@ % 12. "at end visualization" code % 13. "end visualization" phase signal % 14. "after visualization" code - \attribute before survey; - \attribute at start survey; - \attribute at end survey; - \attribute after survey; - \attribute before visualization; - \attribute at start visualization; - \attribute at end visualization; - \attribute after visualization; - + \attribute before survey;% + \attribute at start survey;% + \attribute at end survey;% + \attribute after survey;% + \attribute before visualization;% + \attribute at start visualization;% + \attribute at end visualization;% + \attribute after visualization;% + % % Survey counts and handling % - - \attribute survey count=1; + + \attribute survey count=1;% % Each time a survey is done before the visualization is done, this % count is incremented. Normally, there is only one survey, but % objects may request another survey or even more surveys to be @@ -98,28 +98,28 @@ % accessing this count (via the get survey count method), you can % find out which survey is currently being done. - \attribute number of surveys=1; + \attribute number of surveys=1;% % By increasing this count, you can request additional surveys to be % done. - + % Stores the to-be-visualized data - \attribute data; + \attribute data;% + - % Stores the signal objects - \attribute prepare datapoint signal; - \attribute map datapoint signal; - \attribute transform datapoint signal; - \attribute visualize datapoint signal; - \attribute finish datapoint signal; - \attribute survey datapoint signal; - \attribute phase signal; - \attribute path signal; - \attribute direction signal; - \attribute style signal; - - + \attribute prepare datapoint signal;% + \attribute map datapoint signal;% + \attribute transform datapoint signal;% + \attribute visualize datapoint signal;% + \attribute finish datapoint signal;% + \attribute survey datapoint signal;% + \attribute phase signal;% + \attribute path signal;% + \attribute direction signal;% + \attribute style signal;% + + % Constructor % % Inits the signals @@ -139,71 +139,71 @@ % \pgfoothis.get handle(\pgf@dv@me) \pgfkeyslet{/pgf/data visualization/obj}\pgf@dv@me - } + }% % The phase signal will emit the following constants: - \def\pgfdvbeforesurvey{1} - \def\pgfdvbeginsurvey{2} - \def\pgfdvendsurvey{3} - \def\pgfdvaftersurvey{4} - \def\pgfdvbeforevisualization{5} - \def\pgfdvbeginvisualization{6} - \def\pgfdvendvisualization{7} - \def\pgfdvaftervisualization{8} + \def\pgfdvbeforesurvey{1}% + \def\pgfdvbeginsurvey{2}% + \def\pgfdvendsurvey{3}% + \def\pgfdvaftersurvey{4}% + \def\pgfdvbeforevisualization{5}% + \def\pgfdvbeginvisualization{6}% + \def\pgfdvendvisualization{7}% + \def\pgfdvaftervisualization{8}% % The path signale will meit the following constants: - \def\pgfdvpathmovetotoken{5} - \def\pgfdvpathlinetotoken{6} - \def\pgfdvdirectionfromtoken{7} - \def\pgfdvdirectiontotoken{8} - \def\pgfdvdirectionattoken{9} + \def\pgfdvpathmovetotoken{5}% + \def\pgfdvpathlinetotoken{6}% + \def\pgfdvdirectionfromtoken{7}% + \def\pgfdvdirectiontotoken{8}% + \def\pgfdvdirectionattoken{9}% % Method % % Connect the object #1's slot "#2" to the signal named "#3" \method connect(#1,#2,#3) { \pgfoovalueof{#3}.connect(#1,#2) - } - + }% + % Method % % Add data that is to be visualized. The code #1 should call the % \pgfdatapoint macro for each data point it creates. \method add data(#1) { \pgf@dv@stripped@add#1\pgf@stop - } + }% \def\pgf@dv@stripped@add#1\pgf@stop{% \pgfooappend{data}{#1}% - } - + }% + % Setters \method before survey(#1) { \pgfooappend{before survey}{#1} - } + }% \method at start survey(#1) { \pgfooappend{at start survey}{#1} - } + }% \method before visualization(#1) { \pgfooappend{before visualization}{#1} - } + }% \method at start visualization(#1) { \pgfooappend{at start visualization}{#1} - } + }% % Method \method at end survey(#1) { \pgfooprefix{at end survey}{#1} - } + }% \method after survey(#1) { \pgfooprefix{after survey}{#1} - } + }% \method at end visualization(#1) { \pgfooprefix{at end visualization}{#1} - } + }% \method after visualization(#1) { \pgfooprefix{after visualization}{#1} - } + }% % Method @@ -220,9 +220,9 @@ \pgfooget{path signal}\pgf@signalpath \pgfooget{direction signal}\pgf@signaldirection \pgfooget{style signal}\pgf@signalstyle - } + }% + - % Survey method % % Call this method to "survey" the data. This should be done before @@ -247,21 +247,21 @@ \ifnum\c@pgf@counta<\c@pgf@countb \advance\c@pgf@counta by1\relax \pgfooeset{survey count}{\the\c@pgf@counta} - \pgfutil@repeat - } + \pgfutil@repeat + }% % Getter \method get survey count(#1) { \pgfooget{survey count}{#1} - } + }% % Request another survey to be done \method do an additional survey() { \c@pgf@counta=\pgfoovalueof{number of surveys}\relax \advance\c@pgf@counta by1\relax \pgfooeset{number of surveys}{\the\c@pgf@counta} - } - + }% + % Visualize method % % This method will cause the actual visualization. @@ -278,8 +278,8 @@ \pgf@signalphase.emit(\pgfdvendvisualization)% \pgfoovalueof{after visualization} \pgf@signalphase.emit(\pgfdvaftervisualization)% - } -} + }% +}% % @@ -290,7 +290,8 @@ % be. \pgfkeys{/data point/.unknown/.code={% \pgfkeyssetvalue{/data point/\pgfkeyscurrentname}{#1} - }} + }, +}% @@ -312,13 +313,13 @@ % points are produced and handled in order to find out things like % their number or the minimum and maximum values of attributes, so % that axes and picture sizes can be prepared correctly. In the -% visualization phase, data point are actually shown. +% visualization phase, data point are actually shown. % % During the survey phase, for each data point the signal % "surveydatapoint" is emitted. % % During the visualization phase, more signals are emitted. A prepare -% signal is emitted first, giving all objects a +% signal is emitted first, giving all objects a % chance to "prepare" for the data point. Note that it is permissible % for an object to manipulate the data point here (and also % in later on). @@ -326,11 +327,11 @@ % Next, the command \pgfdvmapdatapointtocanvas is called. Mainly, % the effect of this command is to setup the keys /data point/canvas x % and /data point/canvas y, see the description of this command for -% more details. +% more details. % % The next step consists of signaling "visualize data point". Objects % listening to this will cause some form of visualization of the -% data point to occur. +% data point to occur. % % Before the visualization is started, it is checked whether the key % /data point/name is set (to a non-empty value). If so, @@ -344,7 +345,7 @@ \pgf@signalpreparedatapoint.emit()% \pgf@signalmapdatapoint.emit()% \pgf@signalsurveydatapoint.emit()% -} +}% \def\pgfdatapoint@visualizationphase{% \pgf@signalpreparedatapoint.emit()% @@ -355,7 +356,7 @@ }{}% \pgf@signalvisualizedatapoint.emit()% \pgf@signalfinishdatapoint.emit()% -} +}% @@ -373,7 +374,7 @@ % lets listening objects "map" the object by setting up % attributes of the data point. The second asks objects % listening to this signal to transform the current transformation -% matrix. After the signals, we compute where +% matrix. After the signals, we compute where % the origin lies inside this transformed coordinate system. Then the % two keys /data point/canvas x and /data point/canvas y are set to % the values of this position. The local scope ends (but the settings @@ -391,7 +392,7 @@ \noexpand\pgfkeyssetvalue{/data point/canvas y}{\the\pgf@y} }% \pgf@marshal% -} +}% % Help functions for locating a canvas data point % @@ -402,7 +403,7 @@ \def\pgfpointdvdatapoint{% \pgfqpoint{\pgfkeysvalueof{/data point/canvas x}}{\pgfkeysvalueof{/data point/canvas y}}% -} +}% \def\pgfpointdvlocaldatapoint{% {% @@ -413,7 +414,7 @@ \pgf@signaltransformdatapoint.emit()% \pgfpointtransformed{\pgfpointorigin}% }% -} +}% @@ -462,7 +463,7 @@ #3{}% \fi% }% -} +}% % Handle a moveto @@ -471,7 +472,7 @@ % given by the canvas position of the current local data point. \def\pgfpathdvmoveto{% \pgfdv@generic{\pgf@signalpath}{\pgfdvpathmovetotoken}{\pgfpathmoveto} -} +}% % Handle a lineto @@ -480,7 +481,7 @@ % given by the canvas position of the current local data point. \def\pgfpathdvlineto{% \pgfdv@generic{\pgf@signalpath}{\pgfdvpathlinetotoken}{\pgfpathlineto} -} +}% @@ -491,9 +492,9 @@ % #2 = code for setting the attributes of the second point % % The current point should be a point on a line from #1 to -% #2. Both points as well as the current point are +% #2. Both points as well as the current point are % localized on the canvas and a vector pointing from the first point -% to the second one is returned. However, for instance in polar +% to the second one is returned. However, for instance in polar % coordinates the vector may actually "point along" the angle axis. % % Internally, this command first sets up the first data point and then @@ -519,7 +520,7 @@ } }}} } -} +}% @@ -534,7 +535,7 @@ % Run the rendering pipeline on a dataset and/or save the dataset. -% +% % #1 = options with path /pgf/data/ % #2 = optionally data given inline in curly braces. % @@ -543,7 +544,7 @@ % This command is used to define a data set. For a single data % visualization, multiple data sets can be defined, they will % accumulate. Data can be in different formats, as specified by the -% "format" key, and you can define new formats. +% "format" key, and you can define new formats. % % The settings of the following keys are important: % @@ -555,17 +556,17 @@ % % /pgf/data/read from file % determines where the data is. -% +% % /pgf/data/store in group % when nonempty, the data is stored here instead of being fed to the % rendering pipeline % % /pgf/data/use group -% when nonempty, data that has previsouly been stored here using +% when nonempty, data that has previously been stored here using % |define group| is read from here and all other keys are ignored % % If "read from file" is empty, the data is stored in the argument that -% follows. Otherwise, the data is read from the specified source file. +% follows. Otherwise, the data is read from the specified source file. % This data is stored in an internal variable, which is local to the % current group. % @@ -577,7 +578,7 @@ % handler is started for each data set. This works as follows: first, % the handler's startup code is executed. Then for each line of the % data file/the data given inline, the line handler function is -% called. Finally, the data format end handler is called. +% called. Finally, the data format end handler is called. % % The format handler's job is to call \pgfdatapoint each time a % complete data point has been produced. @@ -597,18 +598,18 @@ % \pgfdata[format=space separated columns] % { % % today -% 2000 2300 2100 2200 +% 2000 2300 2100 2200 % 2000 2350 2200 2500 -% 2200 2300 2250 2260 -% 1800 2260 2260 1900 +% 2200 2300 2250 2260 +% 1800 2260 2260 1900 % 2000 2300 2100 2200 % } % % \pgfdata[format=comma separated columns] % { % % yesterday -% 2000, 2350, 2200, 2250 -% 2200, 2300, 2250, 2260 +% 2000, 2350, 2200, 2250 +% 2200, 2300, 2250, 2260 % } % % \pgfdata[read from file=data.csv,format=comma separated columns] @@ -616,7 +617,7 @@ % \dv.survey() % \dv.visualize() -\def\pgfdata{\pgfutil@ifnextchar[{\pgf@datagroup@data@opt}{\pgf@datagroup@data@opt[]}}%} +\def\pgfdata{\pgfutil@ifnextchar[{\pgf@datagroup@data@opt}{\pgf@datagroup@data@opt[]}}%}% \def\pgf@datagroup@data@opt[#1]{% % Ok, add one data thing... \begingroup% @@ -636,10 +637,10 @@ \csname pgf@dv@group@@\pgf@dv@use@group\endcsname% }% \fi% - \endgroup% + \endgroup% \expandafter\pgf@dv@cont@code% \fi% -} +}% \def\pgf@datagroup@data@opt@cont{% \pgfkeysgetvalue{/pgf/data/format}\pgf@dv@format% \expandafter\let\expandafter\pgf@dv@format@catcodes\csname pgfdv@format@\pgf@dv@format @catcodes\endcsname% @@ -653,8 +654,8 @@ \let\pgf@next\pgf@datagroup@grab@external% \fi% \pgf@next% -} - +}% + \def\pgf@datagroup@grab@inline{% \pgfutil@ifnextchar\bgroup{% \begingroup% @@ -662,13 +663,13 @@ \pgf@dv@format@catcodes% \pgf@datagroup@grab@@inline}% {\pgferror{Opening brace expected}}% -} +}% \def\pgf@datagroup@grab@external{% \fi% \endgroup% \pgf@dv@do@adddata{\pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@datagroup@do@external}}})}% \pgf@dv@cont@code% -} +}% \def\pgf@dv@do@adddata#1{% \pgfkeysgetvalue{/pgf/data/store in group}\pgf@dv@temp% @@ -677,9 +678,9 @@ \else% \expandafter\pgfutil@g@addto@macro\csname pgf@dv@group@@\pgf@dv@temp\endcsname{#1}% \fi% -} +}% -{\catcode`\^^M=\active% +{\catcode`\^=7 \catcode`\^^M=13 \gdef\pgf@datagroup@grab@@inline#1{% \endgroup% \pgf@dv@do@adddata{\pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@datagroup@do@inline#1^^M\pgf@@eol}}})}% @@ -688,7 +689,7 @@ \pgf@dv@cont@code% }% }% -\def\pgf@@eol{\pgf@eol} +\def\pgf@@eol{\pgf@eol}% \def\pgf@do@data#1#2{% \begingroup% @@ -700,7 +701,7 @@ #2% \csname pgfdv@format@\pgfkeysvalueof{/pgf/data/format}@end\endcsname% \endgroup% -} +}% % @@ -716,7 +717,7 @@ \pgf@datagroup@readline% \fi \immediate\closein\r@pgf@reada% -} +}% \def\pgf@partext{\par}% \def\pgf@datagroup@readline{% @@ -731,7 +732,7 @@ \fi% \fi% \ifeof\r@pgf@reada\else\expandafter\pgf@datagroup@readline\fi% -} +}% % @@ -740,9 +741,9 @@ \def\pgf@datagroup@do@inline{% \pgf@dv@handle@line% -} +}% -{\catcode`\^^M=\active% +{\catcode`\^=7 \catcode`\^^M=13 \gdef\pgf@dv@handle@line{% \pgfutil@ifnextchar^^M{\pgf@dv@format@emptyline\expandafter\pgf@dv@handle@line\pgfutil@gobble}% {\pgfutil@ifnextchar\pgf@@eol{\pgfutil@gobble}{\pgf@dv@handle@nonemptyline}}% @@ -751,7 +752,7 @@ \pgf@dv@format@line#1\pgfeol% \pgf@dv@handle@line% }% -} +}% \pgfkeys{ /pgf/data/data visualization obj/.initial=\undefined, @@ -762,7 +763,7 @@ /pgf/data/store in group/.initial=, /pgf/data/new group/.code={\expandafter\global\expandafter\let\csname pgf@dv@group@@#1\endcsname\pgfutil@empty}, /pgf/data/use group/.initial=, -} +}% @@ -799,7 +800,7 @@ \expandafter\def\csname pgfdv@format@#1@line\endcsname#4\pgfeol{#5}% \expandafter\def\csname pgfdv@format@#1@empty\endcsname{#6}% \expandafter\def\csname pgfdv@format@#1@end\endcsname{#7}% -} +}% @@ -826,7 +827,7 @@ % \pgfdatapoint % } -\pgfdeclaredataformat{TeX code}{}{}{#1}{#1 }{}{} +\pgfdeclaredataformat{TeX code}{}{}{#1}{#1 }{}{}% @@ -844,10 +845,10 @@ % x=7, y=6, lo=10 % } -\pgfdeclaredataformat{named}{}{}{#1}{\pgf@dv@parse@named#1,\pgf@stop}{}{} +\pgfdeclaredataformat{named}{}{}{#1}{\pgf@dv@parse@named#1,\pgf@stop}{}{}% \def\pgf@dv@parse@named{% \pgfutil@ifnextchar\pgf@stop{\pgfdatapoint\pgfutil@gobble}{\pgf@dv@parse@named@} -} +}% \def\pgf@dv@parse@named@#1=#2,#3\pgf@stop{% \foreach \pgf@dv@temp in {#2} {% \def\pgf@dv@tempb{/data point/#1=}% @@ -855,7 +856,7 @@ \expandafter\expandafter\expandafter{\expandafter\pgf@dv@tempb\pgf@dv@temp}% \pgf@dv@parse@named#3\pgf@stop% } -} +}% @@ -868,12 +869,12 @@ % A table consists of a head line, which contains the attribute names % of the values that will be found in the following lines. Each line % (except for the headline) contains one data point. -% +% % Inside each line the data points are separated by a separator like a % comma or a space or a colon. The separator can be configured using % the key /pgf/data/separator (leave the separator empty or set it to % \space for a space as separator). The default separator is a comma. -% +% % Some tables will miss the headline. In this case, using the % /pgf/data/headline key you can provide a headline yourself. % @@ -911,14 +912,14 @@ \let\pgf@dv@separator\space \fi \expandafter\def\expandafter\pgf@dv@till@separator% - \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@table@handle{##1}} + \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@table@handle{##1}} \expandafter\def\expandafter\pgf@dv@till@separator@head% - \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@head@handle{##1}} + \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@head@handle{##1}} \ifx\pgf@dv@headline\pgfutil@empty % Ok, read headline from file \pgfdv@firstlinetrue \else - % Headline already set + % Headline already set \pgfdv@firstlinefalse \expandafter\pgf@dv@parse@headline\expandafter{\pgf@dv@headline} \fi @@ -933,27 +934,27 @@ \c@pgf@counta=0\relax% keep track of attribute number \def\pgf@marshal{\pgf@dv@parse@table#1} \expandafter\expandafter\expandafter\pgf@marshal% - \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator + \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator \pgfdatapoint } \fi } -{} % ignore empty lines -{} % no special end code +{}% ignore empty lines +{}% no special end code \newif\ifpgfdv@firstline \pgfkeys{ /pgf/data/separator/.initial={,}, /pgf/data/headline/.initial= -} -\def\pgf@dv@spacetext{\space} +}% +\def\pgf@dv@spacetext{\space}% \def\pgf@dv@parse@table{% \pgfutil@ifnextchar"% Special, but ignored right now... {\pgferror{csv with quotes not yet implemented}} {\pgf@dv@till@separator} -} +}% \def\pgf@dv@table@handle#1{% \def\pgf@temp{#1}% \ifx\pgf@temp\pgfeoltext% @@ -969,8 +970,8 @@ \pgfkeyssetvalue{/data point/\pgf@dv@target}{#1} \let\pgf@next=\pgf@dv@parse@table% \fi% - \pgf@next% -} + \pgf@next% +}% @@ -978,14 +979,14 @@ \c@pgf@counta=0\relax% keep track of attribute number \def\pgf@marshal{\pgf@dv@doparse@headline#1} \expandafter\expandafter\expandafter\pgf@marshal% - \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator -} + \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator +}% \def\pgf@dv@doparse@headline{% \pgfutil@ifnextchar"% Special, but ignored right now... {\pgferror{csv with quotes not yet implemented}} {\pgf@dv@till@separator@head} -} +}% \def\pgf@dv@head@handle#1{% \def\pgf@temp{#1}% \ifx\pgf@temp\pgfeoltext% @@ -996,10 +997,10 @@ \pgfkeyssetvalue{/pgf/data/table/attribute \the\c@pgf@counta}{#1} \let\pgf@next=\pgf@dv@doparse@headline% \fi% - \pgf@next% -} + \pgf@next% +}% -\def\pgfeoltext{\pgfeol} +\def\pgfeoltext{\pgfeol}% % @@ -1012,16 +1013,16 @@ % math engine is used. In the future, something fancy build on luatex % might be used, so it would we should not rely directly on the % fpu library code. -% +% % The system works as follows: First, you "enter" a number into the % engine. When you do so, it is converted into some internal % representation that cannot be accessed any more and is called a % "math variable" henceforth. All commands of the % math system only work on math variables. -% +% % In order to "exit" a value stored in a math variable from the % engine, some other macros can be used. -% +% % Operations like addition or multiplication take two math variables % and store the result in another math variable. @@ -1031,95 +1032,95 @@ % % #1 = a math variable (a macro name) that is to store the value % #2 = an expression describing a number -% +% % % Description: -% +% % The #2 should be an expression that evaluates to a number. However, % due to the way the pgf math engine(s) work, currently, there are % several restrictions/the syntax is not as simple as one might % hope. Fortunately, the syntax is hopefully compatible with % easier-to-use future systems. -% +% % The syntax is as follows: #2 may be -% +% % 1. a simple high-precision number. This number is currently directly % passed to \pgfmathfloatparsenumber, so typical permissible values % are "100" or "10000000000000" or "nan" or "-5.673543345345e9000" -% +% % 2. a mathematical expression, which *must* be surrounded by -% parantheses. From a "mathematical" point of view these -% parantheses are superfluous, but the they are used to help pgf +% parentheses. From a "mathematical" point of view these +% parentheses are superfluous, but the they are used to help pgf % distinguish expressions from high-precision numbers. (If, in the % future, expressions may contain high precision numbers, the -% parantheses will simply be ignored.) -% +% parentheses will simply be ignored.) +% % The expression is evaluated using \pgfmathparse, which means that % TeX-precision is used. This means, for instance, that numbers % larger than about 16500 will create error messages. -% +% % The advantage is that you may say write things like "(5+6)" or % "(pi/2)". -% +% % 3. In case #2 starts with an exclamation mark (indicating an % "escape"), everything following the mark is simply evaluated by % TeX. The effect of evaluating #2 should be that the math % variable "\pgfdvmathvalue" is set to some value. This value will % then be transferred to #1. -% +% % 4. In case #2 is the result of calling \pgfdvmathexitbyserializing, the % "serialized" value is restored. The idea is that the serialized % will turn its internal representation of a number into something % that can be stored as a text somewhere. -% +% % Currently, "@" at the beginning of #2 is used to indicate that % what follows is a serialized version of a math variable. -% +% % In order to determine which of the above cases is to be used for a % variable, the first symbol #2 is checked, *after* the first symbol -% of #2 has been expanded once (using \expandafter once). +% of #2 has been expanded once (using \expandafter once). % % Example: % % \pgfdvmathenter{\mymacro}{20000000000000} % \pgfdvmathenter{\mymacro}{(5+pi)} % \pgfdvmathenter{\mymacro}{!\pgfdvmathadd{\pgfdvmathvalue}{\a}{\b}} -% +% % \pgfdvmathenter{\foo}{5} % \pgfdvmathexitbyserializing{\somevalue}{\foo} % \pgfdvmathenter{\mymacro}{\somevalue} \def\pgfdvmathenter#1#2{% \expandafter\pgfdvmathenter@check\expandafter#1#2\pgfdvmath@end% -} +}% \def\pgfdvmathenter@check#1{% \pgfutil@ifnextchar @{\pgfdvmath@internal#1}{% \pgfutil@ifnextchar ({\pgfdvmath@expression#1}{%) \pgfutil@ifnextchar !{\pgfdvmath@execute#1}{\pgfdvmath@normal#1}}}% -} +}% \def\pgfdvmath@internal#1@#2\pgfdvmath@end{% \def#1{#2}% -} +}% \def\pgfdvmath@expression#1(#2)#3\pgfdvmath@end{% \pgfmathparse{#2}% \pgfmathfloatparsenumber{\pgfmathresult}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmath@execute#1!#2\pgfdvmath@end{% #2% \let#1=\pgfdvmathvalue% -} +}% \def\pgfdvmath@normal#1#2\pgfdvmath@end{% \pgfmathfloatparsenumber{#2}% \let#1=\pgfmathresult% -} +}% % Print a math variable in the math engine using \pgfmathprintnumber % -% #1 = math variable +% #1 = math variable % % Description: % @@ -1132,15 +1133,15 @@ \def\pgfdvmathexitbyprinting#1{% \pgfmathprintnumber{#1}% -} +}% % Exit a math variable as a number in a scientific and portable number -% format in a macro +% format in a macro % % #1 = macro in which to store the value -% #2 = math variable +% #2 = math variable % % Description: % @@ -1154,18 +1155,18 @@ \def\pgfdvmathexitbyscientificformat#1#2{% \edef#1{\pgfmathfloatvalueof#2}% -} +}% % Exit a math variable as a "serialized" (= string-based) -% version. +% version. % % #1 = macro in which to store the value -% #2 = math variable +% #2 = math variable % % Description: -% +% % The serialized version can be reentered using % \pgfmathenter and is similar to \pgfdvmathexitbyscientificformat, % but exiting and entering are (a bit) faster. @@ -1177,7 +1178,7 @@ \def\pgfdvmathexitbyserializing#1#2{% \edef#1{@#2}% -} +}% @@ -1203,19 +1204,19 @@ \def\pgfdvmathadd#1#2#3{% \pgfmathfloatadd{#2}{#3}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathsub#1#2#3{% \pgfmathfloatsubtract{#2}{#3}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathmul#1#2#3{% \pgfmathfloatmultiply{#2}{#3}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathdiv#1#2#3{% \pgfmathfloatdivide{#2}{#3}% \let#1=\pgfmathresult% -} +}% % Multiply by small number % @@ -1234,20 +1235,20 @@ % \pgfdvmathadd{\b}{\a}{0.2} % % \b now stores 400 -\def\pgfdvmathmulfixed#1#2#3{% +\def\pgfdvmathmulfixed#1#2#3{% \pgfmathfloatmultiplyfixed{#2}{#3}% \let#1=\pgfmathresult% -} +}% % Log, ln and exponent functions -% +% % #1 = a math variable % #2 = a math variable -% +% % Description -% +% % \pgfdvmathln will compute #1 = ln(#2) % \pgfdvmathlog will compute #1 = log_{10}(#2) % \pgfdvmathexp will compute #1 = exp(#2) @@ -1256,18 +1257,18 @@ \def\pgfdvmathln#1#2{% \pgfmathfloatln{#2}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathlog#1#2{% \pgfmathfloatln{#2}% \pgfmathfloatmultiply{\pgfmathresult}{\pgfdvmathalwaysloge}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathexp#1#2{% \pgfmathfloatexp{#2}% \let#1=\pgfmathresult% -} +}% \def\pgfdvmathpowten#1#2{% \pgfmathfloattofixed{#2}% @@ -1291,16 +1292,16 @@ \fi \fi \let#1=\pgfmathresult% -} +}% % Floor functions -% +% % #1 = a math variable % #2 = a math variable -% +% % Description -% +% % Sets #1 to the largest integer less or equal to #2 \def\pgfdvmathfloor#1#2{% @@ -1323,7 +1324,7 @@ \or\let#1=#2% \fi% }% -} +}% % Advanced unary operations @@ -1345,7 +1346,7 @@ \def\pgfdvmathunaryop#1#2#3{% \csname pgfmathfloat#2\endcsname{#3}% \let#1=\pgfmathresult% -} +}% % Advanced binary operations @@ -1369,7 +1370,7 @@ \def\pgfdvmathbinop#1#2#3#4{% \csname pgfmathfloat#2\endcsname{#3}{#4}% \let#1=\pgfmathresult% -} +}% @@ -1390,7 +1391,7 @@ \def\pgfdvmathifless#1#2#3#4{% \pgfmathfloatlessthan{#1}{#2}% \ifpgfmathfloatcomparison#3\else#4\fi% -} +}% @@ -1398,7 +1399,7 @@ % % % Standard objects for data visualization -% +% % @@ -1407,7 +1408,7 @@ % \pgfooclass{linear transformer} -{ +{% % Class linear transformer % % This class is a transformer class. It reacts to the transform @@ -1417,22 +1418,22 @@ % current value of this.origin. If the current value is 1, the % system is shifted to this.origin + this.unit vector. For other % values of /data point/this.attribuate, the shift is interpolated - % between these two values. + % between these two values. + - - \attribute attribute; + \attribute attribute;% % The attribute (/data point/this.attribute) by which % the unit vector is multiplied. If it is empty (which is % different from 0), no transformation is done at all. - \attribute origin = \pgfpointorigin; + \attribute origin = \pgfpointorigin;% % The shift in case the /data point/this.attribute is 0. - \attribute unit vector; + \attribute unit vector;% % The coordinate system is additionally shifted by this amount % times the current value of /data point/this.attribute. - + % Constructor % % #1 = attribute that is being transformed. Example: x @@ -1443,20 +1444,20 @@ \pgf@process{#2} \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} \pgfoolet{unit vector}\pgf@temp% - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,transform,transform datapoint signal) - } - + }% + % Setter \method set origin(#1) { \pgf@process{#1} \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} \pgfoolet{origin}\pgf@temp% - } + }% % Slot % @@ -1479,9 +1480,8 @@ \fi% \fi% \fi% - } - -} + }% +}% % @@ -1489,7 +1489,7 @@ % \pgfooclass{interval mapper} -{ +{% % Class interval mapper % % This interval mapper reacts to the map datapoint signal. Its purpose is to @@ -1507,15 +1507,15 @@ % It is permissible to specify an additional non-linear % transformation function f. In this case, for an input value x the % position of f(x) inside the interval [f(a),f(b)] is determined and - % this position is linearly mapped to [c,d]. + % this position is linearly mapped to [c,d]. % % For example, if f(x) = log_10 (x) and the first range [a,b] = % [10,1000] and the second range is [1,2], then 10 is mapped to 1, % 100 is mapped to 1.5 (since f(100) = 3 lies in the middle % between f(10) = 2 and f(1000) = 4) and 100000 is mapped to 3. - - \attribute in; + + \attribute in;% % The name of the input attribute. If the value of this attribute % is empty or undefined, no mapping is done. % @@ -1523,30 +1523,30 @@ % has a value different from \relax, it will always be used instead % of the in attribute itself. This can be useful to temporarily % set a constant value to a key inside a mapping chain. - % + % % If the subkey /is min or max is set to "min" or "max", the mapping % will always be done to the respective out min or out max values. - \attribute out; + \attribute out;% % The name of the output attribute. - - \attribute trans; + + \attribute trans;% % Stores (more or less) the transformation function. - \attribute out min; + \attribute out min;% % Start of the second range (the value of c). - \attribute out min; + \attribute out min;% % End of the second range (the value of d). - \attribute trans in min; + \attribute trans in min;% % Transformed value of the start of the first range (the value % f(a)). - \attribute scale; + \attribute scale;% % The scaling factor, that is, the value of (f(b)-f(a))/(d-c). - + % Constructor % % #1 = input attribute. Example: velocity. @@ -1568,13 +1568,13 @@ #3% }% \fi% - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,map,map datapoint signal) - } + }% % Method % @@ -1584,7 +1584,7 @@ % #4 = out interval maximum % % This method will (re)compute the correct mappings for the interval - % mapper. + % mapper. \method set interval values(#1,#2,#3,#4) { {% \pgfdvmathenter{\pgf@in@interval@min}{#1} @@ -1604,18 +1604,18 @@ \pgfoovalueof{trans} \let\pgf@in@interval@max@transformed=\pgfvalue \pgfdvmathsub{\pgf@diff@in@transformed}{\pgf@in@interval@max@transformed}{\pgf@in@interval@min@transformed} - % + % % Precompute the scaling - % + % \pgfdvmathdiv{\pgf@scale}{\pgf@out@diff}{\pgf@diff@in@transformed}% \pgfoolet{scale}{\pgf@scale}% }{% \pgfoolet{scale}\pgf@dv@no@scale% }% }% - } - \def\pgf@dv@no@scale{noscale} - + }% + \def\pgf@dv@no@scale{noscale}% + % Slot \method map() { \pgfooget{scale}\pgf@dv@scale @@ -1650,18 +1650,18 @@ \fi% \fi% \fi% - } + }% \def\pgf@dv@set@out@min{% \pgfkeyslet{/data point/\pgfoovalueof{out}/is min or max}\pgf@min@text% \pgfooget{out min}{\pgf@minmax@temp}% \pgf@dv@set@out@now% - } + }% \def\pgf@dv@set@out@max{% \pgfkeyslet{/data point/\pgfoovalueof{out}/is min or max}\pgf@max@text% \pgfooget{out max}{\pgf@minmax@temp}% \pgf@dv@set@out@now% - } + }% \def\pgf@dv@set@out@now{% \pgfkeysgetvalue{/data point/\pgfoovalueof{out}/offset}\pgf@dv@external@offset% \ifx\pgf@dv@external@offset\relax\else% @@ -1673,8 +1673,8 @@ \fi \fi \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@minmax@temp% - } - + }% + \def\pgf@dv@mapper@trans{ \pgfooget{trans in min}{\pgf@dv@trans@in@min}% \pgfooget{scale}{\pgf@dv@scale}% @@ -1692,7 +1692,7 @@ \fi \pgfdvmathexitbyserializing{\pgf@temp}{\pgfvalue}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% - } + }% \def\pgf@dv@mapper@pos@check{% \pgfkeysgetvalue{/data point/\pgfoovalueof{in}/out pos}\pgf@dv@pos@value% @@ -1708,8 +1708,8 @@ \pgfdvmathexitbyserializing{\pgf@temp}{\pgf@out@val}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% \fi\fi% - } - + }% + \def\pgf@dv@mapper@goto@mid{% % Ok, compute transformed min position: \pgfooget{out min}{\pgf@out@interval@min} @@ -1719,8 +1719,8 @@ \pgfdvmathadd{\pgf@out@val}{\pgf@out@interval@min}{\pgf@out@interval@max}% \pgfdvmathexitbyserializing{\pgf@temp}{\pgf@out@val}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% - } -} + }% +}% @@ -1730,7 +1730,7 @@ \newif\ifpgf@dvignore \pgfooclass{scaling mapper} -{ +{% % Class scaling mapper % % A scaling mapper is (mainly) used to scale an attribute in such a way @@ -1747,16 +1747,16 @@ % and a interval mapper for then mapping the values to the scaled % values. Additionally, interval objects are needed. - \attribute in; + \attribute in;% % The to-be-scaled attribute; - \attribute out; + \attribute out;% % The attribute storing the scaled value. - \attribute in range obj; + \attribute in range obj;% % This interval keep track of the range of the in attribute - - \attribute scaling spec; + + \attribute scaling spec;% % A specification of how the scaling should be performed. % % The format is the following: @@ -1777,24 +1777,24 @@ % that deforms the linear mapping. In case f is specified, % f(#1) is mapped to #2 and f(#3) is mapped to #4. - \attribute spec maps min; + \attribute spec maps min;% % When the scaling spec maps "min" to some value, rather than some % specific value to that value, then spec maps min will be set to % \pgfutil@firstoftwo, otherwise to \pgfutil@secondoftwo - \attribute spec maps max; + \attribute spec maps max;% % Like spec maps min - \attribute function; + \attribute function;% % Stores the function - - \attribute interval mapper; + + \attribute interval mapper;% % Stores the interval mapper object - - \attribute range surveyor; + + \attribute range surveyor;% % Stores the range surveyor object - - + + % Constructor % % #1 = in attribute @@ -1825,54 +1825,54 @@ % % % The interval mapper: - % + % \pgfoonew{interval mapper}=new interval mapper(#1,#2,#4) \pgfoovalueof{interval mapper}.default connects() - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } + }% % Getter % % Returns an interval object that stores the range of the in - % attribute. + % attribute. \method get in range interval() { \pgfooget{in range obj}\pgfdvinrangeinterval - } - - + }% + + % Getter % % Returns the out attribute. - % + % \method get out() { \pgfooget{out}\pgfdvout - } + }% % Getter % % Returns the function attribute. - % + % \method get function(#1) { \pgfooget{function}#1 - } + }% % Method % % #1 = a included in value - % + % % This method only affects the survey. The value #1 is recorded as % if it were encountered for the in attribute at some point. - % + % \method include in value(#1) { \pgfoovalueof{range surveyor}.include attribute value({#1}) - } + }% + - % Method % % #1 = value for the attribute @@ -1880,7 +1880,7 @@ % Sets the attribute to the (evaluated) given value (evaluation % using \pgfmathparse). When the value is evaluated, the values of % \pgfdvmin and \pgfdvmax will be set to the minimum and maximum - % values of the in interval. (See \pgfdvmathenter with the "!"-notation). + % values of the in interval. (See \pgfdvmathenter with the "!"-notation). % % In case #1 is set to the special value "min", it evaluates to % \pgfdvmin, when set to "max" it evaluates to \pgfdvmax. @@ -1902,14 +1902,14 @@ \fi% \pgfdvmathexitbyserializing{\pgf@dv@serial}{\pgf@dv@value}% \pgfkeyslet{/data point/\pgfoovalueof{in}}\pgf@dv@serial% - } + }% \def\pgf@dv@lib@set@mm{ \pgfooget{in range obj}\pgfdvinrangeinterval \pgfdvinrangeinterval.get min and max()% - } + }% - - % Slot + + % Slot \method phase(#1) { \ifx#1\pgfdvendsurvey % Ok, we setup the interval mapper. @@ -1925,9 +1925,9 @@ \pgf@lib@dv@min@at,\pgf@lib@dv@max@at) \fi \fi - } + }% + - % Internal helper \def\pgf@lib@dv@parse@scaling#1 at#2and #3 at#4\pgf@stop{% \def\pgf@lib@dv@min{#1}% @@ -1952,10 +1952,10 @@ \pgfdvmathexitbyserializing{\pgf@lib@dv@min@at}{\pgf@lib@dv@min@at@mv} \pgfdvmathexitbyserializing{\pgf@lib@dv@max}{\pgf@lib@dv@max@mv} \pgfdvmathexitbyserializing{\pgf@lib@dv@max@at}{\pgf@lib@dv@max@at@mv} - } - \def\pgf@min@text{min} - \def\pgf@max@text{max} -} + }% + \def\pgf@min@text{min}% + \def\pgf@max@text{max}% +}% @@ -1966,13 +1966,13 @@ % \pgfooclass{range surveyor} -{ +{% % Class range surveyor % % A range surveyor is used only in the survey phase. Its job is to % determine the minimum and maximum values of an attribute that are % "seen" during the survey phase. Based on this value, the size of, - % say, an axis can be detemined later on. + % say, an axis can be determined later on. % % You can also set the key "sub attributes" of the attribute. In % this case, this key should contain -- as the name suggests -- a @@ -1984,12 +1984,12 @@ % "/data point/velocity", then "/data point/velocity/sub attributes" % should be set to "\pgfdvsub{/min}\pgfdvsub{/max}". - \attribute attribute; + \attribute attribute;% % The to-be-surveyed attribute - \attribute interval obj; + \attribute interval obj;% % The interval object that protocols the minimum and maximum - % values. + % values. % Constructor @@ -2000,27 +2000,27 @@ \method range surveyor(#1,#2) { \pgfooset{attribute}{#1} \pgfoolet{interval obj}#2 - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,survey,survey datapoint signal) - } + }% % Method % % #1 = a value - % + % % Adjust the interval as if during the survey this value were - % encountered + % encountered \method include attribute value(#1) { \pgf@dv@assign@val@stripped#1\pgf@stop% \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv) - } + }% \def\pgf@dv@assign@val@stripped#1\pgf@stop{% \def\pgf@dv@val{#1} - } + }% % Slot % @@ -2032,7 +2032,7 @@ \let\pgfdvsub\pgf@dv@range@surv@sub \pgfdvsub{}% \pgfkeysvalueof{/data point/\pgfoovalueof{attribute}/sub attributes} - } + }% \def\pgf@dv@range@surv@sub#1{ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}#1}\pgf@dv@val% @@ -2044,7 +2044,7 @@ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)% \fi% \fi% - } + }% \def\pgf@dv@range@surv{% \pgfdvmathenter{\pgf@dv@value}{\pgf@dv@val}% @@ -2059,8 +2059,8 @@ \else% \pgfdvmathifless{\pgfdvmax}{\pgf@dv@value}{\let\pgfdvmax\pgf@dv@value}{}% \fi% - } -} + }% +}% @@ -2068,19 +2068,19 @@ % Visualizers % -\usepgflibrary{plothandlers} +\usepgflibrary{plothandlers}% \pgfooclass{plot handler visualizer} -{ +{% % Class plot handler visualizer % % This visualizer uses one or more plot handlers to visualize data points. - % As the data points are processed, the canvas positions of the data + % As the data points are processed, the canvas positions of the data % points are recorded. At the end of a group of data points, the % recorded stream of canvas position is visualized (rendered) - % using plot handlers. For instance, when the lineto plot handler + % using plot handlers. For instance, when the lineto plot handler % is used, the data points are connected by straight lines, when the % curveto plot handler is used, they are connected by smooth curves % and so on. @@ -2092,7 +2092,7 @@ % You can specify a "filter", which will cause only those data % points to be visualized by the visualizer that pass the test. The % filter should set \pgfdvfilterpassedfalse for to-be-filtered data - % point. + % point. % % You can specify "projection code" that changes the canvas x and % canvas y positions. This projection code allows you to draw, say, @@ -2103,35 +2103,35 @@ % the visualizer, should store code that is to be executed directly % before and after the stream of coordinates is created. Typically, % these keys will store commands to use the path created by the plot - % handler. + % handler. - \attribute handlers; + \attribute handlers;% % The to-be-used handlers - - \attribute name; + + \attribute name;% % The attribute - - \attribute filter=\pgfdvnamedvisualizerfilter; + + \attribute filter=\pgfdvnamedvisualizerfilter;% % Filter code - - \attribute positions; + + \attribute positions;% % An internal protocol of the positions on the stream - - \attribute cache; + + \attribute cache;% % An internal cache. Positions are first inserted into this % cache. Every 100 steps this cache is moved to positions. The idea % behind this is that it will avoid the quadratic time increase that % is normally caused when a protocol is build in TeX. - - \attribute projection code; + + \attribute projection code;% % This code is empty by default. However, you can set it for % instance to the following - % + % % \pgfkeyssetvalue{/data point/y=0}\pgfdvmapdatapointtocanvas - % + % % in order to visualize the data point with its y-coordinate % replaced by 0. - + % Constructor % % #1 = A name @@ -2141,24 +2141,24 @@ \method plot handler visualizer(#1,#2) { \pgfooset{name}{#1} \pgfooset{handlers}{#2} - } - + }% + % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,protocol,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } + }% % Setter \method set filter(#1) { \pgfooset{filter}{#1} - } + }% % Setter \method set projection code(#1) { \pgfooset{projection code}{#1} - } + }% % Slot \method protocol() { @@ -2167,7 +2167,7 @@ \ifpgfdvfilterpassed% \pgf@dv@line@cache@it \fi% - } + }% \def\pgf@dv@line@cache@it{ % Cache it @@ -2199,14 +2199,14 @@ \let\pgf@dv@cache\pgfutil@empty \fi \pgfoolet{cache}\pgf@dv@cache - } - + }% + % Slot \method phase(#1) {% \ifx#1\pgfdvendvisualization% \pgfoothis.render()% \fi% - } + }% % Internal method \method render() { @@ -2227,19 +2227,19 @@ \endpgfscope \pgfoolet{positions}\pgfutil@empty \pgfoolet{cache}\pgfutil@empty - } + }% - \def\pgf@dv@ph#1#2{\ifpgfdvnewstream\pgfplotstreamstart\pgfdvnewstreamfalse\fi\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} - \def\pgf@dv@outliner{\ifpgfdvnewstream\else\pgfplotstreamend\pgfdvnewstreamtrue\fi} -} + \def\pgf@dv@ph#1#2{\ifpgfdvnewstream\pgfplotstreamstart\pgfdvnewstreamfalse\fi\pgfplotstreampoint{\pgfqpoint{#1}{#2}}}% + \def\pgf@dv@outliner{\ifpgfdvnewstream\else\pgfplotstreamend\pgfdvnewstreamtrue\fi}% +}% \newif\ifpgfdvnewstream \newcount\pgf@lib@dv@cache@count \pgfkeys{% /data point/outlier/.initial=, - /data point/outlier/.default=true -} + /data point/outlier/.default=true, +}% % A possible filter for unnamed visualizers @@ -2250,10 +2250,10 @@ % % In a data visualization with multiple visualizers, data points % typically "belong" only to a single visualizer. It is, thus, -% necessary to filter data points accoring to the current +% necessary to filter data points according to the current % visualizer. This current visualizer is assumed to be stored in /data % point/visualizer. -% +% % When objects allow you to set a filter, you can use this filter to % test against /data point/set being equal to #1. @@ -2264,14 +2264,14 @@ \else \pgfdvfilterpassedfalse \fi% -} +}% % A filter for named visualizer -% +% % Description: -% +% % This filter works like \pgfdvvisualizerfilter, only it assumes the % the object defines a "name" attribute. In this case, the value of % /data point/set is tested against this attribute. @@ -2283,12 +2283,12 @@ \else \pgfdvfilterpassedfalse \fi% -} +}% \pgfooclass{rectangle visualizer} -{ +{% % Class rectangle visualizer % % This visualizer visualizes a datapoint as a rectangle. It needs @@ -2296,33 +2296,33 @@ % point/<name>/attribute 2 store two attributes names a1 to a2. Then, % provided the current value of /data point/set equals name, for % each data point a rectangle between (a1/min,a2/min) and - % (a1/max,a2/max) is created. - + % (a1/max,a2/max) is created. + - \attribute name; + \attribute name;% % The name - - \attribute a1; - \attribute a2; + + \attribute a1;% + \attribute a2;% % The attributes, filled from /data point/<name>/attribute 1 and 2 - + % Constructor % - % #1 = first attribute - % #2 = second attribute + % #1 = first attribute + % #2 = second attribute % \method rectangle visualizer(#1) { \pgfooset{name}{#1} - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,visualize,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } - + }% + % Slot \method phase(#1) {% \ifx#1\pgfdvbeginsurvey% @@ -2331,8 +2331,8 @@ \pgfkeyssetvalue{\pgfoovalueof{a1}/sub attributes}{\pgfdvsub{/min}\pgfdvsub{/max}} \pgfkeyssetvalue{\pgfoovalueof{a2}/sub attributes}{\pgfdvsub{/min}\pgfdvsub{/max}} \fi% - } - + }% + % Slot \method visualize() { { @@ -2342,7 +2342,7 @@ \pgf@dv@rect@do \fi } - } + }% \def\pgf@dv@rect@do{ \pgfkeysgetvalue{\pgfoovalueof{a1}/min}\pgf@dv@amin @@ -2371,8 +2371,8 @@ \fi\fi \fi\fi \fi\fi - } -} + }% +}% \newcount\pgf@lib@dv@cache@count @@ -2383,12 +2383,12 @@ % \pgfooclass{label visualizer} -{ +{% % Class label visualizer % % The job of this class is to visualize a label of a curve or some % other object. - % + % % The idea is as follows: This class monitors a certain % attribute. When this attribute reaches a certain value for the % first time, the following happens: A normalized vector of the line @@ -2397,29 +2397,29 @@ % coordinate system is shifted so that the current data point is at % the origin. Then, some drawing code is executed. - \attribute attribute; + \attribute attribute;% % The monitored attribute - \attribute filter; + \attribute filter;% % Filter code, see plot handler visualizer doc. - - \attribute threshold; + + \attribute threshold;% % When the attribute exceeds this threshold, the drawing code is % executed - \attribute before canvas position=; + \attribute before canvas position=;% % Stores canvas position of the data point before the interesting one - - \attribute canvas position=; + + \attribute canvas position=;% % Stores canvas position of the data point - \attribute code; + \attribute code;% % To-be-executed code when the label should be drawn - - + + % Constructor % - % #1 = attribute + % #1 = attribute % #2 = a macro, storing the threshold % #3 = code % #4 = filter code @@ -2430,14 +2430,14 @@ \pgfoolet{threshold}\pgf@temp \pgfooset{code}{#3} \pgfooset{filter}{#4} - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,test,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } + }% % Slot \method test() { @@ -2451,7 +2451,7 @@ \pgf@dv@label@vis@record \fi% \fi% - } + }% \def\pgf@dv@label@vis@record{ % Record current position @@ -2479,8 +2479,8 @@ }% \fi\fi% \fi% - } - + }% + % Slot \method phase(#1) {% \ifx#1\pgfdvendvisualization% @@ -2490,9 +2490,8 @@ \pgfoovalueof{code} \endscope \fi% - } - -} + }% +}% @@ -2500,12 +2499,12 @@ % Style sheets % \pgfooclass{style attribute} -{ +{% % Class style attribute - % + % % Instances of this class are used to select a style based on the % current value of an attribute. - % + % % Instances of this class monitor an attribute. Whenever the "style" % signal is raised, the object investigates the current value of the % attribute. It then looks up /pgf/data visualization/style @@ -2514,27 +2513,27 @@ % /pgf/data visualization/style sheets/<name of style sheet>/default % style is executed with the value as a parameter. - \attribute attribute; + \attribute attribute;% % The name of the attribute - \attribute style sheet name; + \attribute style sheet name;% % The styling function % Constructor % % #1 = attribute (including, if present, /data point/) - % #2 = style sheet name + % #2 = style sheet name % \method style attribute(#1,#2) { \pgfooset{attribute}{#1} \pgfooset{style sheet name}{#2} - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,invoke style,style signal) - } + }% % Slots \method invoke style() { @@ -2550,22 +2549,22 @@ \pgfkeysalso{\pgf@temp/default style/.expand once=\pgf@dv@temp@val} } \fi\fi% - } -} + }% +}% % Declares a new style sheet -% -% #1 = name of style sheet +% +% #1 = name of style sheet % #2 = settings -% +% % Description: -% +% % This is a shortcut for doing a /.cd to /pgf/data visualization/style sheets/#1 \def\pgfdvdeclarestylesheet#1#2{ \pgfkeys{/pgf/data visualization/style sheets/#1/.cd,#2} -} +}% @@ -2580,22 +2579,22 @@ % \pgfooclass{legend} -{ +{% % Class legend - % + % % This class is used to collect entries into a legend. The idea is % that, say, for each line of a picture you would like to have an % entry in a legend. Then you prepare these entries and send % them to a legend container object. It will collect the entries - % and, at the end, arrange them in rows and columns by + % and, at the end, arrange them in rows and columns by % separating them using \pgfdvnextcell and \pgfdvendrow. % % By surrounding the resulting arrangement by a call to \pgfmatrix or % a call to \halign you can then create a legend. - % + % % To specify how the entries should be arranged, a size % specification and two directions are needed. - % + % % For the size specification you specify either the ideal number of % columns and the maximum number of rows or you specify the ideal % number of rows and the maximum number of columns. In the first @@ -2610,10 +2609,10 @@ % columns that the ideal number -- to ensure that no column contains % more than the desired number. The case is symmetric, but with the % roles of columns and rows exchanged. - % + % % Here is an example: You specify that you want 2 columns, ideally, % each having a maximum of 4 entries. Here is what you would get: - % + % % Number of entries & Number of resulting columns ... & ... and rows % 1 & 1 & 1 % 2 & 2 & 1 @@ -2629,7 +2628,7 @@ % 12 & 3 & 4 % 13 & 4 & 4 % - % + % % Once the number of columns and rows has been computed, the next % step is to "fill" the table. For this, eight strategies may be % specified: right then down, right then up, left then down, left @@ -2639,14 +2638,14 @@ % arrangement. However, once the maximum number of elements in a row % has been reached, the a new row should be started that is placed % above ("up") then just-assembled row. - % - % - % + % + % + % % % Example: - % + % % You create an object \legend and then call - % + % % \pgfoofnew \legend=new legend(columns,2,3,down then right) % \legend.add entry(first) % \legend.add entry(second) @@ -2655,37 +2654,37 @@ % \legend.add entry(fifth) % \legend.add entry(sixth) % \legend.add entry(seventh) - % \legend.get arrangment(\arrangement) - % + % \legend.get arrangement(\arrangement) + % % Then \arrangment will expand to - % + % % first \pgfdvnextcell fourth \pgfdvnextcell seventh \pgfdvendrow % second \pgfdvnextcell fifth \pgfdvnextcell third \pgfdvendrow % third \pgfdvendrow sixth \pgfdvnextcell \pgfdvendrow - % + % % By saying \let\pgfdvendrow=\\ and \let\pgfdvnextcell=&, you % can use \arrangment inside a table. - - - \attribute entries; - % Collectes the entries - \attribute columns or rows; + + \attribute entries;% + % Collects the entries + + \attribute columns or rows;% % Specifies whether columns or rows are specified - \attribute ideal; + \attribute ideal;% % The ideal number of columns/rows - \attribute max; + \attribute max;% % The maximum number of entries per column/row - \attribute strategy; + \attribute strategy;% % Specifies how the matrix should be filled - - \attribute number of entries=0; + + \attribute number of entries=0;% % Counts the number of entries that have been stored - - + + % Constructor % % #1 = "columns" or "rows" -> specifies whether the ideal number and @@ -2699,11 +2698,11 @@ \pgfooset{ideal}{#2} \pgfooset{max}{#3} \pgfooset{strategy}{#4} - } + }% % Method \method default connects() { - } + }% % Method \method add entry(#1) { @@ -2711,19 +2710,19 @@ \c@pgf@counta=\pgfoovalueof{number of entries}\relax% \advance\c@pgf@counta by1\relax% \pgfooeset{number of entries}{\the\c@pgf@counta} - } + }% % Method \method get arrangement(#1) { { - % + % % Step 1: Compute the desired number of rows or columns - % - % + % + % % Compute the ideal number of entries per row/column (called % "target" in the following) and entries per colum/row (called % "per target" in the following) - % + % % if (number of entries > ideal) \ifnum\pgfoovalueof{number of entries}>\pgfoovalueof{ideal}\relax% % { @@ -2762,9 +2761,9 @@ \c@pgf@counta=\pgfoovalueof{number of entries}\relax% \c@pgf@countb=1\relax% \fi% - % - % Ensure that counta = rows, countb = columns - % + % + % Ensure that counta = rows, countb = columns + % \pgfooget{columns or rows}\pgf@temp \ifx\pgf@temp\pgf@dv@columnstext% \c@pgf@countc=\c@pgf@counta\relax @@ -2772,14 +2771,14 @@ \c@pgf@countb=\c@pgf@countc\relax \fi %\edef\temp{rows: \the\c@pgf@counta, columns: \the\c@pgf@countb}\temp - % - % Now arrange the matrix - % + % + % Now arrange the matrix + % \csname pgf@dv@legend@init@\pgfoovalueof{strategy}\endcsname \expandafter\let\expandafter\pgf@dv@updater\csname pgf@dv@legend@update@\pgfoovalueof{strategy}\endcsname \pgfooget{entries}\pgf@temp \expandafter\pgf@dv@legend@arrange\pgf@temp\pgf@stop - % + % % Now assemble the matrix % \edef\pgf@dv@row@list{1,...,\the\c@pgf@counta} @@ -2807,24 +2806,24 @@ } \let#1\pgf@dv@matrix \global\let\pgf@dv@matrix\relax - } - - \def\pgf@dv@first@mark{\pgf@dv@first@mark} - + }% + + \def\pgf@dv@first@mark{\pgf@dv@first@mark}% + \def\pgf@dv@legend@arrange{% \pgfutil@ifnextchar\pgf@stop{\pgfutil@gobble}{\pgf@dv@legend@handle@entry} - } + }% \def\pgf@dv@legend@handle@entry#1{ \expandafter\def\csname pgf@dv@legend@entry@\the\c@pgf@countc @\the\c@pgf@countd\endcsname{#1}% \pgf@dv@updater% \pgf@dv@legend@arrange% - } + }% \expandafter\def\csname pgf@dv@legend@init@down then right\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=1\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@down then right\endcsname{% \advance\c@pgf@countc by1\relax @@ -2832,25 +2831,25 @@ \c@pgf@countc=1\relax% \advance\c@pgf@countd by1\relax% \fi% - } + }% \expandafter\def\csname pgf@dv@legend@init@right then down\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=1\relax% - } - + }% + \expandafter\def\csname pgf@dv@legend@update@right then down\endcsname{% \advance\c@pgf@countd by1\relax \ifnum\c@pgf@countd>\c@pgf@countb\relax% \c@pgf@countd=1\relax% \advance\c@pgf@countc by1\relax% \fi% - } + }% \expandafter\def\csname pgf@dv@legend@init@up then right\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=1\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@up then right\endcsname{% \advance\c@pgf@countc by-1\relax @@ -2858,12 +2857,12 @@ \c@pgf@countc=\c@pgf@counta\relax% \advance\c@pgf@countd by1\relax% \fi% - } - + }% + \expandafter\def\csname pgf@dv@legend@init@right then up\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=1\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@right then up\endcsname{% \advance\c@pgf@countd by1\relax @@ -2871,12 +2870,12 @@ \c@pgf@countd=1\relax% \advance\c@pgf@countc by-1\relax% \fi% - } - + }% + \expandafter\def\csname pgf@dv@legend@init@left then up\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=\c@pgf@countb\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@left then up\endcsname{% \advance\c@pgf@countd by-1\relax @@ -2884,12 +2883,12 @@ \c@pgf@countd=\c@pgf@countb\relax% \advance\c@pgf@countc by-1\relax% \fi% - } - + }% + \expandafter\def\csname pgf@dv@legend@init@up then left\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=\c@pgf@countb\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@up then left\endcsname{% \advance\c@pgf@countc by-1\relax @@ -2897,12 +2896,12 @@ \c@pgf@countc=\c@pgf@counta\relax% \advance\c@pgf@countd by-1\relax% \fi% - } - + }% + \expandafter\def\csname pgf@dv@legend@init@left then down\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=\c@pgf@countb\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@left then down\endcsname{% \advance\c@pgf@countd by-1\relax @@ -2910,12 +2909,12 @@ \c@pgf@countd=\c@pgf@countb\relax% \advance\c@pgf@countc by1\relax% \fi% - } - + }% + \expandafter\def\csname pgf@dv@legend@init@down then left\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=\c@pgf@countb\relax% - } + }% \expandafter\def\csname pgf@dv@legend@update@down then left\endcsname{% \advance\c@pgf@countc by1\relax @@ -2923,10 +2922,10 @@ \c@pgf@countc=1\relax% \advance\c@pgf@countd by-1\relax% \fi% - } - - \def\pgf@dv@columnstext{columns} -} + }% + + \def\pgf@dv@columnstext{columns}% +}% @@ -2935,17 +2934,17 @@ % \pgfooclass{interval} -{ +{% % Class interval % % Instances of this class store intervals. When either the min or % the max value is empty, this corresponds to "not yet set", (not to - % "infinity). + % "infinity). - \attribute min; + \attribute min;% % The minimum value of the interval - - \attribute max; + + \attribute max;% % The maximum value of the interval % Constructor @@ -2956,25 +2955,25 @@ \method interval(#1,#2) { \pgfooset{min}{#1} \pgfooset{max}{#2} - } + }% % Method \method default connects() { - } + }% % Sets the minimum/maximum to a new value \method set min(#1) { \pgfooset{min}{#1} - } + }% \method set max(#1) { \pgfooset{max}{#1} - } + }% \method let min(#1) { \pgfoolet{min}{#1} - } + }% \method let max(#1) { \pgfoolet{max}{#1} - } + }% % Getter % @@ -2983,9 +2982,9 @@ \method get min and max() { \pgfooget{min}\pgfdvmin \pgfooget{max}\pgfdvmax - } + }% - % Adjusts the mimum and maximum values + % Adjusts the minimum and maximum values % % #1 = some code. When this code is executed, the values of % \pgfdvmin and \pgfdvmax will be set to the current values of @@ -3002,13 +3001,13 @@ \pgfoolet{min}\pgfdvmin \pgfoolet{max}\pgfdvmax }% - } -} + }% +}% \pgfooclass{count} -{ +{% % Class count % % This class can be used to count the number of data points that are @@ -3018,70 +3017,70 @@ % the counter. You can specify that certain data points should % not have an effect on the counter. - - \attribute attribute; + + \attribute attribute;% % The attribute that will be set to the current value of the counter - - \attribute val=0; + + \attribute val=0;% % The current value of the counter - - \attribute max=0; + + \attribute max=0;% % The current value of the counter - - \attribute step=1; + + \attribute step=1;% % The stepping by which the counter is incremented for each % datapoint - - \attribute start val=0; + + \attribute start val=0;% % The start value of the counter - \attribute filter=; + \attribute filter=;% % This attribute stores some code that is executed for each % data point. If the data point sets the TeX-if ifpgfdvfilterpassed to % true, then the counter is not incremented. - + % Constructor % % #1 = The attribute in which the counter value is stored % \method count(#1) { \pgfooset{attribute}{#1} - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } + }% % Getter \method get max(#1) { \pgfooget{max}{#1} - } + }% % Setter \method set value(#1) { \pgfooset{val}{#1} \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute}}{#1}% - } + }% % Setter \method set start value(#1) { \pgfooset{start val}{#1} \pgfooset{max}{#1} - } + }% % Setter \method set filter(#1) { \pgfooset{filter}{#1} - } + }% % Setter \method set step(#1) { \pgfooset{step}{#1} - } + }% % Slot \method apply() { @@ -3097,17 +3096,17 @@ \pgfooget{max}\pgfmathresult% \pgfkeyslet{/data point/\pgfoovalueof{attribute}/max}\pgfmathresult% \fi% - } + }% - % Slot + % Slot \method phase(#1) { \ifx#1\pgfdvbeginsurvey \pgfooeset{val}{\pgfoovalueof{start val}} \else \ifx#1\pgfdvbeginvisualization \pgfooeset{val}{\pgfoovalueof{start val}} \fi\fi - } -} + }% +}% \newif\ifpgfdvfilterpassed @@ -3115,7 +3114,7 @@ \pgfooclass{accumulator} -{ +{% % Class accumulator % % This class is used to keep track of the sum of the values of some @@ -3124,12 +3123,12 @@ % all previous data points with respect to this % attribute. Furthermore, the subkey attribute/prev key will hold % the previous sum, which is sometimes also useful to have access - % to. + % to. - \attribute attribute; + \attribute attribute;% % The attribute to-be-accumulated - - \attribute sum; + + \attribute sum;% % The initial value of the sum % Constructor @@ -3138,19 +3137,19 @@ \method accumulator(#1) { \pgfooset{attribute}{#1} \pgfoothis.reset() - } + }% % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - } + }% % Slot \method apply() {% % Save old sum - \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/sum}\pgf@temp% + \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/sum}\pgf@temp% \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}\pgf@temp% % Add new attribute... \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}{\pgf@temp@b}% @@ -3162,7 +3161,7 @@ % Record in attribute \pgfdvmathexitbyscientificformat{\pgf@dv@serial@sum}{\pgf@dv@sum} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}\pgf@dv@serial@sum - } + }% % Method % @@ -3174,7 +3173,7 @@ \pgfdvmathexitbyserializing{\pgf@dv@zero}{\pgf@dv@temp} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}{\pgf@dv@zero} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}{\pgf@dv@zero} - } + }% % Slot \method phase(#1) { @@ -3183,8 +3182,8 @@ \else \ifx#1\pgfdvbeginvisualization \pgfoothis.reset() \fi\fi - } -} + }% +}% @@ -3204,19 +3203,13 @@ /data point/always 0/.initial=0, /data point/always 1/.initial=1, /data point/always empty/.initial=, - /data point/always pgfusepath stroke/.initial=\pgfusepath{stroke} -} + /data point/always pgfusepath stroke/.initial=\pgfusepath{stroke}, +}% -\pgfdvmathenter{\pgfdvmathalwaysloge}{0.434294481903252} -\pgfdvmathenter{\pgfdvmathalwayslnten}{2.302585092994046} -\pgfdvmathenter{\pgfdvmathalwayszero}{0} -\pgfdvmathenter{\pgfdvmathalwaysone}{1} +\pgfdvmathenter{\pgfdvmathalwaysloge}{0.434294481903252}% +\pgfdvmathenter{\pgfdvmathalwayslnten}{2.302585092994046}% +\pgfdvmathenter{\pgfdvmathalwayszero}{0}% +\pgfdvmathenter{\pgfdvmathalwaysone}{1}% \endinput - - - - - - |