How to perform statistical utility functions using WinForms Chart?
In the Syncfusion® WinForms Charts, the UtilityFunctions class allows you to perform Gamma, factorial, Beta and other functions commonly used in statistical distribution formulas.
We can perform the following utility analysis in chart, Using the UtilityFunctions class
- Beta Function - The Beta Function represents the beta function value and so on others
- Normal Distribution - The Normal Distribution method calculates the Normal distribution for a specified value.
- T Cumulative Distribution - This method returns the T Cumulative distribution for a specific value.
- F Cumulative Distribution - This method returns the F Cumulative distribution for a specific value.
- Other statistical distribution formulae refer from this Utility Formulas documentation.
C#
ChartSeries series = new ChartSeries("T-Distribution", ChartSeriesType.SplineArea);
//Set the degrees of freedom
double n = 2;
//Calculate the Beta function using Syncfusion's UtilityFunctions
var beta = UtilityFunctions.Beta(0.5, n / 2.0);
//Calculate the constant coefficient for the t-distribution formula
var coef = Math.Pow(n, -0.5) / beta;
//Generate points for the distribution curve
for (double x = -5; x <= 5; x += 0.1)
{
var y = coef * Math.Pow(1 + (x * x) / n, -(n + 1.0) / 2.0);
series.Points.Add(x, y);
}
this.chartControl1.Series.Add(series);
VB
Dim ChartSeries1 = New ChartSeries("T-Distribution", ChartSeriesType.SplineArea)
'Set the degrees of freedom
Dim n = 2
'Calculate the Beta function using Syncfusion's UtilityFunctions
Dim beta = UtilityFunctions.Beta(0.5, n / 2.0)
'Calculate the constant coefficient for the t-distribution formula
Dim coef = Math.Pow(n, -0.5) / beta
'Generate points for the distribution curve
For x As Double = -5 To 5 Step 0.1
Dim y As Double = coef * Math.Pow(1 + (x * x) / n, -(n + 1.0) / 2.0)
ChartSeries1.Points.Add(x, y)
Next
'Add the fully populated series to the chart
lineChart.Series.Add(ChartSeries1)
Output:
Conclusion
I hope you enjoyed learning about how to perform statistical utility functions using WinForms Chart.
You can refer to our WinForms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our WinForms Chart examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!