?? overlay.html
字號:
<HTML>
<body bgcolor="#ffffff" topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
<table cellspacing=0 cellpadding=5 border=0 width=100%>
<tr bgcolor="#c6d3f7"><td>
<font face="Arial,Verdana,Helvetica" size=-2>
<b>
<a href="../index.html">main</a> |
<a href="index.html">documentation</a> |
<a href="../examples/index.html">examples</a> |
<a href="../presales_questions.html">common questions</a> |
<a href="../changes.html">changes</a> |
<a href="http://objectplanet.com/EasyCharts/license_details.html">licensing</a>
</b>
</font>
</td>
</tr>
</table>
<table BORDER=0 CELLSPACING=0 CELLPADDING=10 WIDTH=700>
<tr>
<td>
<font face="Arial,Verdana,Helvetica" size=-1 color="#333333">
<p><br>
<font size=-0>
<b>EASYCHARTS DOCUMENTATION : OVERLAY CHARTS</b>
</font>
</td>
</tr>
<tr>
<td>
<font face="Arial,Verdana,Helvetica" size=-1 color="#333333">
<a href="#single_overlays">1. Single overlays</b><br>
<a href="#multiple_overlays">2. Multiple overlays</b><br>
<a href="#double_ranges">3. Double ranges</b><br>
<a href="#complex_overlay_chart">4. Complex overlay chart</b><br>
<p>
<a name="overlay_introduction">
<p>
By using overlays, you can place one or more charts on top of another chart.
<p>
When placing a chart on top of another chart, the overlay chart only
paints it's data, the legend, title and so on are not painted.
The bottom chart (from here on called the base chart) paints the
other chart elements such as labels and grids and controls the size
of the chart.
<p>
You can overlay any chart or chart type on top of another chart. In an
applet this is done using the <code><font size=-0>overlay</font></code>
parameter. In a java application the chart is added using the
<code><font size=-0>addOverlayChart()</font></code> method.
<p>
Adding an overlay chart in an applet:
<p>
<param name=overlay value="bar"><br>
<param name=overlay value="line"><br>
<param name=overlay value="pie"><br>
<p>
The parameters of the overlay chart is set by adding an overlay_ prefix
to each parameter.
<p>
<param name=overlay value="bar"><br>
<param name=overlay_sampleValues value="20,10,40,30,50"><br>
<param name=overlay_sampleColors value="red"><br>
<p>
<a name="single_overlays">
<br>
<b>1. Single Overlays</b>
<br>
This example adds a line chart on top of a bar chart. A line chart
that is added on top of a bar chart will have it's grid adjusted
so the line's sample points will correspond to the center of the
bars.
<p>
<b>Applet:</b>
<p>
<img src="images/overlay/bar_line.gif" width=200 height=140 align=right>
<code><font size=-0>
<applet code=com.objectplanet.chart.ChartApplet<br>
archive=chart.jar width=200 height=140><br>
<param name=chart value="bar"><br>
<param name=sampleValues value="10,20,30,40,50"><br>
<param name=<b>overlay</b> value="<b>line</b>"><br>
<param name=<b>overlay_sampleValues</b> value="20,10,40,30,45"><br>
<param name=<b>overlay_sampleColors</b> value="red"><br>
</applet><br>
</code></font>
<p>
<b>Servlet:</b>
<p>
<code><font size=-0>
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?<br>
chart=bar&<br>
width=200&<br>
height=140&<br>
sampleValues=10,20,30,40,50&<br>
<b>overlay=line</b>&<br>
<b>overlay_sampleValues=20,10,40,30,45</b>&<br>
<b>overlay_sampleColors=red</b><br>
">
</code></font>
<p>
<b>Java:</b>
<font size=-0>
<pre>
// create base chart
double[] values = new double[] {10,20,30,40,50};
BarChart base = new BarChart();
base.setSampleCount(values.length);
base.setSampleValues(0, values);
base.setRange(0,50);
// create overlay chart
double[] overlay_values = new double[] {20,10,40,30,45};
LineChart overlay = new LineChart();
overlay.setSampleCount(overlay_values.length);
overlay.setSampleValues(0, overlay_values);
overlay.setSampleColor(0, Color.red);
// add overlay chart, the ranges of the overlay chart will
// automatically be adjusted to the base chart's range
base.addOverlayChart(overlay);
</pre>
</font>
<p><br>
This example adds a bar chart on top of a line chart.
<p>
<b>Applet:</b>
<p>
<img src="images/overlay/line_bar.gif" width=200 height=140 align=right>
<code><font size=-0>
<applet code=com.objectplanet.chart.ChartApplet<br>
archive=chart.jar width=200 height=140><br>
<param name=chart value="line"><br>
<param name=sampleValues value="20,10,40,30,45"><br>
<param name=<b>overlay</b> value="<b>bar</b>"><br>
<param name=<b>overlay_sampleValues</b> value="10,20,30,40,50"><br>
<param name=<b>overlay_sampleColors</b> value="red"><br>
</applet><br>
</font></code>
<p>
<b>Servlet:</b>
<p>
<code><font size=-0>
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?<br>
chart=line&<br>
width=200&<br>
height=140&<br>
sampleValues=20,10,40,30,45&<br>
<b>overlay=bar</b>&<br>
<b>overlay_sampleValues=10,20,30,40,50</b>&<br>
<b>overlay_sampleColors=red</b>&<br>
">
</font></code>
<p>
<b>Java:</b>
<font size=-0>
<pre>
// create base chart
double[] values = new double[] {20,10,40,30,45};
LineChart base = new LineChart();
base.setSampleCount(values.length);
base.setSampleValues(0, values);
base.setRange(0,50);
// create overlay chart
double[] overlay_values = new double[] {10,20,30,40,50};
BarChart overlay = new BarChart();
overlay.setSampleCount(overlay_values.length);
overlay.setSampleValues(0, overlay_values);
overlay.setSampleColor(0, Color.red);
// add overlay chart
base.addOverlayChart(overlay);
</pre>
</font>
<p><br>
This example adds a bar chart on top of another bar chart.
<p>
<b>Applet:</b>
<p>
<img src="images/overlay/bar_bar.gif" width=200 height=140 align=right>
<code><font size=-0>
<applet code=com.objectplanet.chart.ChartApplet<br>
archive=chart.jar width=200 height=140><br>
<param name=chart value="bar"><br>
<param name=sampleValues value="10,20,30,40,50"><br>
<param name=barWidth value="0.6"><br>
<param name=<b>overlay</b> value="<b>bar</b>"><br>
<param name=<b>overlay_sampleValues</b> value="28,46,34,45,37"><br>
<param name=<b>overlay_sampleColors</b> value="red"><br>
<param name=<b>overlay_barWidth</b> value="0.3"><br>
</applet>
</font></code>
<p>
<b>Servlet:</b>
<p>
<code><font size=-0>
<img src="http://localhost:8080/servlet/com.objectplanet.chart.ChartServlet?<br>
chart=bar&<br>
width=200&<br>
height=140&<br>
sampleValues=10,20,30,40,50&<br>
barWidth=0.6&<br>
<b>overlay=bar</b>&<br>
<b>overlay_sampleValues=28,46,34,45,37</b>&<br>
<b>overlay_sampleColors=red</b>&<br>
<b>overlay_barWidth=0.3</b>&<br>
">
</font></code>
<p>
<b>Java:</b>
<font size=-0>
<pre>
// create base chart
double[] values = new double[] {10,20,30,40,50};
BarChart base = new BarChart();
base.setSampleCount(values.length);
base.setSampleValues(0, values);
base.setRange(0,50);
base.setBarWidth(0.6);
// create overlay chart
double[] overlay_values = new double[] {28,46,34,45,37};
BarChart overlay = new BarChart();
overlay.setSampleCount(overlay_values.length);
overlay.setSampleValues(0, overlay_values);
overlay.setSampleColor(0, Color.red);
overlay.setBarWidth(0.3);
// add overlay chart
base.addOverlayChart(overlay);
</pre>
</font>
<p>
<a name="multiple_overlays">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -