📄 limit.aspx
字号:
<%@ Page Language="C#" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
//set global properties
Chart.Title="Sales";
Chart.ChartArea.YAxis.Label.Text="Sales";
Chart.ChartArea.YAxis.FormatString="Currency";
Chart.TempDirectory="temp";
Chart.Debug=true;
Chart.DefaultSeries.DefaultElement.Transparency=15;
Chart.Use3D=true;
//Add a series
Chart.Series.ConnectionString = @"../../database/chartsample.mdb";
Chart.Series.StartDate=new System.DateTime(2002,1,1,0,0,0);
Chart.Series.EndDate = new System.DateTime(2002,12,31,23,59,59);
Chart.Series.Name="Sales";
Chart.Series.SqlStatement= @"SELECT Name,Sum(Total) FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.Name";
Chart.SeriesCollection.Add();
//This is the same chart with limit set to limit the return to the
//Five customers who had the highest purchase totals.
//set global properties
Chart2.Title="Sales";
Chart2.ChartArea.YAxis.Label.Text="Sales";
Chart2.ChartArea.YAxis.FormatString="Currency";
Chart2.TempDirectory="temp";
Chart2.Debug=true;
Chart2.DefaultSeries.DefaultElement.Transparency=15;
Chart2.Use3D=true;
//Add a series
Chart2.Series.ConnectionString = @"../../database/chartsample.mdb";
Chart2.Series.StartDate=new System.DateTime(2002,1,1,0,0,0);
Chart2.Series.EndDate = new System.DateTime(2002,12,31,23,59,59);
Chart2.Series.Name="Sales";
Chart2.Series.SqlStatement= @"SELECT Name,Sum(Total) FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.Name ORDER BY Sum(Total)";
Chart2.Series.Limit = "5";
Chart2.SeriesCollection.Add();
//This is the same chart with the ShowOther property set
//this will add an element representing the total sales
//for other customers not in the top five.
//set global properties
Chart3.Title="Sales";
Chart3.ChartArea.YAxis.Label.Text="Sales";
Chart3.ChartArea.YAxis.FormatString="Currency";
Chart3.TempDirectory="temp";
Chart3.Debug=true;
Chart3.DefaultSeries.DefaultElement.Transparency=15;
Chart3.Use3D=true;
//Add a series
Chart3.Series.ConnectionString = @"../../database/chartsample.mdb";
Chart3.Series.StartDate=new System.DateTime(2002,1,1,0,0,0);
Chart3.Series.EndDate = new System.DateTime(2002,12,31,23,59,59);
Chart3.Series.Name="Sales";
Chart3.Series.SqlStatement= @"SELECT Name,Sum(Total) FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.Name ORDER BY Sum(Total)";
Chart3.Series.Limit = "5";
Chart3.Series.ShowOther = true;
Chart3.SeriesCollection.Add();
//This is the same chart with the Series level PaletteName
//property set. This will assign a color to each element
//automatically and also create legend entries for the elements.
//This property is most useful when you only have 1 series.
//set global properties
Chart4.Title="Sales";
Chart4.ChartArea.YAxis.Label.Text="Sales";
Chart4.ChartArea.YAxis.FormatString="Currency";
Chart4.TempDirectory="temp";
Chart4.Debug=true;
Chart4.DefaultSeries.DefaultElement.Transparency=15;
Chart4.Use3D=true;
//Add a series
Chart4.Series.ConnectionString = @"../../database/chartsample.mdb";
Chart4.Series.StartDate=new System.DateTime(2002,1,1,0,0,0);
Chart4.Series.EndDate = new System.DateTime(2002,12,31,23,59,59);
Chart4.Series.Name="Sales";
Chart4.Series.SqlStatement= @"SELECT Name,Sum(Total) FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.Name ORDER BY Sum(Total)";
Chart4.Series.Limit = "5";
Chart4.Series.ShowOther = true;
Chart4.Series.PaletteName = Palette.One;
Chart4.SeriesCollection.Add();
}
</script>
<HTML><HEAD><TITLE>SplitBy and ShowOther Sample</TITLE></HEAD>
<BODY>
<DIV align=center>
<dotnet:Chart id="Chart" runat="server"/>
</DIV>
<DIV align=center>
<dotnet:Chart id="Chart2" runat="server"/>
</DIV>
<DIV align=center>
<dotnet:Chart id="Chart3" runat="server"/>
</DIV>
<DIV align=center>
<dotnet:Chart id="Chart4" runat="server"/>
</DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -