⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cewolfxy5.jsp

📁 提供 精通Java Web动态图表编程 一书的源代码, 大家赶快下载呀
💻 JSP
字号:
<!--
	Fig. 8.4_04_05: CewolfXY5.jsp
	功能: Cewolf 编程实例17: 基于XYDataset的直方图
-->
<%@ page contentType="text/html;charset=GB2312"%>
<%@ include file="CewolfXYDataset.jsp" %>

<%
// 创建数据集
DatasetProducer timeData = new DatasetProducer()
{
  public Object produceDataset(Map params)
  {
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    TimeSeries ts = new TimeSeries("2004年国际原油月均价格", Month.class);
    double price = 45.75;
    for (int month = 1; month <= 12; month++)
    {
      // 生成原油价格
      price += Math.random() * 10-5.5;
      ts.add(new Month(month, 2004), price);
    }
    dataset.addSeries(ts);

    return dataset;
  }

  public String getProducerId()
  {
    return "TimeDataProducer";
  }

  public boolean hasExpired(Map params, Date since)
  {
    return false;
  }
};
pageContext.setAttribute("timeData", timeData);
%>

<HTML>
 <HEAD>
       <TITLE>Cewolf 编程实例17: 基于XYDataset的直方图</TITLE>
 </HEAD>
 <BODY>

<cewolf:chart
	id="verticalXY"
	title="Cewolf 编程实例17: 基于XYDataset的直方图"
	type="verticalXYBar">
    <cewolf:colorpaint color="#FFCC99"/>
    <cewolf:data>
        <cewolf:producer id="timeData"/>
    </cewolf:data>
</cewolf:chart>

<cewolf:img
	chartid="verticalXY"
	renderer="/cewolf"
	width="500"
	height="375">
</cewolf:img>

 </BODY>
</HTML>

<!--
/**************************************************************************
 * (C) Copyright 2004-2005 by Jingkui Zhong(钟京馗) and Huan Tang(唐桓).  *
 * All Rights Reserved.                                                   *
 *                                                                        *
 * DISCLAIMER: The authors of this code have used their                   *
 * best efforts in preparing the code. These efforts include the          *
 * development, research, and testing of the theories and programs        *
 * to determine their effectiveness. The authors and publisher make       *
 * no warranty of any kind, expressed or implied, with regard to these    *
 * programs or to the documentation contained in these codes. The authors *
 * shall not be liable in any event for incidental or consequential       *
 * damages in connection with, or arising out of, the furnishing,         *
 * performance, or use of these programs.                                 *
 **************************************************************************/
 -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -