zoukankan      html  css  js  c++  java
  • hra 直线

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Framework;
    using WebApp.Common;
    using Contract.Domain;
    using System.Collections;

    namespace HraWeb
    {
    public partial class Report : JQEntityManage<MktPriceMarketData>
    {
    protected override void Page_Load(object sender, EventArgs e)
    {
    bool hasData = true;
    string factorId = "";
    string startTime, endTime;
    startTime = endTime = string.Empty;
    IList list = null;
    if (Request["_method"] == "GetReport")
    {

    startTime = Request["txt_stratTime_"].ToString();
    endTime = Request["txt_endTime_"].ToString();
    factorId = Request["txt_select_"].ToString();
    //if (string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime))
    //{
    // hasData = false;
    // string s =
    // "<script>$.messager.alert('消息提示框','查询起止时间均不可为空')</script>";
    // ClientScript.RegisterStartupScript(GetType(), "message", s);


    //}
    //if (string.IsNullOrEmpty(factorId))
    //{
    // hasData = false;
    // string s =
    // "<script>$.messager.alert('消息提示框','必须选择查询的价格因子')</script>";
    // ClientScript.RegisterStartupScript(GetType(), "message", s);

    //}


    if (hasData != false)
    {
    Framework.QueryInfo info = new Framework.QueryInfo();

    //info.QueryObject = "MktPriceMarketData";
    //if(!string.IsNullOrEmpty(startTime))
    //info.AddParam("CloseDate", DateTime.Parse(startTime), " and CloseDate>=:CloseDate");
    //if(!string.IsNullOrEmpty(endTime))
    //info.AddParam("CloseDate1", DateTime.Parse(endTime), " and CloseDate<=:CloseDate1");
    //if (!string.IsNullOrEmpty(factorId))
    //{
    // info.AddParam("IndexPriceFactorId", factorId);
    //}

    //info.OrderBy.Add("CloseDate ASC");
    //list = Dao.FindByQueryInfo(info).List;
    //if (list == null || list.Count <= 0)
    //{
    // string s = "没有查找到相关数据";

    // Response.Write(s);
    // Response.End();
    // //hasData = false;
    // //string s =
    // // "<script>$.messager.alert('消息提示框','当前报表查询不到数据请尝试换个时间段')</script>";
    // //ClientScript.RegisterStartupScript(GetType(), "message", s);


    //}
    string outputtext = "<script language='javascript' type='text/javascript'>";
    //outputtext += "var vChart = new Visifire2('SL.Visifire.Charts.xap', 800, 500);";
    var dataXml = "";
    dataXml += "<vc:Chart xmlns:vc='clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts' Width='800' Height='500' Theme='Theme1' BorderThickness='0.5' View3D='False' Watermark='False' ScrollingEnabled='False'>";
    dataXml += "<vc:Chart.Titles><vc:Title Text='分析图1'/></vc:Chart.Titles>"; //图形名称
    dataXml += "<vc:Chart.AxesX><vc:Axis Title='交易日期'></vc:Axis></vc:Chart.AxesX>";//x轴名称
    dataXml += "<vc:Chart.AxesY><vc:Axis Title='中间价' /></vc:Chart.AxesY>";//y轴名称
    dataXml += "<vc:Chart.Series>";
    //Width='800' Height='500'
    dataXml += "<vc:DataSeries LegendText='' RenderAs='Line' LabelEnabled='true' LabelStyle='OutSide' Cursor='Hand' LineThickness='3' LightingEnabled='False' >";//LineThickness:线的粗细
    dataXml += "<vc:DataSeries.DataPoints>";
    //to_date('2015/5/21','yyyy/mm/dd')
    info=new QueryInfo();
    info.CustomSQL = @"select SimulationNumber, VarResultValue from RskBookResult
    where ComputeDate =:ComputeDate
    and RiskBookId = 4518
    and ConfidenceLevel = '95%'
    order by SimulationNumber";
    info.Parameters.Add("ComputeDate",new DateTime(2015,5,21));
    IList lines = Dao.FindList(info);

    Dictionary<decimal,decimal> lineDictionary=new Dictionary<decimal, decimal>();
    foreach (var line in lines)
    {
    Object[] objs = line as Object[];
    lineDictionary.Add(Decimal.Parse(objs[0].ToString()),Decimal.Parse(objs[1].ToString()));
    }
    foreach (var key in lineDictionary.Keys)
    {
    dataXml += string.Format("<vc:DataPoint AxisXLabel='{0}' YValue='{1}'/>",key, lineDictionary[key]);//循环每个点 触发鼠标停留在某个点上时显示x轴和y轴的值
    }
    //for (int i = 0; i < list.Count; i++)
    //{
    // MktPriceMarketData entity = list[i] as MktPriceMarketData;
    // dataXml += "<vc:DataPoint AxisXLabel='" + ((DateTime)entity.CloseDate).ToString("yyyy-MM-dd") + "' YValue='" + entity.MiddlePriceValue.ToString() + "'/>";//循环每个点 触发鼠标停留在某个点上时显示x轴和y轴的值

    //}
    dataXml += "</vc:DataSeries.DataPoints>";
    dataXml += "</vc:DataSeries>";

    dataXml += "</vc:Chart.Series>";
    dataXml += "</vc:Chart>";
    Response.Write(dataXml);
    Response.End();

    //outputtext += "var dataXml = "" + dataXml + "";";
    //outputtext += "</script>";
    //json.InnerHtml = outputtext;

    }
    if (!string.IsNullOrEmpty(startTime))
    {
    txt_stratTime_.Value = startTime;
    // txt_endTime_.Value = endTime;
    // txt_select_.SelectedValue = factorId;
    }
    if (!string.IsNullOrEmpty(endTime))
    {

    txt_endTime_.Value = endTime;
    // txt_select_.SelectedValue = factorId;
    }
    if (!string.IsNullOrEmpty(factorId))
    {


    txt_select_.SelectedValue = factorId;
    }
    }


    base.Page_Load(sender, e);


    }

    public IList GetReportJson(string stratTime, string endTime)
    {
    Framework.QueryInfo info = new Framework.QueryInfo();
    info.CustomSQL = string.Format("select ResetDate,MiddlePriceValue from {0} where to_char(ResetDate,'yyyy-mm-dd')>='{1}' and to_char(ResetDate,'yyyy-mm-dd')<='{2}'", typeof(MktPriceMarketData).Name, stratTime, endTime);
    IList list = Dao.FindByQueryInfo(info).List;
    return list;
    }

    /// <summary>
    /// 设置查询条件或者语句
    /// </summary>
    /// <returns></returns>
    protected override Framework.QueryInfo SetInfo()
    {
    info = base.SetInfo();
    return info;
    }
    /// <summary>
    /// 初始化页面控件
    /// </summary>
    protected override void InitPage()
    {
    this.txt_stratTime_.Value = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
    this.txt_endTime_.Value = DateTime.Now.ToString("yyyy-MM-dd");
    base.InitPage();
    BindDrop("Id", "IndexPriceFactorName", "MktIndexPriceFactor", txt_select_, "");
    // BindDrop(drp_Unit, "SPSW", true);
    }
    //private Contract.IService.IMktPriceMarketDataService psvc;
    ///// <summary>
    ///// 初始化
    ///// </summary>
    //Contract.IService.IMktPriceMarketDataService Psvc
    //{
    // get
    // {
    // if (psvc == null)
    // {
    // psvc = ctx.GetObject("MktPriceMarketDataService") as Contract.IService.IMktPriceMarketDataService;
    // }
    // return psvc;

    // }
    //}
    }
    }

  • 相关阅读:
    Spring学习(九)
    NPOI的一些基本操作
    WebClient请求接口,get和post方法
    树结构关系的数据导出为excel
    AOP实践--利用MVC5 Filter实现登录状态判断
    js小结
    (转)基于http协议的api接口对于客户端的身份认证方式以及安全措施
    C# 下载文件 只利用文件的存放路径来下载
    linux nginx启动 重启 关闭命令
    两种 js下载文件的方法(转)
  • 原文地址:https://www.cnblogs.com/kexb/p/4523022.html
Copyright © 2011-2022 走看看