Contour with Custom Pallette
Okay, I have a possible workaround but have one problem.
Is there a function in the contour series that takes in a horizontal position and a vertical position (either screen or value) and returns either the depth value of that point, the point itself which would contain that information or the point index which would let me get the value from the series?
Is there a function in the contour series that takes in a horizontal position and a vertical position (either screen or value) and returns either the depth value of that point, the point itself which would contain that information or the point index which would let me get the value from the series?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
Yes, see Clicked method as in the MouseMove example I posted yesterday. Its return parameter (index) is later used for retrieving contour's ZValues.
Yes, see Clicked method as in the MouseMove example I posted yesterday. Its return parameter (index) is later used for retrieving contour's ZValues.
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 |
When i place this code into the cursorChanged handler in my example:
Index is always equal to minus one. I can confirm that the x and y values from the cursor are correct values form the chart, and i assume the x and y values in the point returned from contour1.ValuePointToScreenPoint are correct.
Whats going wrong?
On a side note this is where the help file needs some work. It gives no indication of what return values to expect in the case of errors or invalid input (im assuming -1 is used to indicate some form of error).
Code: Select all
Point p = contour1.ValuePointToScreenPoint(mainCursor.XValue, mainCursor.YValue);
int index = contour1.Clicked(p);
Whats going wrong?
On a side note this is where the help file needs some work. It gives no indication of what return values to expect in the case of errors or invalid input (im assuming -1 is used to indicate some form of error).
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
Yes, Clicked method doesn't work very well with Contour series. It always gives 1 for ZValues and YValues doesn't coincide with contour's levels. I've added this issue to the bug list to be fixed for next releases with ID number TF02013564.
Yes, Clicked method doesn't work very well with Contour series. It always gives 1 for ZValues and YValues doesn't coincide with contour's levels. I've added this issue to the bug list to be fixed for next releases with ID number TF02013564.
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
We expect next maintenance release to be published in week 51 (from 15th to 21st December). I just logged this in the bug list so I'm still unable to tell you if this issue will be fixed for that release. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's fixed on them.
Thanks in advance.
We expect next maintenance release to be published in week 51 (from 15th to 21st December). I just logged this in the bug list so I'm still unable to tell you if this issue will be fixed for that release. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's fixed on them.
Thanks in advance.
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 |
Thats fine. So in the meantime is there any way to get the point index or zvalue given the x and y co-ordinates?
I.e from the cursor i can get the vertical and horizontal axis positions, and from that I can get the screen location. Given this information is there any working way to get the depth value at that point at the moment?
Does the clicked method function properly for a surface series? (im thinking that if it does i could keep a surface with the same data and plug the given x, y values into its clicked method).
I.e from the cursor i can get the vertical and horizontal axis positions, and from that I can get the screen location. Given this information is there any working way to get the depth value at that point at the moment?
Does the clicked method function properly for a surface series? (im thinking that if it does i could keep a surface with the same data and plug the given x, y values into its clicked method).
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
I can think of any alternative method at the moment.
I'm afraid this is going to be difficult because Contour series levels are calculated from provided values so something like code snippet below won't work either:Thats fine. So in the meantime is there any way to get the point index or zvalue given the x and y co-ordinates?
I.e from the cursor i can get the vertical and horizontal axis positions, and from that I can get the screen location. Given this information is there any working way to get the depth value at that point at the moment?
Code: Select all
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
double xVal = tChart1.Axes.Bottom.CalcPosPoint(e.X);
double zVal = tChart1.Axes.Left.CalcPosPoint(e.Y);
int xIndex = contour1.XValues.IndexOf(xVal);
int zIndex = contour1.ZValues.IndexOf(zVal);
if ((xIndex == zIndex) && (xIndex != -1))
{
tChart1.Header.Text = contour1.YValues[xIndex].ToString() + ", " + contour1.ZValues[xIndex].ToString();
}
}
In that case I recommend you to use ColorGrid series. Clicked method for this series style works:Does the clicked method function properly for a surface series? (im thinking that if it does i could keep a surface with the same data and plug the given x, y values into its clicked method).
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Contour contour1;
private Steema.TeeChart.Styles.ColorGrid colorGrid1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
contour1.FillSampleValues();
colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
colorGrid1.DataSource = contour1;
contour1.Active = false;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int index = colorGrid1.Clicked(e.X, e.Y);
if (index != -1)
{
tChart1.Header.Text = colorGrid1.YValues[index].ToString() + ", " + colorGrid1.ZValues[index].ToString();
}
else
{
tChart1.Header.Text = index.ToString();
}
}
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 |
For future reference my code goes something like this:
Code: Select all
Point p = contour1.ValuePointToScreenPoint(mainCursor.XValue, mainCursor.YValue);
int index = colourGrid1.Clicked(p);
timeTB.Text = mainCursor.XValue.ToString();
wavelenTB.Text = mainCursor.YValue.ToString();
intensityTB.Text = contour1.YValues[index].ToString();
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
You're welcome. I'm glad to hear that!
You're welcome. I'm glad to hear that!
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Dave,
I've been revisiting TF02013564 and found that it's not a bug. Clicked method in Contour series works quite in a different manner as contour series generates its levels from values. So, using Contour's Clicked method combined with Levels' Clicked method works fine, for example:
I've been revisiting TF02013564 and found that it's not a bug. Clicked method in Contour series works quite in a different manner as contour series generates its levels from values. So, using Contour's Clicked method combined with Levels' Clicked method works fine, for example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Contour contour1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
contour1.FillSampleValues();
contour1.ContourMarks.Visible = true;
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int index = contour1.Clicked(e.X, e.Y);
if (index != -1)
{
int segment, point;
contour1.Levels[index].Clicked(e.X, e.Y, out segment, out point);
tChart1.Header.Text = "Level: " + contour1.Levels[index].UpToValue.ToString() +
", Z: " + contour1.ZValues[point].ToString();
}
else
{
tChart1.Header.Text = index.ToString();
}
}
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 |