Using .Net's StatisticFormula Library

自古美人都是妖i 提交于 2019-12-12 16:07:37

问题


The C# namespace System.Windows.Forms.DataVisualization.Charting.StatisticFormula seems to have a few statistical functions that I need. The namespace is documented at MSDN here. I'd really like to use the InverseNormalDistribution(double Z) function. The problem is that the constructor is internal and so I can't access the functions in anyway that I know.

Is there some way to have access to the statics functions in this namespace, or will I have to find other solution?


回答1:


You could probably use reflection, something like this should do it:

var statisticFormula = 
    (StatisticFormula) typeof(StatisticFormula).GetConstructor(
        BindingFlags.NonPublic | BindingFlags.Instance,
        null, Type.EmptyTypes, null).Invoke(null);

But this may be a better way:

var chart = new Chart();
var value = chart.DataManipulator.Statistics.InverseNormalDistribution(.15)


来源:https://stackoverflow.com/questions/11459066/using-nets-statisticformula-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!