📄 splitby.aspx
字号:
<%@ Page Language="VB" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(sender As [Object], e As EventArgs)
'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.ChartArea.YAxis.Scale = Scale.Stacked
Chart.LegendBox.Position = LegendBoxPosition.BottomMiddle
Chart.DateGrouping = TimeInterval.Year
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 OrderDate,Sum(Total) FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.OrderDate, Orders.Name"
Chart.SeriesCollection.Add()
'This is the same chart with "Name" added to the SQL statement,
'it will automatically split the data into series based on Name.
'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.ChartArea.YAxis.Scale = Scale.Stacked
Chart2.LegendBox.Position = LegendBoxPosition.BottomMiddle
Chart2.DateGrouping = TimeInterval.Year
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 OrderDate,Sum(Total),Name FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.OrderDate, Orders.Name"
Chart2.SeriesCollection.Add()
'This is the same chart with the SplitByLimit property set
'this will limit the number of series generated, in this case 5.
'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.ChartArea.YAxis.Scale = Scale.Stacked
Chart3.LegendBox.Position = LegendBoxPosition.BottomMiddle
Chart3.DateGrouping = TimeInterval.Year
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 OrderDate,Sum(Total),Name FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.OrderDate, Orders.Name"
Chart3.Series.SplitByLimit = "5"
Chart3.SeriesCollection.Add()
'This is the same chart with ShowOther enabled. This will
'split the data into 5 series (number determined by SplitByLimit) and
'group the values for all other values into an "Other" 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.ChartArea.YAxis.Scale = Scale.Stacked
Chart4.LegendBox.Position = LegendBoxPosition.BottomMiddle
Chart4.DateGrouping = TimeInterval.Year
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 OrderDate,Sum(Total),Name FROM Orders WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# GROUP BY Orders.OrderDate, Orders.Name"
Chart4.Series.SplitByLimit = "5"
Chart4.Series.ShowOther = True
Chart4.SeriesCollection.Add()
End Sub 'Page_Load
</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 + -