📄 correlation.aspx
字号:
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<HTML>
<HEAD>
<TITLE>.netCHARTING Sample</TITLE>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// This sample demonstrates the use of LeastSquaresRegressionLineX and LeastSquaresRegressionLineY from
// within Correlation class
// The Correlation Chart
CorrelationChart.Title="Correlation";
CorrelationChart.TempDirectory="temp";
CorrelationChart.Debug=true;
CorrelationChart.Size = "600x400";
CorrelationChart.LegendBox.Template ="%icon %name";
CorrelationChart.XAxis.Scale = Scale.Normal;
CorrelationChart.TitleBox.Position = TitleBoxPosition.FullWithLegend;
CorrelationChart.DefaultSeries.DefaultElement.Marker.Visible = false;
CorrelationChart.DefaultSeries.Type = SeriesType.Spline;
// Generate the sample data.
SeriesCollection scorrelation = new SeriesCollection();
Series sampledata1 = new Series ("Sample 1");
for ( int b=1; b<10; b++) {
Element el = new Element();
el.YValue = -Math.Sin(b)-b;
el.XValue = b ;
sampledata1.Elements.Add (el);
}
scorrelation.Add (sampledata1);
CorrelationChart.SeriesCollection.Add (scorrelation);
// Here we create a series which describe the regression line of Y on X using the
// method of least squares
CorrelationChart.SeriesCollection.Add ( StatisticalEngine.LeastSquaresEstimateY("EstimateY",sampledata1) );
// Here we create a series which describe the regression line of X on Y using the
// method of least squaresLeastSquaresEstimatex
Series estimateX = StatisticalEngine.LeastSquaresEstimateX("EstimateX", sampledata1);
estimateX.DefaultElement.Color = Color.FromArgb(255,99,49);
CorrelationChart.SeriesCollection.Add (estimateX);
}
</script>
</HEAD>
<BODY>
<DIV align="center">
<dotnet:Chart id="CorrelationChart" runat="server"/>
</dotnet:Chart>
</DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -