Problem in Imagepoint series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Problem in Imagepoint series

Post by Sugan » Thu Oct 25, 2012 2:54 pm

Hi,

We are using ImagePoint seriesto display data on TeeChart. We are performing some operations when each of the points are clicked, based on the index of the clicked point. We are using the ImagePoint.ClickPointer event to handle this and using the 'valueIndex' parameter. But when the points are placed a bit closer (or when there is a slight overlap), the valueIndex returned by the ClickPointer event is not so accurate.

Same problem happens with the TChart.ClickSeries event as well.

Here is the sample code for your reference:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart.Styles;

namespace SampleTrend
{
	public partial class Form8 : Form
	{
		public Form8()
		{
			InitializeComponent();
		}

		private void Form8_Load(object sender, EventArgs e)
		{
			ImagePoint points = new ImagePoint(tChart1.Chart);
			points.Pointer.HorizSize = 16;
			points.Pointer.VertSize = 16;
			points.Add(1, 1);
			points.Add(2, 1);
			points.Add(3, 1);

			points.ClickPointer += new CustomPoint.ClickPointerEventHandler(points_ClickPointer);
			tChart1.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);

			tChart1.Axes.Bottom.SetMinMax(0, 30);

		}

		void tChart1_ClickSeries(object sender, Series s, int valueIndex, MouseEventArgs e)
		{
			//valueIndex is not always accurate; try clicking on the center of each point
			MessageBox.Show(valueIndex.ToString());
		}

		void points_ClickPointer(CustomPoint series, int valueIndex, int x, int y)
		{
			//valueIndex is not always accurate; try clicking on the center of each point
			MessageBox.Show(valueIndex.ToString());
		}
	}
}

Please let us know how this can be solved.
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Thu Oct 25, 2012 4:12 pm

Hello Sugan,

I can not reproduce your problem using last version of TeeChartFor.Net. Can you tell us which version are you using?


Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Re: Problem in Imagepoint series

Post by Sugan » Fri Oct 26, 2012 5:39 am

Hi Sandra,

I'm using the 2012 September release and I'm able to reproduce this issue with the sample code I have provided (even in the earlier releases).
For example, please try clicking on the center of second pointer, you should get a message box with value 1 (that is the actual index), but it mostly shows 2.
If you click the first pointer, it should display 0, but it displays 1.

I have attached a WebEx recorder video file (clickpointer.zip) to illustrate this. Please go through that and give me a solution.
Attachments
clickpointer.zip
ClickPointer video
(113.08 KiB) Downloaded 563 times
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Fri Oct 26, 2012 8:33 am

Hello Sugan,

Ok. The valueindex is the Index of the value in the series. If you want get the point value of series, you need access using valueindex to value point as do in next line of code:

Code: Select all

series.XValues[valueIndex].ToString(); 
Can you tell us if previous line of code help you to achieve as you want?

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Re: Problem in Imagepoint series

Post by Sugan » Fri Oct 26, 2012 10:17 am

Hi Sandra,

Thanks for your reply. But I want the valueIndex only. My problem is that, the valueIndex returned by the ClickPointer event is wrong. That's what I have demonstrated in the attached video as well. When the valueIndex is wrong, I wont be able to identify the actually clicked pointer properly.

That is, the mouse click is captured by a different pointer than the one I clicked.
I hope you are able to understand the actual problem.

So please provide a fix for the same.
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Fri Oct 26, 2012 3:35 pm

Hello Sugan,

I have reproduced your problem. This is produced because the points are very close to each other and the difference of pixels is very small. To solve I suggest you some solution:

1.- Increase separation of between points.
2.- Reduce the size of Pointer.
3.- Use CalcPosPoint of Axes method as do in next lines of code:

Code: Select all

 void points_ClickPointer(CustomPoint series, int valueIndex, int x, int y)
        {
            //valueIndex is not always accurate; try clicking on the center of each point
            MessageBox.Show(((int)tChart1.Axes.Bottom.CalcPosPoint(x)).ToString());
        }

I hope will we help.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Re: Problem in Imagepoint series

Post by Sugan » Thu Jan 03, 2013 1:08 pm

That didn't help Sandra. Cannot use the CalcPosPoint. That is not relevant.
Also the Series.ClickedPointer() method is returning wrong index only. Is there any other way to capture the clicked pointer's correct valueIndex using the X and Y values available ?

Another problem I'm facing, when having many overlapping points is, the ClickPointer event is not getting fired sometimes. Any solutions for this ?

Thanks,
Sugan
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Fri Jan 04, 2013 12:41 pm

Hello Sugan,

About your both questions.

I have made a project where there is a extra series with same values as first series and I have gotten the Index and X Value without problems. Could you please check my code and tell us if it works as you want? On the other hand, You must know if you have two series with same values always returns the values of last series as you added.
TestSourceCode.zip
(20.45 KiB) Downloaded 536 times
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
Image Image Image Image Image Image
Instructions - How to post in this forum

Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Re: Problem in Imagepoint series

Post by Sugan » Tue Jan 08, 2013 9:30 am

Hi Sandra,

Thanks for your sample. But I'm able to replicate the issue even in your code. I have attached here a video screenshot (webex recorded file) of the same.
When we click on the center of the pointer, the value index is proper. But when clicked a little bit to the right, it shows the index of the next point.

For me this happens even when there is only one series. That is what I have illustrated in my previous replies.
I even tried to use ClickSeries event. But the valueIndex returned is same as that of the ClickPointer event and hence my problem is not solved.

I believe this is a bug and should be addressed. We are waiting for a patch for other issues also.
Please do the needful.

Thanks,
Sugan
Attachments
testsource1.zip
Webex recording of your sample
(142.93 KiB) Downloaded 510 times
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Wed Jan 09, 2013 12:10 pm

Hello Sugan,
I believe this is a bug and should be addressed. We are waiting for a patch for other issues also.
We doesn't consider it as a bug,is a behavior of design. The questions is where there is an overlap of points, which return value for valueIndex is the "correct" value? A decision has to be made. The decision we made was to return the valueIndex for the point which is more visible, that is, for the point that paints over the point behind it and for this when you sometimes the index as you get corresponds a index of overlap series. I have made a simple code because you can see the behavior:

Code: Select all

        private void InitializeChart()
        {
            tChart1.Width = 500;
            tChart1.Height = 300;
            Points points = new Points(tChart1.Chart);
            points.Pointer.HorizSize = 80;
            points.Pointer.VertSize = 80;
            points.Add(1, 1, Color.Red);
            points.Add(2, 2, Color.Yellow);
            points.Add(3, 3, Color.Green);

            points.ClickPointer  = new CustomPoint.ClickPointerEventHandler(points_ClickPointer);
            tChart1.ClickSeries  = new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
        }

        void tChart1_ClickSeries(object sender, Series s, int valueIndex,   MouseEventArgs e)
    {
      //valueIndex is not always accurate; try clicking on the center of each point
      MessageBox.Show(valueIndex.ToString());
    }

        void points_ClickPointer(CustomPoint series, int valueIndex, int x, int y)
    {
      //valueIndex is not always accurate; try clicking on the center of each point
      MessageBox.Show(valueIndex.ToString());
    }
If you believe our interpretation isn't correct, please explain us how you would justify returning a different valueIndex in the case of overlapping points because we could consider your reasoning.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sugan
Newbie
Newbie
Posts: 18
Joined: Tue Oct 23, 2012 12:00 am

Re: Problem in Imagepoint series

Post by Sugan » Thu Jan 10, 2013 10:38 am

Hi Sandra,

Your reasoning is correct. But I'm not facing any problems with the Points series. The issue is only with the ImagePoint series.
But thanks for your recent sample; that helped me to narrow down to the issue. The actual problem is, the image displayed by the ImagePoint series doesn't fill up the pointer's HorizSize and VertSize completely. Because of that we are not able to see the overlap properly and hence misguided that there is no overlap.

Please check the code below:

Code: Select all

 private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
			tChart1.Width = 500;
            tChart1.Height = 300;

			Points points1 = new Points(tChart1.Chart);
			points1.Add(1, 1, Color.Red);
			points1.Add(2, 2, Color.Yellow);
			points1.Add(3, 3, Color.Green);
			points1.Pointer.HorizSize = 80;
			points1.Pointer.VertSize = 80;
			
			ImagePoint points = new ImagePoint(tChart1.Chart);
			points.Add(1, 1, Color.Red);
			points.Add(2, 2, Color.Yellow);
			points.Add(3, 3, Color.Green);
			points.Pointer.HorizSize = 80;
			points.Pointer.VertSize = 80;

            points.ClickPointer  += new CustomPoint.ClickPointerEventHandler(points_ClickPointer);
            tChart1.ClickSeries  += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
        }

        void tChart1_ClickSeries(object sender, Series s, int valueIndex,   MouseEventArgs e)
    {
      MessageBox.Show(valueIndex.ToString());
    }

        void points_ClickPointer(CustomPoint series, int valueIndex, int x, int y)
    {
      MessageBox.Show(valueIndex.ToString());
    }
Here is the output:
output.png
Output
output.png (61.89 KiB) Viewed 13847 times
Here I'm adding both Points and ImagePoint series with same values and pointer size. But you can see that the Points series fills the whole 80px. But the image displayed in ImagePoint is displayed only in the center. This misguides the user that there is no overlap between the pointers of ImagePoint series; but actually there is an overlap which we are not able to identify.

Is there any property which says if the image should stretch completely, or a margin, or a padding setting which determines the displayed image size (not the actual pointer size) ?

I hope you are able to understand my question.
Regards,
Sugan

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Thu Jan 10, 2013 12:44 pm

Hello Sugan,
Is there any property which says if the image should stretch completely, or a margin, or a padding setting which determines the displayed image size (not the actual pointer size) ?
In this point you are right,because at the moment doesn't exist any property that allow you modify the style of image point. For this reason, we add this request in feature request number [TF02016482] to be consider its inclusion in upcoming releases of TeeChartFor.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
Image Image Image Image Image Image
Instructions - How to post in this forum

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem in Imagepoint series

Post by Sandra » Wed Feb 20, 2013 3:51 pm

Hello Sugan,

I inform you that the bug number [TF02016482] is already fixed for next maintenance release of TeeChartFor.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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply