seriesaxisbinding.aspx

来自「掌握学习.net开发的非常好的资料」· ASPX 代码 · 共 67 行

ASPX
67
字号
<%@ Page Language="C#" debug="true" trace="false" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet"  Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="dotnetCHARTING" %>

<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
	
   //set global properties
   Chart.Title="Average Seasonal Rainfall";
   Chart.TempDirectory="temp";
   Chart.Debug=true;
   Chart.XAxis.Label.Text ="Seasons";
   Chart.YAxis.NumberPercision=0;
   Chart.YAxis.Label.Text="Rainfall (cm)";
   
  
   //Adding series programatically
   Series sr=new Series();
  
   sr.Name="Vancouver";
   Element el = new Element("Spring",10);
   sr.Elements.Add(el);
   el = new Element("Summer",20);
   sr.Elements.Add(el);
   el = new Element("Autumn",13);
   sr.Elements.Add(el);
   el = new Element("Winter",5);
   sr.Elements.Add(el);
   Chart.SeriesCollection.Add(sr);
   
   sr=new Series();
   sr.Name="Houston";
   el = new Element("Spring",20);
   sr.Elements.Add(el);
   el = new Element("Summer",32);
   sr.Elements.Add(el);
   el = new Element("Autumn",18);
   sr.Elements.Add(el);
   el = new Element("Winter",10);
   sr.Elements.Add(el);
   Chart.SeriesCollection.Add(sr);

   //Add new calculatd series bound to a seperate axis
   Chart.Series.Name = "Total";
   Chart.Series.Type = SeriesType.Line;
   
   Axis ATotal = new Axis();
   ATotal.Orientation = dotnetCHARTING.Orientation.Right;
   ATotal.Label.Text = "Total Rainfall";

   Chart.Series.YAxis = ATotal;
   Chart.SeriesCollection.Add(Calculation.Sum);

 
}

</script>
<HTML><HEAD><TITLE>Series Axis Binding Sample</TITLE></HEAD>
<BODY>
<p>
 <dotnet:Chart id="Chart"  runat="server"/>
</p>
</BODY>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?