js生成折线图(一条折线或多条折线)

参照 http://hi.baidu.com/nkiqzedjqwadpre/item/75dc612087b1530877272c4d ,自己稍微改进了一下。

代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HCXYPlanTB1.aspx.cs" Inherits="Modules_Plan_HCXYPlanTB1" %>

<!-- 代码开始===========================================-->
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:*       { behavior: url(#default#VML) }
o\:*       { behavior: url(#default#VML) }
.shape     { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
  <title></title>
  <style type="text/css">
    TD
    { FONT-SIZE: 9pt}
  </style>

  <script language="javascript" type="text/javascript">

  function table2(total,table_x,table_y,all_width,all_height,line_no)
  {
   
  //参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,折线条数)
  //生成图表函数2——折线图

   
    var line_color = "#69f";
    var left_width = 70;
    var total_no = total[1].length
   
    var temp1,temp2,temp3
    temp1 = 0;
    for(var i=1;i<total_no;i++)
    {
        for(var j=1;j<=line_no;j++)
        {
          if(temp1<total[j][i])
          temp1 = total[j][i];
        }
    }
    temp1 = parseInt(temp1);
    if(temp1>9)
    {
        temp2 = temp1.toString().substr(1,1);
        if(temp2>4)
        {
          temp3 = (temp1/(Math.pow(10,(temp1.toString().length-1)))+1)*Math.pow(10,(temp1.toString().length-1));
        }
        else
        {
          temp3 = (temp1/(Math.pow(10,(temp1.toString().length-1)))+0.5)*Math.pow(10,(temp1.toString().length-1));
        }
    }
    else
    {
        if(temp1>4)
        {
          temp3 = 10;
        }
        else
        {
          temp3 = 5;
        }
    }
    temp4 = temp3;
    document.write("<v:rect id='_x0000_s1027' alt='' style='position:absolute;left:" + (table_x + left_width) + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:-1' fillcolor='#9cf' stroked='f'><v:fill rotate='t' angle='-45' focus='100%' type='gradient'/></v:rec

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值