⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nonlinearpolynomial.aspx

📁 掌握学习.net开发的非常好的资料
💻 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 NonLinear Forecasting model in order to
   ' find the function of best fit. The data used for which the fuctions are fit is a set 
   ' of data which represents a FX exchange rate over a given period of time.
   ' The Forecast Chart
   ForecastChart.Title = "Exchange"
   ForecastChart.TempDirectory = "temp"
   ForecastChart.Debug = True
   ForecastChart.Size = "1000x800"
   ForecastChart.LegendBox.Template = "%icon %name"
   
   ForecastChart.YAxis.ScaleRange.ValueLow = 220
   'ForecastChart.XAxis.Scale = Scale.Normal;
   ' The Forecast data
   Dim de As New DataEngine()
   de.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" + Server.MapPath("../../database/chartsample.mdb")
   de.DateGrouping = TimeInterval.Days
   de.StartDate = New DateTime(1983, 1, 3, 0, 0, 0)
   de.EndDate = New DateTime(1984, 12, 10, 23, 59, 59)
   de.SqlStatement = "SELECT ID, Value AS q FROM Exchange WHERE Data >= #STARTDATE# AND Data <= #ENDDATE# ORDER BY Data "
   
   'Add a series
   Dim scForecast As SeriesCollection = de.GetSeries()
   ForecastChart.SeriesCollection.Add(scForecast)
   
   scForecast(0).Name = "Exchange"
   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
   
   ' Generate a series of standard deviation for the given points
   Dim deviation As New Series()
   Dim i As Integer
   For i = 0 To (scForecast(0).Elements.Count) - 1
      Dim el As New Element()
      el.XValue = scForecast(0).Elements(i).XValue
      el.YValue = 1E-10
      deviation.Elements.Add(el)
   Next i
   
   ' Note that this line is necessary in order to clear the function basis set by previous
   ' example.
   '
   ForecastEngine.Options.Reset()
   
   ' Set the first model function
   '
   ' The first basis element: a1*x^a1` + a2*x^a2` + a3*x^a3`(1)
   ForecastEngine.Options.AddSumOfNonLinearPowerTerms(New Double() {1, 1, 1}, New Double() {0, 1, 2})
   ' Generate a new series which will draw the best fitline according with the model function which we just set
   Dim nonLinearModel1 As New Series()
   nonLinearModel1 = ForecastEngine.Advanced.NonLinearModel(scForecast(0), deviation, New Double() {100.0, 0.0, 1.0, 1.0, 0.001, 2.0}, New Boolean() {True, True, True, True, True, True})
   nonLinearModel1.Name = "2nd Degree Polynomial"
   nonLinearModel1.Type = SeriesType.Spline
   
   'The next two lines display on to the chart the function used to fit the curve
   nonLinearModel1.Elements(230).SmartLabel.Text = "Function 1: %Function"
   nonLinearModel1.Elements(230).ShowValue = True
   
   ForecastChart.SeriesCollection.Add(nonLinearModel1)
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 + -