Jump to content
Software FX Community

Statistical Functions on X-axis


User (Legacy)

Recommended Posts

Posted

I create a chart and can include statistical functions for the y-axis such 

as Analysis.Mean, Analysis.Max, etc using the statistical extensions.

However, how do I get the Min, Max, Mean, etc for the X-axis values and

include them in a study.

Bob

post-2107-1392238094813_thumb.jpg

Posted

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

Posted

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

>

Posted

Since you didn't specify the version I assumed the latest (7.0).

In version 6.2 you are going to need to retrieve the data directly form the

chart by using chart.XValues[i,j].

--

Francisco Padron

www.chartfx.com

Posted

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.

Posted

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

Archived

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

×
×
  • Create New...