<%@ Page Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="PubClientQuery.aspx.cs" Inherits="IMDashBoard.Web.PubClientQuery" %> <%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <asp:Label ID="Label1" runat="server"></asp:Label> <table border="1"> <tr> <td> </td> <td> <asp:TextBox ID="txtDateFrom" runat="server"></asp:TextBox> <asp:TextBox ID="txtDateTo" runat="server"></asp:TextBox> </td> <td> <asp:Button ID="btnSearch" runat="server" Text="Button" OnClick="btnSearch_Click" /> </td> </tr> <tr> <td> </td> <td> <asp:Chart ID="Chart1" runat="server" Height="411px" Width="589px"> <Legends> <asp:Legend BackColor="Transparent" Name="Legend1" DockedToChartArea="ChartArea1" Alignment="Far" Docking="Top" IsDockedInsideChartArea="False"> <Position Height="8.026756" Width="15.4154158" X="82.5" Y="3" /> </asp:Legend> </Legends> <Series> <asp:Series Name="Series1" Color="49,130,239" Legend="Legend1" LegendText="CPI指数%" IsValueShownAsLabel="false" Font="Microsoft Sans Serif, 6.5pt" ChartArea="ChartArea1" CustomProperties="DrawingStyle=Cylinder"> </asp:Series> </Series> <BorderSkin SkinStyle="Emboss" /> <ChartAreas> <asp:ChartArea Name="ChartArea1" BackColor="OldLace" BorderColor="64, 64, 64, 64" ShadowColor="Transparent" BackGradientStyle="TopBottom" BackSecondaryColor="White"> <Position Height="89.30075" Width="79.57783" X="4.768868" Y="0.699249268" /> <InnerPlotPosition Height="87.85704" Width="88.67226" X="4.32774353" Y="4.9395" /> </asp:ChartArea> </ChartAreas> </asp:Chart> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </asp:Content>using System;
using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Data.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using IMDashBoard.DAL; using System.Collections.Generic; namespace IMDashBoard.Web { public partial class PubClientQuery : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string calscript = "$(function(){$('#" + txtDateFrom.ClientID + "').datepicker({yearRange: '1900:2099',showOn: 'both', buttonImage: 'PIC/calendar.gif', buttonImageOnly: true,showButtonPanel: true});});"; Page.ClientScript.RegisterStartupScript(this.GetType(), txtDateFrom.ClientID, calscript, true); string calscript2 = "$(function(){$('#" + txtDateTo.ClientID + "').datepicker({yearRange: '1900:2099',showOn: 'both', buttonImage: 'PIC/calendar.gif', buttonImageOnly: true,showButtonPanel: true});});"; Page.ClientScript.RegisterStartupScript(this.GetType(), txtDateTo.ClientID, calscript2, true); string s = txtDateFrom.Text; } protected void btnSearch_Click(object sender, EventArgs e) { string startDate = txtDateFrom.Text; string endDate = txtDateTo.Text; DateTime sd = DateTime.Parse(startDate); DateTime ed = DateTime.Parse(endDate); DSDataContext ds = new DSDataContext(); var s = ds.getALL(sd, ed); Chart1.Series["Series1"].Points.DataBindXY(s, "d", s, "cpi"); } } }