WebRoot/FusionChartsFree/Contents/JS_changeChart.html
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FusionCharts Free Documentation</title>
<link rel="stylesheet" href="Style.css" type="text/css" />
</head>
<body>
<table width="98%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td><h2 class="pageHeader">Changing chart at client side </h2></td>
</tr>
<tr>
<td valign="top" class="text"><p>Using a combination of FusionCharts and JavaScript, you can simulate of process of dynamic chart type change at client side, without involving any page refreshes. That is, at client side, you can change chart type, from say column chart to pie chart or line chart, and provide it same or new data, without refreshing the page. </p>
<p>We do the same using the following concepts:</p>
<ul>
<li>Load the first FusionCharts chart (say column chart) using JavaScript embedding method in a DIV called <span class="codeInline">chart1Div</span>. Now, internally, while rendering the chart, FusionCharts JavaScript class actually replaces the <span class="codeInline">innerHTML</span> of this DIV to include the chart at runtime.</li>
<li>When the chart type needs to be changed, create another chart instance object and render it again in the same DIV. The browser will again replace the <span class="codeInline">innerHTML</span> of the DIV (existing chart) with the new chart.</li>
<li>As such, the user will get the effect of dynamic chart change at client side.</li>
</ul>
<p>Let's quickly see this in an example.</p>
<p class="highlightBlock">This example is present in Download Package > Code > ChartChange > ChartChange.html.</p> </td>
</tr>
<tr>
<td valign="top" class="text"> </td>
</tr>
<tr>
<td valign="top" class="header">Code in ChartChange.html </td>
</tr>
<tr>
<td valign="top" class="text">ChartChange.html contains the following code: </td>
</tr>
<tr>
<td valign="top" class="codeBlock"><p><HTML><br />
<HEAD><br />
<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT><br />
<SCRIPT LANGUAGE="JavaScript"><br />
<span class="codeComment"> //We store the XML data as a string</span><br />
<strong>var strXML = "<graph caption='Hours worked' showNames='1'><set name='Tom' value='32' color='AFD8F8'/><set name='Mary' value='16' color='F6BD0F'/><set name='Jane' value='42' color='8BBA00'/></graph>";</strong><br />
<span class="codeComment">/*<br />
* updateChart method is called, when user clicks the button<br />
* Here, we change the chart from Column to line or pie (based on what SWF<br />
* has been passed). <br />
*/</span><br />
<strong>function updateChart(chartSWF){<br />
//Create another instance of the chart.<br />
var chart1 = new FusionCharts(chartSWF, "chart1Id", "400", "300", "0", "0"); <br />
chart1.setDataXML(strXML);<br />
chart1.render("chart1div");<br />
}</strong><br />
</SCRIPT><br />
</HEAD><br />
<BODY><br />
<strong><div id="chart1div"><br />
FusionCharts<br />
</div></strong><br />
<strong><script language="JavaScript"> <br />
var chart1 = new FusionCharts("../../FusionCharts/FCF_Column3D.swf", "chart1Id", "400", "300", "0", "0");<br />
chart1.setDataXML(strXML);<br />
后面还有 28 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。