$("#btn_search").click(function () {
var computeTime = $("#txt_computeTime_").val();
var endComputeTime = $("#txt_EndcomputeTime_").val();
var simulationNumber = $("#txt_simulationNumber_").val();
var riskBookId = $("#txt_select_").val();
var checked = $("#chk_3d").checked;
var viewType = "2d";
if (checked) {
viewType = "3d";
}
var url = "/ReportEg/Report2.aspx?_method=GetReport&txt_computeTime_=" + computeTime + "&txt_simulationNumber_=" + simulationNumber + "&txt_select_=" + riskBookId + "&viewtype=" + viewType + "&txt_EndcomputeTime_=" + endComputeTime + "";
$.ajax({
async: true,
type: "GET",
url: url,
data: {},
dataType: "text",
success: function (data) {
$("#VisifireChart1").html("");
if (data.length > 0) {
var vChart = new Visifire2(‘../SL.Visifire.Charts.xap‘, 800, 500);
vChart.setDataXml(data);
vChart.render(‘VisifireChart1‘);
}
}
});
});
后台:
if (Request["_method"] == "GetReport")
{
string riskBookId = Request["txt_select_"].ToString();
string computeDate = Request["txt_computeTime_"].ToString();
string endcomputeDate = Request["txt_EndcomputeTime_"].ToString();
string simulationNumber = Request["txt_simulationNumber_"].ToString();
string viewType = Request["viewtype"].ToString();
txt_computeTime_.Value = computeDate;
txt_simulationNumber_.Value = simulationNumber;
if (string.IsNullOrEmpty(riskBookId) || string.IsNullOrEmpty(computeDate) || string.IsNullOrEmpty(simulationNumber))
{
throw new Exception("查询参数均不可为空!");
}
Framework.QueryInfo info = new Framework.QueryInfo();
info.QueryObject = "RskBookHistogram";
info.CustomSQL = "select Tick_Value,Frequency_Value from rsk_book_histogram where Compute_Date>=:Compute_Date and Compute_Date<=:endcomputeDate and Simulation_Number=" + simulationNumber;
info.Parameters.Add("Compute_Date",DateTime.Parse(computeDate));
info.Parameters.Add("endcomputeDate",DateTime.Parse(endcomputeDate));
DataSet dt = Dao.ExcuteDataSet(info);
vChartDataSet = dt;
string outputtext = "<script language=‘javascript‘ type=‘text/javascript‘>";
var dataXml = "";
if(viewType == "3d")
dataXml += "<vc:Chart xmlns:vc=‘clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts‘ Width=‘800‘ Height=‘500‘ Theme=‘Theme1‘ BorderThickness=‘0‘ View3D=‘True‘ Watermark=‘False‘ ScrollingEnabled=‘False‘>";
else if(viewType == "2d")
dataXml += "<vc:Chart xmlns:vc=‘clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts‘ Width=‘800‘ Height=‘500‘ Theme=‘Theme1‘ BorderThickness=‘0‘ View3D=‘False‘ Watermark=‘False‘ ScrollingEnabled=‘False‘>";
dataXml += "<vc:Chart.Titles><vc:Title Text=‘分析图2‘/></vc:Chart.Titles>";
dataXml += "<vc:Chart.AxesX><vc:Axis Title=‘直方图横坐标‘></vc:Axis></vc:Chart.AxesX>";
dataXml += "<vc:Chart.AxesY><vc:Axis Title=‘频数值‘ /></vc:Chart.AxesY>";
dataXml += "<vc:Chart.Series>";
dataXml += "<vc:DataSeries LegendText=‘‘ RenderAs=‘Column‘ LabelEnabled=‘true‘ LabelStyle=‘OutSide‘ Cursor=‘Hand‘>";
dataXml += "<vc:DataSeries.DataPoints>";
foreach (DataRow row in dt.Tables[0].Rows)
{
dataXml += "<vc:DataPoint AxisXLabel=‘" + row["Tick_Value"].ToString() + "‘ YValue=‘" + row["Frequency_Value"].ToString() + "‘/>";
}
dataXml += "</vc:DataSeries.DataPoints>";
dataXml += "</vc:DataSeries>";
dataXml += "</vc:Chart.Series>";
dataXml += "</vc:Chart>";
Response.Write(dataXml);
Response.End();
}
原文:http://www.cnblogs.com/kexb/p/4456252.html