📄 forecastingpopulation.aspx
字号:
<%@ Page Language="VB" Debug="true" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="dotnetCHARTING"%>
<HTML>
<HEAD>
<TITLE>.netCHARTING Forecasting Sample</TITLE>
<script runat="server">
Sub Page_Load(sender As [Object], e As EventArgs)
' This sample demonstrates the use of TrendLineExponential from within ForecastEngine
' which find the best fitting exponential curve to sets of data
' The Forecast Chart
ForecastChart.Title = "WorldPopulation"
ForecastChart.TempDirectory = "temp"
ForecastChart.Debug = True
ForecastChart.Size = "800x600"
ForecastChart.LegendBox.Template = "%icon %name"
' The following line allows the source data from which the curve of best fits are
' calibrated to be plotted with curve of best fit and for the x-axis values to be
' syncronized.
'
ForecastChart.XAxis.Scale = Scale.Normal
ForecastChart.YAxis.ScaleRange.ValueLow = 2000000000
ForecastChart.XAxis.ScaleRange.ValueLow = 1950
' The Forecast data
' Here we load data samples from the WorldPopulation table from within chartsample.mdb
Dim de As New DataEngine()
de.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" + Server.MapPath("../../database/chartsample.mdb")
de.DateGrouping = TimeInterval.Years
de.SqlStatement = "SELECT Year, Population AS q FROM WorldPopulation WHERE Year <= 2004 ORDER BY Year"
'Add a series
Dim scForecast As SeriesCollection = de.GetSeries()
ForecastChart.SeriesCollection.Add(scForecast)
scForecast(0).Name = "WorldPopulation"
scForecast(0).Type = SeriesType.Spline
' Takes off the marker off the line and spline series.
ForecastChart.DefaultSeries.DefaultElement.Marker = New ElementMarker(ElementMarkerType.None)
ForecastChart.ChartAreaLayout.Mode = ChartAreaLayoutMode.Vertical
' Here we create a series which will forecast the population growth for the next 10 years,
' taking into account the values registered in the period 1950 -2004.
Dim trendLineExponential As New Series()
trendLineExponential = ForecastEngine.TrendLineExponential(scForecast(0), 1, 10, 0)
'The next two lines display on to the chart the exponential function used
' to fit the curve
trendLineExponential.Elements(0).SmartLabel.Text = "Function: %Function"
trendLineExponential.Elements(0).ShowValue = True
trendLineExponential.DefaultElement.Color = Color.FromArgb(255, 99, 49)
trendLineExponential.Type = SeriesType.Spline
ForecastChart.SeriesCollection.Add(trendLineExponential)
End Sub 'Page_Load
</script>
</HEAD>
<BODY>
<DIV align="center">
<dotnet:Chart id="ForecastChart" runat="server"/>
</dotnet:Chart>
</DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -