You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
5.8 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Adding marker lines to the matrix plot</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch22.html" title="Chapter 22. Matrix graphs"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding marker lines to the matrix plot</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 22. Matrix graphs</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Adding marker lines to the matrix plot"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2593845"></a>Adding marker lines to the matrix plot</h2></div></div></div>
<p>
</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>This feature was added in 3.1.1p</p>
</div><p>
</p>
<p>In order to mark important divisions in the plot it is possible to add an instance of
<code class="code">class PlotLine</code> (either horizontal or vertical line) to each plot in the
graph. For example, to add one vertical and one horizontal plot line the following lines
can be added to the matrix script</p>
<p>
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-var">$mp</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">MatrixPlot</span><span class="hl-brackets">(</span><span class="hl-var">$data</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Create two lines to add as markers</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$l1</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">PlotLine</span><span class="hl-brackets">(</span><span class="hl-identifier">VERTICAL</span><span class="hl-code">, </span><span class="hl-number">5</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">lightgray:1.5</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-number">4</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$l2</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">PlotLine</span><span class="hl-brackets">(</span><span class="hl-identifier">HORIZONTAL</span><span class="hl-code">, </span><span class="hl-number">3</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">lightgray:1.5</span><span class="hl-quotes">'</span><span class="hl-code">, </span><span class="hl-number">4</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> Add lines to the plot</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-var">$mp</span><span class="hl-code">-&gt;</span><span class="hl-identifier">AddLine</span><span class="hl-brackets">(</span><span class="hl-var">$l1</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$mp</span><span class="hl-code">-&gt;</span><span class="hl-identifier">AddLine</span><span class="hl-brackets">(</span><span class="hl-var">$l2</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-comment">//</span><span class="hl-comment"> this could also be done as</span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> $mp-&gt;AddLine(array($l1,$l2));</span><span class="hl-comment"></span><span class="hl-code">
...
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
</p>
<p>The example in <a class="xref" href="ch22s06.html#fig.matrix_ex06" title="Figure 22.11. Adding plot lines to the matrix plot (matrix_ex06.php)">Figure 22.11. Adding plot lines to the matrix plot <code class="uri"><a class="uri" href="example_src/matrix_ex06.html" target="_top">(<code class="filename">matrix_ex06.php</code>)</a></code> </a> shows an example of this</p>
<p>
</p><div class="figure"><a name="fig.matrix_ex06"></a><p class="title"><b>Figure 22.11. Adding plot lines to the matrix plot <code class="uri"><a class="uri" href="example_src/matrix_ex06.html" target="_top">(<code class="filename">matrix_ex06.php</code>)</a></code> </b></p><div class="figure-contents"> <span class="inlinemediaobject"><img src="images/matrix_ex06.png" alt="Adding plot lines to the matrix plot (matrix_ex06.php)"></span> </div></div><p><br class="figure-break">
</p>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch22.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>