Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2
<HTML>
3
<HEAD>
4
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
5
<LINK REL="Start" HREF="index.html">
6
<LINK REL="Contents" HREF="toc.html">
7
<LINK REL="Prev" HREF="816Usingabackgroundgradient.html">
8
<LINK REL="Next" HREF="818Rotatinggraphs90degrees.html">
9
<STYLE TYPE="text/css"><!--
10
BODY { font-family: serif }
11
H1 { font-family: sans-serif }
12
H2 { font-family: sans-serif }
13
H3 { font-family: sans-serif }
14
H4 { font-family: sans-serif }
15
H5 { font-family: sans-serif }
16
H6 { font-family: sans-serif }
17
SUB { font-size: smaller }
18
SUP { font-size: smaller }
19
PRE { font-family: monospace }
20
A { text-decoration: none }
21
--></STYLE>
22
</HEAD>
23
<BODY>
24
<A HREF="toc.html">Contents</A>
25
<A HREF="816Usingabackgroundgradient.html">Previous</A>
26
<A HREF="818Rotatinggraphs90degrees.html">Next</A>
27
<HR NOSHADE>
28
<H2><A NAME="8_17">8.17 Using callbacks for Plot marks</A></H2>
29
<P> An interesting enhancement when using Plotmarks is the possibility
30
 to add a callback function to control the size and color of the
31
 plotmarks.</P>
32
<P> This callback function will get called with the current Y-value (for
33
 the plotmark) as it's argument. As return value the callback function
34
 must return an array containing three (possible null) values. The
35
 values returned must be</P>
36
<OL>
37
<LI> Plot mark Weight</LI>
38
<LI> Plot mark Color</LI>
39
<LI> Plot mark Fill color</LI>
40
</OL>
41
<P> The exact meaning of the parameters will of course depend on the
42
 type of plot marks being used.</P>
43
<P> The callback must be a global function and is installed with a call
44
 to <A href="../ref/PlotMark.html#_PLOTMARK_SETCALLBACK">
45
 PlotMark::SetCallback()</A></P>
46
<P> So for example to install a callback that changes the fill color for
47
 all marks with a (Y) value higher than 90 you could add the lines</P>
48
<P>
49
<!--?
50
$t='function MarkCallback($aVal) {
51
    if( $aVal -->
52
 90) $fcolor=&quot;red&quot; else $fcolor=&quot;&quot;; return array(&quot;&quot;,&quot;&quot;,$fcolor); } ...
53
 $plot-&gt;mark-&gt;SetCallback(&quot;MarkCallback&quot;); ...'; ShowCodeSnippet($t); ?&gt;</P>
54
<P> As you can see in the above example we have left some of the return
55
 values blank. Doing this will just ignore any change of these value and
56
 use the global settings for the plotmarks.</P>
57
<P> If you also let the (Y) value affect the size of the plot marks you
58
 can get what is sometimes known as a &quot;balloon plot&quot;. The example below
59
 is basically a scatter plot that uses filled circles to mark the
60
 points. A format callback is then used to change the color and size
61
 depending on the Y-value for each plot.</P>
62
<P><DIV class="example">
63
<BR> <A href="exframes/frame_balloonex1.html" target="blank"><IMG border="0"
64
HEIGHT="300"  src="img/balloonex1.png" WIDTH="400"></A>
65
<BR><B>Figure 92:</B> Creating a balloon plot by using plot mark
66
 callback function <A href="exframes/frame_balloonex1.html" target="blank">
67
[src]</A>&nbsp;
68
<P></P>
69
</DIV></P>
70
<P></P>
71
<HR NOSHADE>
72
<A HREF="toc.html">Contents</A>
73
<A HREF="816Usingabackgroundgradient.html">Previous</A>
74
<A HREF="818Rotatinggraphs90degrees.html">Next</A>
75
</BODY>
76
</HTML>