📄 php-swf charts tutorial chart_source.htm
字号:
the browser would display the numbers and strings related to the
chart. Use the browser's <B>View Source</B> command to view the
chart expressed in XML code.</P>
<P> </P>
<HR color=#888888 noShade SIZE=1>
<P><B>Caching</B></P>
<P>If a chart's source is dynamic (changes over time), some browsers
might download only one instance of the source file, cache it, then
display the same chart repeatedly. To prevent browsers from caching
a dynamic source file, append any unique value to its URL to keep it
new. This value must be added programmatically to change with every
page reload. This could be the time in microseconds, or any random
number:</P><!-- PHP -------------------------------------->
<P></P>
<TABLE cellPadding=10 border=0>
<TBODY>
<TR>
<TD class=php><FONT size=3><PRE><HTML>
<BODY bgcolor="#FFFFFF">
<?php
include "charts.php";
echo InsertChart ( "charts.swf", "charts_library", "sample.php?uniqueID=" . uniqid(rand(),true) );
?>
</BODY>
</HTML>
</PRE></FONT></TD></TR></TBODY></TABLE>
<P></P><!-- PHP -------------------------------------->
<P> </P>
<HR color=#888888 noShade SIZE=1>
<P><B>Central Chart Source</B></P>
<P>You may create a different chart source for each chart on your
web site like this:
<!-- PHP --------------------------------------></P>
<TABLE cellPadding=10 border=0>
<TBODY>
<TR>
<TD class=php><FONT size=3><PRE><HTML>
<BODY bgcolor="#FFFFFF">
<?php
include "charts.php";
<FONT color=#888888>//insert 3 different charts into the web page with 3 different chart sources</FONT>
echo InsertChart ( "charts.swf", "charts_library", "sample_1.php" );
echo InsertChart ( "charts.swf", "charts_library", "sample_2.php" );
echo InsertChart ( "charts.swf", "charts_library", "sample_3.php" );
?>
</BODY>
</HTML>
</PRE></FONT></TD></TR></TBODY></TABLE>
<P></P><!-- PHP -------------------------------------->
<P> </P>It's also possible to create one central chart source
to generate the data for multiple or all charts like this:
<P></P><!-- PHP -------------------------------------->
<P></P>
<TABLE cellPadding=10 border=0>
<TBODY>
<TR>
<TD class=php><FONT size=3><PRE><HTML>
<BODY bgcolor="#FFFFFF">
<?php
include "charts.php";
<FONT color=#888888>//insert 3 different charts into the web page with one chart source</FONT>
echo InsertChart ( "charts.swf", "charts_library", "sample.php?chart_id=1" );
echo InsertChart ( "charts.swf", "charts_library", "sample.php?chart_id=2" );
echo InsertChart ( "charts.swf", "charts_library", "sample.php?chart_id=3" );
?>
</BODY>
</HTML>
</PRE></FONT></TD></TR></TBODY></TABLE>
<P></P><!-- PHP -------------------------------------->
<P> </P>
<P>The <B>sample.php</B> source might process and generate the
chart's data like this:</P><!-- PHP -------------------------------------->
<P></P>
<TABLE cellPadding=10 border=0>
<TBODY>
<TR>
<TD class=php><FONT size=3><PRE>
<?php
<FONT color=#888888>//include charts.php in your script</FONT>
include "charts.php";
<FONT color=#888888>//process the chart for each chart id</FONT>
switch ( $_REQUEST['chart_id'] ){
case 1:
$chart [ 'chart_type' ] = "column";
break;
case 2:
$chart [ 'chart_type' ] = "bar";
break;
case 3:
$chart [ 'chart_type' ] = "line";
break;
}
<FONT color=#888888>//send the chart data to the charts.swf flash file</FONT>
SendChartData ( $chart );
?>
</PRE></FONT></TD></TR></TBODY></TABLE>
<P></P><!-- PHP -------------------------------------->
<P> </P>
<HR color=#888888 noShade SIZE=1>
<P><B>PHP, ASP, CFML, Perl, etc.</B></P>
<P><B>PHP/SWF Charts</B> uses PHP to generate charts. However, any
scripting language (PHP, Perl, ASP, CFML, etc.) can be used with
<U><A class=link
href="http://www.maani.us/xml_charts/index.php">XML/SWF
Charts</A></U> (the XML version of the same tool.) <B>PHP/SWF
Charts</B> and <U><A class=link
href="http://www.maani.us/xml_charts/index.php">XML/SWF
Charts</A></U> share the same <B>charts.swf</B> file, and the same
license. One license runs either or both tools.</P>
<P>See the <U><A class=link
href="http://www.maani.us/xml_charts/index.php?menu=Tutorial">XML/SWF
Charts</A></U> tutorial for more information.</P>
<P> </P>
<HR color=#888888 noShade SIZE=1>
<P><B>What Next?</B></P>
<P>Next, explore the <U><A class=link
href="http://www.maani.us/charts/index.php?menu=Reference">reference</A></U>
section. The reference section lists and describes all the variables
used to modify all the chart attributes.</P>
<P>For chart examples, explore the <U><A class=link
href="http://www.maani.us/charts/index.php?menu=Gallery">gallery</A></U>
section and click on each chart to see its code.</P>
<P> </P>
<P></P>
<TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR class=prev_next>
<TD align=left> <A
href="http://www.maani.us/charts/index.php?menu=Tutorial&submenu=Chart_Attributes"><B><
previous</B></A></TD>
<TD align=right> </TD></TR></TBODY></TABLE>
<P></P></TD><!--
google =========================================================
<td><img src="graphics/blank.gif" width=40></td><td valign=top bgcolor=eeeeee>
</td>
google =========================================================
--></TR></TBODY></TABLE><!-- body end --></TD></TR>
<TR>
<TD align=middle colSpan=2 height=10><!-- footer start ========================================================= -->
<HR color=#000000 noShade SIZE=2>
<SMALL>Copyright ? 2003-2007, maani.us</SMALL>
<!-- footer end --></TD></TR></TBODY></TABLE>
<P> </P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -