Cross on Surface 3D
Cross on Surface 3D
Hello,
I 've question about cross(point) on surface 3D.
Is it possible to have a floatin cross or point on surface 3D (like in picture)?
What is a easy way to do it in TeeChart v6 or TeeChartV2010, but better it will be in v6.
Thank you for your answer.
I 've question about cross(point) on surface 3D.
Is it possible to have a floatin cross or point on surface 3D (like in picture)?
What is a easy way to do it in TeeChart v6 or TeeChartV2010, but better it will be in v6.
Thank you for your answer.
- Attachments
-
- CursorOn3DTeeChart2.jpg (20.71 KiB) Viewed 17167 times
-
- CursorOn3DTeeChart.jpg (11.72 KiB) Viewed 17153 times
Re: Cross on Surface 3D
Hello inea,
You can use SurfaceNereastTool you can find an example in TeeChart.Net demo project AllFeauters\Welcome !\Tools\Surface Nearest .
I hope will helps.
Thanks,
You can use SurfaceNereastTool you can find an example in TeeChart.Net demo project AllFeauters\Welcome !\Tools\Surface Nearest .
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: Cross on Surface 3D
Hello Sandra,
Thank you for your quick answer at first.
I may use SurfaceNereastTool, if it possible to connect ColorGrid and Surface.
I have to implement ColorGrid, with floating cross(like in picture). And when I move this cross with mouse, cross on surface is move to.
i 've implemented ColorGrid with CursorTool. And by the way, how i get Z value from ColorGrid with CursorTool ?
Is it better way to implement ColorGrid with CursorTool or NereastPoint ? I have to be very precise #.000000
Thank you for your answer, and sorry for my english
Thank you for your quick answer at first.
I may use SurfaceNereastTool, if it possible to connect ColorGrid and Surface.
I have to implement ColorGrid, with floating cross(like in picture). And when I move this cross with mouse, cross on surface is move to.
i 've implemented ColorGrid with CursorTool. And by the way, how i get Z value from ColorGrid with CursorTool ?
Is it better way to implement ColorGrid with CursorTool or NereastPoint ? I have to be very precise #.000000
Thank you for your answer, and sorry for my english
- Attachments
-
- CursorOn2DTeeChart.jpg (6.64 KiB) Viewed 17093 times
Re: Cross on Surface 3D
Hello iena,
Sorry for the delay. I have made a simple code for you using SurfaceNearestTool and CursorTool. Please check if it works as you want:
I hope will helps.
Thanks,
Sorry for the delay. I have made a simple code for you using SurfaceNearestTool and CursorTool. Please check if it works as you want:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Tools.CursorTool tool2;
private Steema.TeeChart.Tools.SurfaceNearestTool tool3;
private void InitializeChart()
{
tChart1.Aspect.Orthogonal = false;
tChart1.Aspect.Chart3DPercent = 50;
Steema.TeeChart.Styles.Surface Series1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);
Steema.TeeChart.Styles.ColorGrid Series2 = new Steema.TeeChart.Styles.ColorGrid(tChart2.Chart);
Series2.IrregularGrid = true;
Series1.FillSampleValues();
Series2.DataSource = Series1;
tChart1.Tools.Add(new Steema.TeeChart.Tools.Rotate());
tChart2.Aspect.View3D = false;
tool2 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
tool3= new Steema.TeeChart.Tools.SurfaceNearestTool(tChart1.Chart);
tool3.Series = Series1;
tool2.Series = Series2;
tool2.FollowMouse = true;
tool2.Pen.Color = Color.Red;
tool2.Snap = true;
tool2.Pen.Width = 2;
tool3.Select += new Steema.TeeChart.Tools.SelectEventHandler(tool3_Select);
}
void tool3_Select(object sender, EventArgs e)
{
int index = (sender as Steema.TeeChart.Tools.SurfaceNearestTool).SelectedCell;
CursorSynchronize(index, tool2);
}
private void CursorSynchronize(int index, Steema.TeeChart.Tools.CursorTool TOOL)
{
double ZValueColorGrid;
Steema.TeeChart.Styles.ColorGrid colorGrid = (tChart2[0] as Steema.TeeChart.Styles.ColorGrid);
if (index != -1)
{
ZValueColorGrid = colorGrid.ZValues[index];
TOOL.XValue = colorGrid.XValues[index];
TOOL.YValue = ZValueColorGrid;
this.Text = index.ToString() + "," + "Value Z" + ZValueColorGrid.ToString();
}
}
private void button2_Click(object sender, EventArgs e)
{
tChart1.ShowEditor();
}
private void button3_Click(object sender, EventArgs e)
{
tChart2.ShowEditor();
}
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: Cross on Surface 3D
Hello Sandra,
Thank you very much, for example and your's time. This sample is amazing.
Sorry, that my interpretation was't very good, but I need oposite functionality.
When I 'll move cursor on ColorGrid, SurfaceNearestTool change his position. SurfaceNearestTool have to be moved only by ColorGrid cursor.
Is this somehow possible?
Thank you for your answer.
Thank you very much, for example and your's time. This sample is amazing.
Sorry, that my interpretation was't very good, but I need oposite functionality.
When I 'll move cursor on ColorGrid, SurfaceNearestTool change his position. SurfaceNearestTool have to be moved only by ColorGrid cursor.
Is this somehow possible?
Thank you for your answer.
Re: Cross on Surface 3D
Hello iena,
Sorry for the delay. I have made a solution for you, using code of SurfaceNereastPoint, as next example:
Could you tell us if it code works as you want?
I hope will helps.
Thanks,
Sorry for the delay. I have made a solution for you, using code of SurfaceNereastPoint, as next example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Tools.CursorTool tool2;
private Steema.TeeChart.Tools.SurfaceNearestTool tool3;
int tmp, t;
double tmpRow, tmpCol;
Steema.TeeChart.Styles.Custom3DGrid custom3D;
Color FSolidColor;
bool FIsSolidColor;
private Color[] originalColors;
private void InitializeChart()
{
tChart1.Aspect.Orthogonal = false;
tChart1.Aspect.Chart3DPercent = 50;
Steema.TeeChart.Styles.Surface Series1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);
Steema.TeeChart.Styles.ColorGrid Series2 = new Steema.TeeChart.Styles.ColorGrid(tChart2.Chart);
//InitializeSeries
Series1.FillSampleValues(10);
Series2.IrregularGrid = true;
Series2.DataSource = Series1;
tChart1.Tools.Add(new Steema.TeeChart.Tools.Rotate());//AddRotateTool.
tChart1.Draw();
//Save original Colors of surface in array of colors.
originalColors = new Color[Series1.Count];
for (int i = 0; i < Series1.Count; i++)
{
originalColors[i] = Series1.ValueColor(i);
}
tChart2.Aspect.View3D = false;
//InitializeTools
//tool2 = CursorTool
tool2 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
tool2.Series = Series2;
tool2.FollowMouse = true;
tool2.Pen.Color = Color.Red;
tool2.Snap = true;
tool2.Pen.Width = 2;
//tool3=SurfaceNearestTool
tool3 = new Steema.TeeChart.Tools.SurfaceNearestTool(tChart1.Chart);
tool3.Series = Series1;
tool3.Select += new Steema.TeeChart.Tools.SelectEventHandler(tool3_Select);
tChart2.MouseMove += new MouseEventHandler(tChart2_MouseMove);
}
void tChart2_MouseMove(object sender, MouseEventArgs e)
{
Steema.TeeChart.Styles.ColorGrid Series = (tChart2[0] as Steema.TeeChart.Styles.ColorGrid);
tool2.XValue = tChart2[0].XScreenToValue(e.X);
tool2.YValue = tChart2[0].YScreenToValue(e.Y);
//Calculate SurfaceNearesPoints.
MouveSurfaceNearestTool(e.X, e.Y, Series);
}
private void MouveSurfaceNearestTool(int x, int y, Steema.TeeChart.Styles.ColorGrid Series)
{
Steema.TeeChart.Styles.Surface Series1 = ((tChart1[0] as Steema.TeeChart.Styles.Surface));
if (Series.Clicked(x, y) != -1)
{
if (Series.Count > 0)
{
FSolidColor = Series.ValueColor(0);
}
FIsSolidColor = FSolidColor == Series1.ValueColor(1);
tmp = Series.Clicked(x, y);
if (tmp != tool3.SelectedCell)
{
tool3.SelectedCell = tmp;
Series.Chart.AutoRepaint = false;
}
if (tool3.SelectedCell == -1)
{
for (t = 0; t < custom3D.Count; ++t)
{
if (FIsSolidColor)
(custom3D[t] as SeriesXYZPoint).Color = FSolidColor;
else
(custom3D[t] as SeriesXYZPoint).Color = originalColors[t];
}
}
else
{
custom3D = (Series1 as Steema.TeeChart.Styles.Custom3DGrid);
tool3.GetRowCol(out tmpRow, out tmpCol);
for (int t = 0; t < custom3D.Count; ++t)
{
if ((custom3D.XValues[t] == tmpRow) && (custom3D.ZValues[t] == tmpCol))
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.CellColor;
else if (custom3D.XValues[t] == tmpRow)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.RowColor;
else if (custom3D.ZValues.Value[t] == tmpCol)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.ColumnColor;
else
if (FIsSolidColor)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = FSolidColor;
else
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = originalColors[t];
}
}
Series.Chart.AutoRepaint = true;
Series.Chart.Invalidate();
}
}
void tool3_Select(object sender, EventArgs e)
{
int index = (sender as Steema.TeeChart.Tools.SurfaceNearestTool).SelectedCell;
CursorSynchronize(index, tool2);
tChart1[0].Chart.AutoRepaint = true;
tChart1[0].Chart.Invalidate();
}
private void CursorSynchronize(int index, Steema.TeeChart.Tools.CursorTool TOOL)
{
double ZValueColorGrid;
Steema.TeeChart.Styles.ColorGrid colorGrid = (tChart2[0] as Steema.TeeChart.Styles.ColorGrid);
if (index != -1)
{
ZValueColorGrid = colorGrid.ZValues[index];
TOOL.XValue = colorGrid.XValues[index];
TOOL.YValue = ZValueColorGrid;
}
}
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: Cross on Surface 3D
Hello Sandra,
Thank you very much for this example.
This example it works exactly as I want.
Almost perfect, becouse I have irregular surface and irregular colorGrid, and this example doesn't work right with irregular colorGrid and surface.
Also SurfaceNearestTool doesn't work correct if I have irregular surface. Is it a bug?
I have X and Z values from -100 to 100 on 10x10 surface.
Can I somehow add regular surface with 10000 points, and only 100 poits is visible on surface?
That is my sample DataSource:
Thank you very much for your answer.
Thank you very much for this example.
This example it works exactly as I want.
Almost perfect, becouse I have irregular surface and irregular colorGrid, and this example doesn't work right with irregular colorGrid and surface.
Also SurfaceNearestTool doesn't work correct if I have irregular surface. Is it a bug?
I have X and Z values from -100 to 100 on 10x10 surface.
Can I somehow add regular surface with 10000 points, and only 100 poits is visible on surface?
That is my sample DataSource:
Code: Select all
DataTable t1 = new DataTable();
t1.Columns.Add("x");
t1.Columns.Add("y");
t1.Columns.Add("z");
t1.Rows.Add(1, 3, 1);
t1.Rows.Add(3, 2, 1);
t1.Rows.Add(5, 3, 1);
t1.Rows.Add(7, 3, 1);
t1.Rows.Add(1, 3, 3);
t1.Rows.Add(3, 2, 3);
t1.Rows.Add(5, 3, 3);
t1.Rows.Add(7, 3, 3);
t1.Rows.Add(1, 3, 5);
t1.Rows.Add(3, 2, 5);
t1.Rows.Add(5, 3, 5);
t1.Rows.Add(7, 3, 5);
t1.Rows.Add(1, 3, 7);
t1.Rows.Add(3, 2, 7);
t1.Rows.Add(5, 3, 7);
t1.Rows.Add(7, 3, 7);
surface.DataSource = t1;
Thank you very much for your answer.
Re: Cross on Surface 3D
Hello iena,
I have changed, in my example, IrregularGrid=false to IrregularGrid=true. Please, check if using next code your problem appears:
Thanks,
I have changed, in my example, IrregularGrid=false to IrregularGrid=true. Please, check if using next code your problem appears:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Tools.CursorTool tool2;
private Steema.TeeChart.Tools.SurfaceNearestTool tool3;
int tmp, t;
double tmpRow, tmpCol;
Steema.TeeChart.Styles.Custom3DGrid custom3D;
Color FSolidColor;
bool FIsSolidColor;
private Color[] originalColors;
private void InitializeChart()
{
tChart1.Aspect.Orthogonal = false;
tChart1.Aspect.Chart3DPercent = 50;
Steema.TeeChart.Styles.Surface Series1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);
Steema.TeeChart.Styles.ColorGrid Series2 = new Steema.TeeChart.Styles.ColorGrid(tChart2.Chart);
//InitializeSeries
// Series1.FillSampleValues(10);
Series1.FillSampleValues(10);
Series2.IrregularGrid = true;
Series1.IrregularGrid = true;
Series2.DataSource = Series1;
tChart1.Tools.Add(new Steema.TeeChart.Tools.Rotate());//AddRotateTool.
tChart1.Draw();
//Save original Colors of surface in array of colors.
originalColors = new Color[Series1.Count];
for (int i = 0; i < Series1.Count; i++)
{
originalColors[i] = Series1.ValueColor(i);
}
tChart2.Aspect.View3D = false;
//InitializeTools
//tool2 = CursorTool
tool2 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
tool2.Series = Series2;
tool2.FollowMouse = true;
tool2.Pen.Color = Color.Red;
tool2.Snap = true;
tool2.Pen.Width = 2;
//tool3=SurfaceNearestTool
tool3 = new Steema.TeeChart.Tools.SurfaceNearestTool(tChart1.Chart);
tool3.Series = Series1;
// Series1.IrregularGrid = true;
tool3.Select += new Steema.TeeChart.Tools.SelectEventHandler(tool3_Select);
tChart2.MouseMove += new MouseEventHandler(tChart2_MouseMove);
}
void tChart2_MouseMove(object sender, MouseEventArgs e)
{
Steema.TeeChart.Styles.ColorGrid Series = (tChart2[0] as Steema.TeeChart.Styles.ColorGrid);
tool2.XValue = tChart2[0].XScreenToValue(e.X);
tool2.YValue = tChart2[0].YScreenToValue(e.Y);
//Calculate SurfaceNearesPoints.
MouveSurfaceNearestTool(e.X, e.Y, Series);
}
private void MouveSurfaceNearestTool(int x, int y, Steema.TeeChart.Styles.ColorGrid Series)
{
Steema.TeeChart.Styles.Surface Series1 = ((tChart1[0] as Steema.TeeChart.Styles.Surface));
if (Series.Clicked(x, y) != -1)
{
if (Series.Count > 0)
{
FSolidColor = Series.ValueColor(0);
}
FIsSolidColor = FSolidColor == Series1.ValueColor(1);
tmp = Series.Clicked(x, y);
if (tmp != tool3.SelectedCell)
{
tool3.SelectedCell = tmp;
Series.Chart.AutoRepaint = false;
}
if (tool3.SelectedCell == -1)
{
for (t = 0; t < custom3D.Count; ++t)
{
if (FIsSolidColor)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = FSolidColor;
else
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = originalColors[t];
}
}
else
{
custom3D = (Series1 as Steema.TeeChart.Styles.Custom3DGrid);
tool3.GetRowCol(out tmpRow, out tmpCol);
for (int t = 0; t < custom3D.Count; ++t)
{
if ((custom3D.XValues[t] == tmpRow) && (custom3D.ZValues[t] == tmpCol))
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.CellColor;
else if (custom3D.XValues[t] == tmpRow)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.RowColor;
else if (custom3D.ZValues.Value[t] == tmpCol)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = tool3.ColumnColor;
else
if (FIsSolidColor)
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = FSolidColor;
else
(custom3D[t] as Steema.TeeChart.Styles.SeriesXYZPoint).Color = originalColors[t];
}
}
Series.Chart.AutoRepaint = true;
Series.Chart.Invalidate();
}
}
void tool3_Select(object sender, EventArgs e)
{
int index = (sender as Steema.TeeChart.Tools.SurfaceNearestTool).SelectedCell;
CursorSynchronize(index, tool2);
tChart1[0].Chart.AutoRepaint = true;
tChart1[0].Chart.Invalidate();
}
private void CursorSynchronize(int index, Steema.TeeChart.Tools.CursorTool TOOL)
{
double ZValueColorGrid;
Steema.TeeChart.Styles.ColorGrid colorGrid = (tChart2[0] as Steema.TeeChart.Styles.ColorGrid);
if (index != -1)
{
ZValueColorGrid = colorGrid.ZValues[index];
TOOL.XValue = colorGrid.XValues[index];
TOOL.YValue = ZValueColorGrid;
}
}
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: Cross on Surface 3D
Hello Sandra,
Thank you very much for this example. This example work well.
But with my sample data, this example doesn't work.
Could you please try my sample Data?
Thank you very much for your answer.
Thank you very much for this example. This example work well.
But with my sample data, this example doesn't work.
Could you please try my sample Data?
Code: Select all
DataTable t1 = new DataTable();
t1.Columns.Add("x");
t1.Columns.Add("y");
t1.Columns.Add("z");
t1.Rows.Add(1, 3, 1);
t1.Rows.Add(3, 2, 1);
t1.Rows.Add(5, 3, 1);
t1.Rows.Add(7, 3, 1);
t1.Rows.Add(1, 3, 3);
t1.Rows.Add(3, 2, 3);
t1.Rows.Add(5, 3, 3);
t1.Rows.Add(7, 3, 3);
t1.Rows.Add(1, 3, 5);
t1.Rows.Add(3, 2, 5);
t1.Rows.Add(5, 3, 5);
t1.Rows.Add(7, 3, 5);
t1.Rows.Add(1, 3, 7);
t1.Rows.Add(3, 2, 7);
t1.Rows.Add(5, 3, 7);
t1.Rows.Add(7, 3, 7);
surface.DataSource = t1;
Thank you very much for your answer.
Re: Cross on Surface 3D
Hello iena,
Ok. I could reproduce your problem with last version of TeeChart.Net and I have added your request in bug list report with number [TF02015329]. We will try to fix it, in next maintenance releases of TeeChart.Net.
Thanks,
Ok. I could reproduce your problem with last version of TeeChart.Net and I have added your request in bug list report with number [TF02015329]. We will try to fix it, in next maintenance releases of TeeChart.Net.
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: Cross on Surface 3D
Hello Sandra,
Thank you very much for your's time.
Thank you very much for your's time.
Re: Cross on Surface 3D
Hello Sandra,
Is it something new in this problem?
Thanks
Is it something new in this problem?
Thanks
Re: Cross on Surface 3D
Hello iena,
I inform you that bug with number [TF02015329] already is fixed to next maintenance release of TeeChart.Net. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.
Thanks,
I inform you that bug with number [TF02015329] already is fixed to next maintenance release of TeeChart.Net. I recommend you to be aware at this forum, our RSS news feed, twitter and facebook accounts for new release announcements and what's implemented on them.
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 |