Jump to content
Software FX Community

Statistical Functions on X-axis


User (Legacy)

Recommended Posts

All central tendency calculations are performed against the Y Values of the 

chart. X-Values are only used for the calculation correlation (two variables

comparison).

X-Data can be obtained from: statistics.Calculators[i].DataX, this can be

used to calculate Min and Max and to do other calculations, these

calculations need to be performed by your code and then added as custom

studies. For example, lets say you want to add the median in the X-Axis, the

following code will do it:

StudyConstant medianX = new StudyConstant(StudyType.Custom,1);

double [] dataX = statistics1.Calculators[0].DataX;

Array.Sort<double>(dataX);

medianX.Value = dataX[dataX.Length / 2];

medianX.Text = "Median X";

medianX.Axis = chart1.AxisX;

medianX.Visible = true;

statistics1.Studies.Add(medianX);

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

The software does not seem to have the DataX property in version 6.2. Can 

you please help with how to do this in .NET version 6.2?

Thanks,

Bob

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:wb7ygWTyGHA.2980@webserver3.softwarefx.com...

> All central tendency calculations are performed against the Y Values of

> the chart. X-Values are only used for the calculation correlation (two

> variables comparison).

>

> X-Data can be obtained from: statistics.Calculators[i].DataX, this can be

> used to calculate Min and Max and to do other calculations, these

> calculations need to be performed by your code and then added as custom

> studies. For example, lets say you want to add the median in the X-Axis,

> the following code will do it:

>

> StudyConstant medianX = new StudyConstant(StudyType.Custom,1);

>

> double [] dataX = statistics1.Calculators[0].DataX;

>

> Array.Sort<double>(dataX);

>

> medianX.Value = dataX[dataX.Length / 2];

>

> medianX.Text = "Median X";

>

> medianX.Axis = chart1.AxisX;

>

> medianX.Visible = true;

>

> statistics1.Studies.Add(medianX);

>

>

> --

> Francisco Padron

> www.chartfx.com

>

Link to comment
Share on other sites

I got your suggestion to work but now have another issue. The users have the 

option to plot data using the CrossTab provider and the Analysis statistics

appear for a series whenever the series is selected by hovering over it in

the legend. However, the Minimum X code I have just shows the same value for

all series. How do I get the Minimum X to show up based upon the series.

The statistics are not shown until a series is selected except for the

minimum X study I added.

The Minimum X-Value is not based upon series but is for all data. How do I

get the study I added to work like the standard studies for each series.

Link to comment
Share on other sites

Most studies calculated by the Statistical extension are applied to all 

series in the chart (Y-Values) and therefore they represent multiple values,

not just one.

The statistical extension uses chart's highlighting infrastructure to show

the value for the highlighted series in the legend box. You can achieve a

similar behavior by attaching to the Highlighted event in the chart. I wrote

a little sample that demonstrates this:

private void chart1_Highlighted(object sender,

SoftwareFX.ChartFX.Base.HighlightEventArgs e) {

if (medianX!= null) {

if ((e.Mode & SoftwareFX.ChartFX.Base.HighlightModes.On) != 0)

medianX.Value = <median for series e.Series>;

else

medianX.Value = double.NaN;

}

}

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...