Creating BoxPlots Dynamicly
Creating BoxPlots Dynamicly
Greetings,
I would think this could be done, probably can but I'm abit confused.
I want to display lots of BoxPlots on a Chart (similiar to adding a point to a series in a . I have a chart with a Bar3D and the customer wants to change it to a Whisker thing (a BoxPlot). It doesn't behave the same way with my initial implementation.
With the Bar3D.Add another bar is added to the series. With the Box.Add more data is added to the series. I want to add hundreds of Box(es) to the chart. Do I need to create a new series in the chart for each one. This doesn't seem right. Is there only one "Box" in a Box series?
What am I missing?
Thanks for any response.
I would think this could be done, probably can but I'm abit confused.
I want to display lots of BoxPlots on a Chart (similiar to adding a point to a series in a . I have a chart with a Bar3D and the customer wants to change it to a Whisker thing (a BoxPlot). It doesn't behave the same way with my initial implementation.
With the Bar3D.Add another bar is added to the series. With the Box.Add more data is added to the series. I want to add hundreds of Box(es) to the chart. Do I need to create a new series in the chart for each one. This doesn't seem right. Is there only one "Box" in a Box series?
What am I missing?
Thanks for any response.
Randy
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Randy,
Yes, you need to create a BoxPlot series in the chart for each box plot you wish to draw.
You can find an example of that at TeeChart features demo (Welcome !\Chart styles\Statistical\Box-Plot). You'll find that demo at the TeeChart program group.
Yes, you need to create a BoxPlot series in the chart for each box plot you wish to draw.
You can find an example of that at TeeChart features demo (Welcome !\Chart styles\Statistical\Box-Plot). You'll find that demo at the TeeChart program group.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I have a problem with adding more than one BoxPlot to the chart. I can't seem to find an attribute, which is responsible for the X axis position of the box.
If I make two series and fetch data in these, the boxes do overlay each other.
If I try:
or
the situation doesn't change a bit.
Please advise what to do!
Sincerely,
//Dmitry.
If I make two series and fetch data in these, the boxes do overlay each other.
If I try:
Code: Select all
BoxXX.Add(<x_axis_position>, <value>);
Code: Select all
BoxXX.Add(<value>, <x_axis_position>);
Please advise what to do!
Sincerely,
//Dmitry.
Hi.
To control individual vertical box plot horizontal position, you can use the box plot series Position property. Something like this:
or a more "universal" solution <g>:
To control individual vertical box plot horizontal position, you can use the box plot series Position property. Something like this:
Code: Select all
boxSeries1.Position = 0;
boxSeries2.Position = 1;
Code: Select all
int i = 0;
foreach(Styles.Series s in tChart1.Series)
{
if (s is Styles.Box)
{
(s as Styles.Box).Position = i;
i ++;
}
}
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Hi, Dmitry.
Most likely you're only populating first box plot series. For each group you'll have to populate *different* series. For example:
In short: each "box" represents different group i.e. series.
Most likely you're only populating first box plot series. For each group you'll have to populate *different* series. For example:
Code: Select all
// first group points: 2,3,5
box1.Add(2);
box1.Add(3);
box1.Add(5);
// second group points: 1.5, 2.5, 3.1, 4.0
box2.Add(1.5);
box2.Add(2.5);
box2.Add(3.1);
box2.Add(4.0);
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
I had to realize the neccessary functionality the other way, ok.
The next question is how can we get median, lower/higher quartile and whisker numerical positions? I have checked through the debug session that median and other attributes of the series object hold no data regarding these positions... How am I able to get these?
The next question is how can we get median, lower/higher quartile and whisker numerical positions? I have checked through the debug session that median and other attributes of the series object hold no data regarding these positions... How am I able to get these?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi sunjun,
You can retrieve BoxPlot series values like this:
You can retrieve BoxPlot series values like this:
Code: Select all
foreach (Steema.TeeChart.Styles.Box boxPlot in tChart1.Series)
{
listBox1.Items.Add("Series: " + boxPlot.Title.ToString());
listBox1.Items.Add("Median: " + boxPlot.Median.ToString());
listBox1.Items.Add("Quartile1: " + boxPlot.Quartile1.ToString());
listBox1.Items.Add("Quartile3: " + boxPlot.Quartile3.ToString());
listBox1.Items.Add("InnerFence1: " + boxPlot.InnerFence1.ToString());
listBox1.Items.Add("InnerFence3: " + boxPlot.InnerFence3.ToString());
listBox1.Items.Add("OuterFence1: " + boxPlot.OuterFence1.ToString());
listBox1.Items.Add("OuterFence3: " + boxPlot.OuterFence3.ToString());
listBox1.Items.Add("AdjacentPoint1: " + boxPlot.AdjacentPoint1.ToString());
listBox1.Items.Add("AdjacentPoint3: " + boxPlot.AdjacentPoint3.ToString());
listBox1.Items.Add("-------------------------");
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks, Narcis!
But this is the exactly what I have tried - debug all the attributes you have providen here. All these attributes are equal to 0.
This means, that *after* ADDing elements to the serie and *before* requesting these attributes, I have to initialize the graph somehow?
Sincerely,
//Dmitry.
But this is the exactly what I have tried - debug all the attributes you have providen here. All these attributes are equal to 0.
This means, that *after* ADDing elements to the serie and *before* requesting these attributes, I have to initialize the graph somehow?
Sincerely,
//Dmitry.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dmitry,
It works fine for me here populating series with custom values, for example:
It works fine for me here populating series with custom values, for example:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Box box1= new Steema.TeeChart.Styles.Box(tChart1.Chart);
box1.UseCustomValues = true;
box1.Clear();
box1.UseCustomValues = true;
box1.Median = 38;
box1.Quartile1 = 37.25;
box1.Quartile3 = 40.75;
// adjacent points are related with whisker lines
box1.AdjacentPoint1 = 37; // lower whisker at 37
box1.AdjacentPoint3 = 43; // upper whisker at 43
// using this all added points will be extreme outliers
box1.InnerFence1 = 39;
box1.InnerFence3 = 39;
box1.OuterFence1 = 39;
box1.OuterFence3 = 39;
// add outliers
box1.Add(new float[4] { 35, 36, 44, 61 });
foreach (Steema.TeeChart.Styles.Box boxPlot in tChart1.Series)
{
listBox1.Items.Add("Series: " + boxPlot.Title.ToString());
listBox1.Items.Add("Median: " + boxPlot.Median.ToString());
listBox1.Items.Add("Quartile1: " + boxPlot.Quartile1.ToString());
listBox1.Items.Add("Quartile3: " + boxPlot.Quartile3.ToString());
listBox1.Items.Add("InnerFence1: " + boxPlot.InnerFence1.ToString());
listBox1.Items.Add("InnerFence3: " + boxPlot.InnerFence3.ToString());
listBox1.Items.Add("OuterFence1: " + boxPlot.OuterFence1.ToString());
listBox1.Items.Add("OuterFence3: " + boxPlot.OuterFence3.ToString());
listBox1.Items.Add("AdjacentPoint1: " + boxPlot.AdjacentPoint1.ToString());
listBox1.Items.Add("AdjacentPoint3: " + boxPlot.AdjacentPoint3.ToString());
listBox1.Items.Add("-------------------------");
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I think it is strange at least.
What I mean that when I feed the Box with the data, I get a vizual representation of the whiskers, median, quartiles, etc. So, these values obviously MUST be available somewhere in the object.
But if I have to calculate everything manually in order to have these values, why do I need the BoxPlot chart style at all? I can draw my custom chart then with no problems at all... :-/
So, the answer is that there is no way to get numerical values from the Box serie object if these were not manually written there before?
Sincerely,
//Dmitry.
What I mean that when I feed the Box with the data, I get a vizual representation of the whiskers, median, quartiles, etc. So, these values obviously MUST be available somewhere in the object.
But if I have to calculate everything manually in order to have these values, why do I need the BoxPlot chart style at all? I can draw my custom chart then with no problems at all... :-/
So, the answer is that there is no way to get numerical values from the Box serie object if these were not manually written there before?
Sincerely,
//Dmitry.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dmitry,
The solution is to call box series ReconstructFromData() method. This will in effect recalculate all box plot parameters, for example:
The solution is to call box series ReconstructFromData() method. This will in effect recalculate all box plot parameters, for example:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Box box1= new Steema.TeeChart.Styles.Box(tChart1.Chart);
box1.FillSampleValues();
foreach (Steema.TeeChart.Styles.Box boxPlot in tChart1.Series)
{
boxPlot.ReconstructFromData();
listBox1.Items.Add("Series: " + boxPlot.Title.ToString());
listBox1.Items.Add("Median: " + boxPlot.Median.ToString());
listBox1.Items.Add("Quartile1: " + boxPlot.Quartile1.ToString());
listBox1.Items.Add("Quartile3: " + boxPlot.Quartile3.ToString());
listBox1.Items.Add("InnerFence1: " + boxPlot.InnerFence1.ToString());
listBox1.Items.Add("InnerFence3: " + boxPlot.InnerFence3.ToString());
listBox1.Items.Add("OuterFence1: " + boxPlot.OuterFence1.ToString());
listBox1.Items.Add("OuterFence3: " + boxPlot.OuterFence3.ToString());
listBox1.Items.Add("AdjacentPoint1: " + boxPlot.AdjacentPoint1.ToString());
listBox1.Items.Add("AdjacentPoint3: " + boxPlot.AdjacentPoint3.ToString());
listBox1.Items.Add("-------------------------");
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
box plots
Hi Narcis,
In my opinion, the current box plot setup where each box is a series is pretty counterintuitive and not very consistent with the other TeeChart series types.
My ideal box plot would be a series of boxes, each with an x-value and an array of y values.
Something along the lines of
MyBoxSeries.Add(X as double, Y() as double)
or
MyBoxSeries.Add(X as date, Y() as double)
Maybe something else to put on the ever-increasing wish-list?
Cheers
Francis
In my opinion, the current box plot setup where each box is a series is pretty counterintuitive and not very consistent with the other TeeChart series types.
My ideal box plot would be a series of boxes, each with an x-value and an array of y values.
Something along the lines of
MyBoxSeries.Add(X as double, Y() as double)
or
MyBoxSeries.Add(X as date, Y() as double)
Maybe something else to put on the ever-increasing wish-list?
Cheers
Francis
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Francis,
Yes, exactly . I've just added this item.
Anyway, you could also create a custom series which contains an array of boxplots.
Maybe something else to put on the ever-increasing wish-list?
Yes, exactly . I've just added this item.
Anyway, you could also create a custom series which contains an array of boxplots.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |