惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
月光博客
月光博客
腾讯CDC
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
The GitHub Blog
The GitHub Blog
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Martin Fowler
Martin Fowler
A
About on SuperTechFans
博客园 - 叶小钗

博客园 - 神话

C#的float型,竟然与SQL中float型不对应(转载) 【源码】非常有用的Vml图像画板(收藏) 为Html 的Select 加一个提示语和输入方法(转载) asp.net三色交替的下拉列表框(转载) 常用正则表达式(收藏) ListBox控件上移、下移操作(Ajax) 客户端实现PadLeft 获取某行的字段ID值(GridView模板列) 日历控件收藏 我的博客地图脚本代码 实时统计输入字符数 我的博客地图特效 生成html页面 梅花雪日历控件(网络收藏) 树型菜单<仿QQ型菜单>(网络收藏) 面向对象分析(网络收藏) 常用正则表达式(收集)及使用方法 三层架构(非原创) 网页常用代码小技巧五(网络收藏)
初次使用ZedGraph
神话 · 2007-06-01 · via 博客园 - 神话

下载ZedGraph.dll :/Files/ProgrammerSystem/ZedGraph.dll.rar

BuildReport.aspx页面

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BuildReport.aspx.cs" Inherits="Count_BuildReport" %>
<%@ Register TagPrefix="zgw" Namespace="ZedGraph.Web" Assembly="ZedGraph.Web" %>
<ZGW:ZEDGRAPHWEB id="ZedGraphWeb1" runat="server" width="780" Height="260" RenderMode="RawImage"
 BarType
="Stack" IsFontsScaled="false" IsShowTitle="true" BaseDimension="10" />

BuildReport.aspx.cs 类文件

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;

using ZedGraph;
using ZedGraph.Web;

public partial class Count_BuildReport : System.Web.UI.Page
{
    
private string _serverName = "";
    
private string _startTime = "";
    
private string _endTime = "";

    
public string ServerName get return this._serverName; } set this._serverName = value; } }
    
public string StartTime get return this._startTime; } set this._startTime = value; } }
    
public string EndTime get return this._endTime; } set this._endTime = value; } }

    
protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!this.Page.IsPostBack)
        
{
            
接受参数
        }

    }


    
WebForm Designer generated code


    
private void OnRenderGraph(ZedGraphWeb zgw, Graphics g, MasterPane masterPane)
    
{
        GraphPane myPane 
= masterPane[0];

        
报表相关属性设置

        
//从数据库中取出数据
        DataSet ds = ManageAnalyzeDAL.CountDAL.GetOnlineCount(_serverName, _startTime, _endTime);
        DataTable dt 
= ds.Tables[0];
        DataTable dtTopOnlineCount 
= ds.Tables[1]; //某天中最高值

        
int dtRows = dt.Rows.Count / 24//获取天数

        PointPairList[] list 
= new PointPairList[dtRows];

        
for (int i = 0; i < dtRows; i++)
        
{
            
int startNum = i * 24;
            
int endNum = (i + 1* 24 - 1;

            list[i] 
= new PointPairList();

            
double intTopCount = Convert.ToDouble(dtTopOnlineCount.Rows[i]["onlineCount"]);

            
获取某天24小时的点
        }


        LineItem[] lineItem 
= new LineItem[dtRows];

        
for (int i = 0; i < dtRows; i++)
        
{
            lineItem[i] 
= myPane.AddCurve(Convert.ToDateTime(dt.Rows[i * 23 + i]["WriteTime"]).ToShortDateString(), (PointPairList)list[i], getColor(i),SymbolType.Star);
        }
            
        masterPane.AxisChange(g);
    }


    
DrawText

    
getColor
}