登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

学无止境

一点积累,与大家分享

 
 
 

日志

 
 

Amcharts 实现动态曲线图  

2010-09-26 16:57:04|  分类: jsp技术 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

首先是amline_setting.xml的配置

<?xml version="1.0" encoding="UTF-8"?>
<!-- Value between [] brackets, for example [#FFFFFF] shows default value which is used if this parameter is not set -->
<!-- This means, that if you are happy with this value, you can delete this line at all and reduce file size -->
<!-- value or explanation between () brackets shows the range or type of values you should use for this parameter -->
<!-- the top left corner has coordinates x = 0, y = 0                                                                -->
<!-- "!" before x or y position (for example: <x>!20</x>) means that the coordinate will be calculated from the right side or the bottom -->
<settings>
  <data_type>xml</data_type>
  <reload_data_interval>1</reload_data_interval>
  <add_time_stamp>true</add_time_stamp>
  <digits_after_decimal>2</digits_after_decimal>
 <plot_area>
  <border_alpha>100</border_alpha>
  <border_color>DAF0FD</border_color>
 <margins>
  <top>10</top>
  <bottom>30</bottom>
  <left>5</left>
  <right>3</right>
  </margins>
  </plot_area>
 <grid>
 <x>
  <color>38AEE0</color>
  <alpha>100</alpha>
  </x>
 <y_left>
  <color>38AEE0</color>
  <alpha>100</alpha>
  </y_left>
  </grid>
 <axes>
 <x>
  <width>1</width>
  <color>DAF0FD</color>
  </x>
 <y_left>
  <alpha>0</alpha>
  </y_left>
  </axes>
 <values>
 <x>
  <skip_first>false</skip_first>
  <skip_last>false</skip_last>
  </x>
 <y_left>
  <min>50</min>
  <max>70</max>
  <unit>$</unit>
  <unit_position>left</unit_position>
  <inside>true</inside>
  <skip_last>true</skip_last>
  </y_left>
  </values>
 <indicator>
  <zoomable>false</zoomable>
  <color>357BBC</color>
  <x_balloon_text_color>FFFFFF</x_balloon_text_color>
  <y_balloon_on_off>false</y_balloon_on_off>
  </indicator>
 <legend>
  <enabled>false</enabled>
  </legend>
<graphs>
 <graph>
  <color>357BBC</color>
  <bullet>round_outlined</bullet>
 </graph>
</graphs>
  </settings>

然后是数据文件的配置 datas.jsp:

<%@ page language="java" import="java.util.*"%>
<?xml version="1.0" encoding="UTF-8"?>
<chart>
<series>
<%
       for(int i=0;i<300;i++)
       {
        Date date=new Date();
  String []strdate=date.toString().split(" ");
  String subdate=strdate[3];
%>
<value xid="<%=i%>"><%=subdate%></value>
<%
        Thread.sleep(1);
       }
%>
</series>
<graphs>
<graph gid="1">
<%
  for(int j=0;j<300;j++)
  {
    double num1=Math.random()*(63.00-55.00)+55.00 ;
  String num2=String.valueOf(num1).substring(0, 5);
%>
<value xid="<%=j%>"><%=num2%></value>
<%
  }
%>
</graph>

 </graphs>
</chart>

最后到页面显示配置 amline.jsp:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
    <title>My JSP 'index.jsp' starting page</title>
 
 <!--
 <link rel="stylesheet" type="text/css" href="styles.css">
 -->
  <script type="text/javascript" src="amline/swfobject.js"></script>
  </head>
 
  <body>
  
   
     <div id="flashcontent">
 显示
  <strong>You need to upgrade your Flash Player</strong>
 </div>
 <script type="text/javascript">
  // <![CDATA[ 
  var so = new SWFObject("amline/amline.swf", "amline", "800", "600", "8", "#FFFFFF");
  so.addVariable("path", "amline/");
  so.addVariable("settings_file", escape("amline/amline_settings.xml")); 
  so.addVariable("data_file", "datas.jsp"); 
  so.addVariable("preloader_color", "#999999");
  so.write("flashcontent");
  // ]]>
 </script>
  </body>
</html>

 

  评论这张
 
阅读(1666)| 评论(0)

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018