Need help in BoxPlot
Need help in BoxPlot
I want to select multiple box plot points and then exclude and include according to the selection.
How to acheive this.
How to acheive this.
Re: Need help in BoxPlot
Hello vivek,
I found a solution for you and you can use a similar code for this in your application. Please see next code and check works as you want:
InitializeChart:
Event of the project:
I hope will helps.
Thanks,
I found a solution for you and you can use a similar code for this in your application. Please see next code and check works as you want:
InitializeChart:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
bool[] Selected1;
bool[] Selected2;
bool[] Selected3;
bool drawrectangle;
Steema.TeeChart.Styles.Box box1, box2, box3;
Rectangle rect;
private void InitializeChart()
{
//-----------------INITIALIZE CHART WITH BOXPLOT-----------------------//
box1 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
box2 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
box3 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
tChart1.Aspect.View3D = false;
tChart1.Aspect.ClipPoints = true;
drawrectangle = false;
box1.FillSampleValues();
box2.FillSampleValues();
box3.FillSampleValues();
box1.Position = 1;
box2.Position = 2;
box3.Position = 3;
box1.Color = Color.Red;
box2.Color = Color.Yellow;
box3.Color = Color.Green;
box1.Title = "Box1";
box2.Title = "Box2";
box3.Title = "Box3";
box1.Pointer.Visible = true;
box2.Pointer.Visible = true;
box3.Pointer.Visible = true;
Selected1 = new bool[box1.Count];
Selected2 = new bool[box2.Count];
Selected3 = new bool[box3.Count];
tChart1.Panning.MouseButton = MouseButtons.Middle;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
box1.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box1_GetPointerStyle);
box2.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box1_GetPointerStyle);
box3.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box1_GetPointerStyle);
tChart1.Draw();
ResetCoords();
}
Event of the project:
Code: Select all
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if ((X0 != -1) && (Y0 != -1))
{
if (drawrectangle)
{
g.Brush.Visible = false;
g.Pen.Color = Color.Black;
g.Rectangle(X0, Y0, X1, Y1);
}
}
for (int i = 0; i < Selected1.Length; i++)
{
for (int j = 0; j < tChart1.Series.Count; j++)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
Rectangle rect1 = new Rectangle(p.X - box1.Pointer.HorizSize - 5, p.Y - box1.Pointer.VertSize - 5, (box1.Pointer.HorizSize + 5) * 2, (box1.Pointer.VertSize + 5) * 2);
switch (j)
{
case 0:
if (Selected1[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
break;
case 1:
if (Selected2[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
break;
case 2:
if (Selected3[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
break;
}
if (Selected1[i] && Selected2[i] && Selected3[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
}
}
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
drawrectangle = true;
X0 = e.X;
Y0 = e.Y;
}
}
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
if ((X0 != -1) && (Y0 != -1))
{
rect = new Rectangle(X0, Y0, e.X - X0, e.Y - Y0);
for (int i = 0; i < Selected1.Length; i++)
{
for (int j = 0; j < tChart1.Series.Count; j++)
{
if (j == 0)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
if (rect.Contains(p))
{
Selected1[i] = true;
}
else
{
Selected1[i] = false;
}
}
else if (j == 1)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
if (rect.Contains(p))
{
Selected2[i] = true;
}
else
{
Selected2[i] = false;
}
}
else if (j == 2)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
if (rect.Contains(p))
{
Selected3[i] = true;
}
else
{
Selected3[i] = false;
}
}
}
}
ResetCoords();
}
drawrectangle = false;
tChart1.Draw();
}
private int X0, Y0, X1, Y1;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
X1 = e.X;
Y1 = e.Y;
}
tChart1.Invalidate();
}
void box1_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
{
e.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
if (e.ValueIndex != -1)
{
if (Selected1[e.ValueIndex])
{
e.Color = Color.Red;
}
else if (Selected2[e.ValueIndex])
{
e.Color = Color.Red;
}
else if (Selected2[e.ValueIndex])
{
e.Color = Color.Red;
}
}
}
private void ResetCoords()
{
X0 = -1;
Y0 = -1;
}
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Need help in BoxPlot
Hello Sandra,
I am facing problem with this code.
1. I am unable to select the 1st box
2. Unable to select the outlier points of each box.
3. When I select a box plot series , Its drawing only circle instead of highlighting the selected points.(The color of the points should be changed.)
How to exclude and include selected points and redraw the particular box from box series?
with regards,
Vivek J
I am facing problem with this code.
1. I am unable to select the 1st box
2. Unable to select the outlier points of each box.
3. When I select a box plot series , Its drawing only circle instead of highlighting the selected points.(The color of the points should be changed.)
How to exclude and include selected points and redraw the particular box from box series?
with regards,
Vivek J
Re: Need help in BoxPlot
Hello vivek,
I have made changes in last code I send you, and I think works correctly and you could use a similar code as next:
Please check previously code works fine. For check that works you have do next:
For select points:
Click with button Right and draw rectangle of size that you want and containing points.
For unselect:
Click with button Right in the canvas of your Chart.
I hope will helps.
Thanks,
I have made changes in last code I send you, and I think works correctly and you could use a similar code as next:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
bool[] Selected1;
bool[] Selected2;
bool[] Selected3;
// Steema.TeeChart.Styles.Line line;
bool drawrectangle;
Steema.TeeChart.Styles.Box box1,box2,box3;
Rectangle rect;
private void InitializeChart()
{
//------------------INITIALIZE CHART WITH LINE--------------------------//
//line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
//line.FillSampleValues();
//line.Pointer.Visible = true;
//-----------------INITIALIZE CHART WITH BOXPLOT-----------------------//
box1 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
box2 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
box3 = new Steema.TeeChart.Styles.Box(tChart1.Chart);
tChart1.Aspect.View3D = false;
tChart1.Aspect.ClipPoints = true;
drawrectangle = false;
box1.FillSampleValues();
box2.FillSampleValues();
box3.FillSampleValues();
box1.Position = 1;
box2.Position = 2;
box3.Position = 3;
box1.Color = Color.Red;
box2.Color = Color.Yellow;
box3.Color = Color.Green;
box1.Title = "Box1";
box2.Title = "Box2";
box3.Title = "Box3";
box1.Pointer.Visible = true;
box2.Pointer.Visible = true;
box3.Pointer.Visible = true;
Selected1 = new bool[box1.Count];
Selected2 = new bool[box2.Count];
Selected3 = new bool[box3.Count];
tChart1.Panning.MouseButton = MouseButtons.Middle;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
box1.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box1_GetPointerStyle);
box2.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box2_GetPointerStyle);
box3.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(box3_GetPointerStyle);
tChart1.Draw();
ResetCoords();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if ((X0 != -1) && (Y0 != -1))
{
if (drawrectangle)
{
g.Brush.Visible = false;
g.Pen.Color = Color.Black;
g.Rectangle(X0, Y0, X1, Y1);
}
}
for (int i = 0; i < Selected1.Length; i++)
{
for (int j = 0; j < tChart1.Series.Count; j++)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
Rectangle rect1 = new Rectangle(p.X - box1.Pointer.HorizSize - 5, p.Y - box1.Pointer.VertSize - 5, (box1.Pointer.HorizSize + 5) * 2, (box1.Pointer.VertSize + 5) * 2);
switch(j)
{
case 0 :
if (Selected1[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
else
{
box1.Pointer.Brush.Color = Color.Red;
}
break;
case 1 :
if (Selected2[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
else
{
box2.Pointer.Brush.Color = Color.Yellow;
}
break;
case 2 :
if (Selected3[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
else
{
box3.Pointer.Brush.Color = Color.Green;
}
break;
}
if (Selected1[i] && Selected2[i] && Selected3[i])
{
g.Brush.Visible = false;
g.Pen.Color = Color.Blue;
g.Ellipse(rect1);
}
}
}
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
drawrectangle = true;
X0 = e.X;
Y0 = e.Y;
}
}
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
if ((X0 != -1) && (Y0 != -1))
{
rect = new Rectangle(X0, Y0, e.X - X0, e.Y - Y0);
for (int i = 0; i < Selected1.Length; i++)
{
for (int j = 0; j < tChart1.Series.Count; j++)
{
if (j == 0)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
// Point p1 = new Point((tChart1[j] as Steema.TeeChart.Styles.Box).CalcXPos((int)(tChart1[j] as Steema.TeeChart.Styles.Box).MildOut.Series[i].X), (tChart1[j] as Steema.TeeChart.Styles.Box).CalcYPos((int)(tChart1[j] as Steema.TeeChart.Styles.Box).MildOut.Series[i].Y));
if (rect.Contains(p))
{
Selected1[i]=true;
}
else
{
Selected1[i]=false;
}
}
else if (j == 1)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
if (rect.Contains(p))
{
Selected2[i] = true;
}
else
{
Selected2[i] =false;
}
}
else if (j == 2)
{
Point p = new Point(tChart1[j].CalcXPos(i), tChart1[j].CalcYPos(i));
if (rect.Contains(p))
{
Selected3[i] = true;
}
else
{
Selected3[i] = false;
}
}
}
}
ResetCoords();
}
drawrectangle = false;
tChart1.Draw();
}
private int X0, Y0, X1, Y1;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
X1 = e.X;
Y1 = e.Y;
}
tChart1.Invalidate();
}
// Add GetPointerStyle for 3 box plots.
void box1_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
{
e.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
for (int i = 0; i < Selected1.Length; i++)
{
if (Selected1[i])
{
series.Pointer.Brush.Color = Color.GreenYellow;
}
}
}
// Add GetPointerStyle for 3 box plots.
void box3_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
{
e.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
for (int i = 0; i < Selected3.Length; i++)
{
if (Selected3[i])
{
series.Pointer.Brush.Color = Color.GreenYellow;
}
}
}
// Add Get PointerStyle for 3 box plots.
void box2_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
{
e.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
for (int i = 0; i < Selected2.Length; i++)
{
if (Selected2[i])
{
series.Pointer.Brush.Color = Color.GreenYellow;
}
}
}
private void ResetCoords()
{
X0 = -1;
Y0 = -1;
}
For select points:
Click with button Right and draw rectangle of size that you want and containing points.
For unselect:
Click with button Right in the canvas of your Chart.
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Need help in BoxPlot
Hi Sandra,
Thanks, for the new code. It works fine but it's not fulfilling my requirements. I have attached a .zip file which contains a document for the requirements of box plot.
Also I need to know how to exclude and include points ( which may be in box or may be as an outlier ) from that particular series and redraw the graph accordingly.
Thanks for your co-ordination,
with regards,
Vivek J.
Thanks, for the new code. It works fine but it's not fulfilling my requirements. I have attached a .zip file which contains a document for the requirements of box plot.
Also I need to know how to exclude and include points ( which may be in box or may be as an outlier ) from that particular series and redraw the graph accordingly.
Thanks for your co-ordination,
with regards,
Vivek J.
- Attachments
-
- Box Plot Requirement.zip
- (55.28 KiB) Downloaded 820 times
Re: Need help in BoxPlot
Hello vivek,
For select points:
Click with button Right and draw rectangle of size that you want and containing points.
For unselect:
Click with button Right in the canvas of your Chart and drop the mouse.
Thanks,
I couldn't reproduce your issue, please see next image:1) Only the points at the Q1 of each box is getting selected and not all the points of the box.
I couldn't reproduce your this problem: If you want reproduce same with image, you could say what is your version of TeeChartFor.Net?Unable to select the circular point of 1st box (which is in the rectangular box ) and change its color .
For select points:
Click with button Right and draw rectangle of size that you want and containing points.
For unselect:
Click with button Right in the canvas of your Chart and drop the mouse.
I could reproduce your problem, and now, isn't possible paint only MidleOut of BoxPlot series, I have added your suggestion in Feauter Request with number[TF02014359] to regards in features versions of TeeChartFor .Net.Here the Color of the box is getting changing when selected instead of changing the color of the point using which box plot is plotted.
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Need help in BoxPlot
Hello Sandra,
We are using "Steema TeeChart for .NET v3"
The TChart dll version is "3.5.3425.20244".
We have installed TeeChartNET3VSNET2005.
With regards,
Vivek.J
We are using "Steema TeeChart for .NET v3"
The TChart dll version is "3.5.3425.20244".
We have installed TeeChartNET3VSNET2005.
With regards,
Vivek.J
Re: Need help in BoxPlot
Hello Sandra,
Instead of marking with circle, Is it possible to change the color of those points which is represent outside of the boxplot.
With regards,
Vivek.J
Instead of marking with circle, Is it possible to change the color of those points which is represent outside of the boxplot.
With regards,
Vivek.J
Re: Need help in BoxPlot
Hello vivek,
I have to communicate that I check the project using version 3 and I could reproduce your problems. I think the problem is when calculate the X position. I have added this in the list of Bug Report with number [TF02014361]. We will try to fix it for next versions of TeeChart .NET.
Thanks,
I have to communicate that I check the project using version 3 and I could reproduce your problems. I think the problem is when calculate the X position. I have added this in the list of Bug Report with number [TF02014361]. We will try to fix it for next versions of TeeChart .NET.
You, could change the color of outside points of BoxPlot(MiddleOut or ExtrOut), but as I said in last post, There is a Feauter Request with number[TF02014359] that explain that when selected the point outside plot is not possible change the color only this when is selected. But If you want change the color for Outside boxplot, because there aren't transparents please see next lines of code:Instead of marking with circle, Is it possible to change the color of those points which is represent outside of the boxplot.
Code: Select all
box1.MildOut.Transparency = 0;
box2.MildOut.Transparency = 0;
box3.MildOut.Transparency = 0;
box1.MildOut.Brush.Color = Color.GreenYellow;
box2.MildOut.Brush.Color = Color.GreenYellow;
box3.MildOut.Brush.Color = Color.GreenYellow;
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Need help in BoxPlot
Hello Sandra,
As we have to include these features(Exclude/Include option in Boxplot) in our client application, we need the fixed version as soon as posible. Could you please give me the aproximate date, when can we get the fixed version.
With regards,
Vivek.J
As we have to include these features(Exclude/Include option in Boxplot) in our client application, we need the fixed version as soon as posible. Could you please give me the aproximate date, when can we get the fixed version.
With regards,
Vivek.J
Re: Need help in BoxPlot
Hello Sandra,
What is the latest version of Tchart-for-.Net 2005 available in market?
Will it supporting the Boxplot selection features?
With Regards,
Vivek.J
What is the latest version of Tchart-for-.Net 2005 available in market?
Will it supporting the Boxplot selection features?
With Regards,
Vivek.J
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Need help in BoxPlot
Hi Vivek,
It's TeeChart for .NET 2009 (v4). Yes, it works as Sandra posted here. You may download the fully functional evaluation version here and update your v3 license here.
It's TeeChart for .NET 2009 (v4). Yes, it works as Sandra posted here. You may download the fully functional evaluation version here and update your v3 license here.
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 |
Re: Need help in BoxPlot
Hi Narcis,
Will it support for Visual studio 2005.
With Regards,
Vivek.J
Will it support for Visual studio 2005.
With Regards,
Vivek.J
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Need help in BoxPlot
Hi Vivek,
Yes, it includes installers for VS2003, VS2005 and VS2008.
Yes, it includes installers for VS2003, VS2005 and VS2008.
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 |
Re: Need help in BoxPlot
Hello Sandra,
We puchased TeeChart for .NET 2009 (v4).
Now the sample code is working fine.
How to change the selected ExtrOut/MildOut point color?
When we use the following code to change the ExtrOut color, its changing all ExtrOut points
box1.ExtrOut.Transparency = 0;
box1.ExtrOut.Brush.Color = Color.DarkBlue;
How to change the Individual points?
I have used the following code to change the ExtrOut point color. Its not working.
box2.ExtrOut.Transparency = 0;
box2.ExtrOut.Series[0].Color = Color.DarkBlue;
box2.ExtrOut.Series[valueIndex].Color = Color.DarkBlue;
With regards,
Vivek.J
We puchased TeeChart for .NET 2009 (v4).
Now the sample code is working fine.
How to change the selected ExtrOut/MildOut point color?
When we use the following code to change the ExtrOut color, its changing all ExtrOut points
box1.ExtrOut.Transparency = 0;
box1.ExtrOut.Brush.Color = Color.DarkBlue;
How to change the Individual points?
I have used the following code to change the ExtrOut point color. Its not working.
box2.ExtrOut.Transparency = 0;
box2.ExtrOut.Series[0].Color = Color.DarkBlue;
box2.ExtrOut.Series[valueIndex].Color = Color.DarkBlue;
With regards,
Vivek.J