arraylist.aspx

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

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

<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
	//set global properties
    Chart.Title="Item sales report";
    
    // Set the x axis label
	Chart.ChartArea.XAxis.Label.Text="X Axis Label";

	// Set the y axis label
	Chart.ChartArea.YAxis.Label.Text="Y Axis Label";
    Chart.TempDirectory="temp";
    Chart.Debug=true;
    
    
   //Adding series programatically
   	Chart.Series.Name = "Item sales";
   	Chart.Series.DataFields="xAxis=Name,yAxis=Total";
   	Chart.Series.Data = CreateArrayList();
   	Chart.SeriesCollection.Add();
   
                        
   
}
ArrayList CreateArrayList()
{
	ArrayList myArrayList = new ArrayList(); 
	myArrayList.Add(new Product("P1",44));
	myArrayList.Add(new Product("P2",12));
	myArrayList.Add(new Product("P3",20));
	myArrayList.Add(new Product("P4",65));
	myArrayList.Add(new Product("P5",50));
	myArrayList.Add(new Product("P6",40));
	
    return myArrayList;
}
public class Product
{
	string name;
	double total;
	public Product()
	{
	}
	public Product(string proName,double proTotal)
	{
		name = proName;
		total = proTotal;
	}

	
	public string Name
	{
		get
		{
			return name;
		}
		set
		{
			name = value;
		}
	}
	public double Total
	{
		get
		{
			return total;
		}
		set
		{
			total = value;
		}
	}


}
</script>
<HTML><HEAD><TITLE>ArrayList Sample</TITLE></HEAD>
<BODY>
<DIV align=center>
 <dotnet:Chart id="Chart"  runat="server"/>
 
</DIV>
</BODY>
</BODY>
</HTML>

⌨️ 快捷键说明

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