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

📄 forecastingpopulation.aspx

📁 掌握学习.net开发的非常好的资料
💻 ASPX
字号:
<%@ Page Language="C#" 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">

void Page_Load(Object sender,EventArgs e)
{   
	// 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
	DataEngine de = 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
	SeriesCollection scForecast = 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.
	Series trendLineExponential = 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);
}
		</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 + -