📄 defaultcs.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Telerik.QuickStart;
using Telerik.WebControls;
namespace Telerik.ChartExamplesCS.NumericalAxis
{
/// <summary>
/// Summary description for _Default.
/// </summary>
public class DefaultCS: XhtmlPage
{
protected Telerik.WebControls.RadChart RadChart1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
const double hourStep = 1 / 24.0;
const double minuteStep = hourStep / 60;
const double fiveMinuteStep = minuteStep * 5;
double startTime = new DateTime(2004, 1, 1, 8, 0, 0, 0).ToOADate();
double endTime = new DateTime(2004, 1, 1, 18, 0, 0, 0).ToOADate();
RadChart1.XAxis.AutoScale = false;
RadChart1.XAxis.AddRange(startTime, endTime, hourStep);
RadChart1.Gridlines.HorizontalGridlines.Visible = true;
RadChart1.YAxis.IsZeroBased = false;
Random r = new Random();
ChartSeries s = RadChart1.GetChartSeries(0);
s.Items.Clear();
double currentTime = startTime + fiveMinuteStep;
for (int i = 0; i < 100; i++)
{
ChartSeriesItem item = new ChartSeriesItem();
item.XValue = currentTime + (r.NextDouble() - 0.5) * fiveMinuteStep;
item.YValue = 7065 + (r.NextDouble() - 0.5) * 90;
currentTime += fiveMinuteStep;
s.Items.Add(item);
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -