cause a line to follow the mouse

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

cause a line to follow the mouse

Post by ido » Sun May 18, 2008 3:15 pm

hello,
is there a functionallity that allow the mouse to drag a line to a different location on the chart? if so, is there a code sample for it?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 19, 2008 9:10 am

Hi idan,

Yes, you can do as in the example I posted 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
Image Image Image Image Image Image
Instructions - How to post in this forum

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

drag and drop a bubble..

Post by ido » Wed May 21, 2008 1:27 pm

I am using the above sample to drag a bubble and not a line. Is there a way to show the bubble moving with the mouse cursor until the drop (in transperent way)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 21, 2008 1:47 pm

Hi idan,

If you only want to drag one single bubble you should use DragPoint tool. You'll find an example at All Features\Welcome !\Tools\Drag Point in the features demo, available at TeeChart's program group.

For setting bubble transparency you can do this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;
			tChart1.Zoom.Allow = false;

			bubble1 = new Steema.TeeChart.Styles.Bubble(tChart1.Chart);

			bubble1.FillSampleValues();
			tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);

			Steema.TeeChart.Tools.DragPoint dragPoint1 = new Steema.TeeChart.Tools.DragPoint(tChart1.Chart);
			dragPoint1.Drag += new Steema.TeeChart.Tools.DragPointEventHandler(dragPoint1_Drag);
		}

		void dragPoint1_Drag(Steema.TeeChart.Tools.DragPoint sender, int index)
		{
			bubble1.Colors[index] = Color.FromArgb(50, bubble1.Colors[index]);
			i = index;
		}
		
		private Steema.TeeChart.Styles.Bubble bubble1;
		private int i = -1;

		private void tChart1_MouseUp(object sender, MouseEventArgs e)
		{
			bubble1.Colors[i] = Color.FromArgb(0, bubble1.Colors[i]);
			i = -1;
		}
Best Regards,
Narcís Calvet / 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

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

great tool.

Post by ido » Wed May 21, 2008 2:59 pm

Can i force the drag to be followed only on the y axis meaning only vertically, and how can i make the bubble transperent during the drag?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 21, 2008 3:04 pm

Hi idan,

Yes, set DragPoint tool like this:

Code: Select all

			dragPoint1.Style = Steema.TeeChart.Tools.DragPointStyles.Y;
Have you tried running the example I posted? It already makes the dragged bubble transparent.
Best Regards,
Narcís Calvet / 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

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

one more question...

Post by ido » Wed May 21, 2008 3:09 pm

i have multiplie series on the chart, and i want to drag only specific graph and not all the series on the chart.

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

regarding the transperent issue...

Post by ido » Wed May 21, 2008 3:15 pm

i guess it's making it transperent, but it's very hard to see it because the bubble style is polished sphere

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 22, 2008 7:29 am

Hi idan,

You can set DragPoint tool to a specific series:

Code: Select all

			dragPoint1.Series = bubble1;
So that it will only work for this series. Using line above together with the code in my example will only drag bubble1 series.
Best Regards,
Narcís Calvet / 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

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

click event is not fired because of dragTool

Post by ido » Thu May 22, 2008 8:20 am

after adding a drag tool to a series the series click event (only left click, right click fires the event) isn't fired. is that a known issue? is there a way to keep the drag tool and still fire the event?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 22, 2008 9:17 am

Hi idan,

By defaul DragPoint tool uses left mouse button, if you want to use right button you need to do this:

Code: Select all

			dragPoint1.Button = MouseButtons.Right;
DragPoint tool masks the ClickSeries event. However, you can achieve what you request using MouseDown event like this:

Code: Select all

		void tChart1_MouseDown(object sender, MouseEventArgs e)
		{
			for (int i = 0; i < tChart1.Series.Count; i++)
			{
				if (tChart1[i].Clicked(e.X,e.Y) != -1)
				{
					tChart1.Header.Text = "Series " + i.ToString() + " clicked at point " + 
																tChart1[i].Clicked(e.X, e.Y).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
Image Image Image Image Image Image
Instructions - How to post in this forum

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

double click event with DragTool

Post by ido » Thu May 22, 2008 11:19 am

the DragTool masks the double click for a series as well. is there a work around for it also?
one more question for the bubble graph. is there a way to keep the bubble the same size even in zoom events?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 22, 2008 11:30 am

Hi idan,
the DragTool masks the double click for a series as well. is there a work around for it also?
You can use chart's DoubleClick event like this:

Code: Select all

		void tChart1_DoubleClick(object sender, EventArgs e)
		{
			for (int i = 0; i < tChart1.Series.Count; i++)
			{
				if (tChart1[i].Clicked(X, Y) != -1)
				{
					tChart1.Header.Text = "Series " + i.ToString() + " dblclicked at point " +
																tChart1[i].Clicked(X, Y).ToString();
				}
			}

			X = -1;
			Y = -1;
		}

		private int X = -1;
		private int Y = -1;

		void tChart1_MouseDown(object sender, MouseEventArgs e)
		{
			X = e.X;
			Y = e.Y;
		}
one more question for the bubble graph. is there a way to keep the bubble the same size even in zoom events?
I'm not sure about what you exactly mean. However, you could try changing bubbles radius according to the zooming ratio. You could try using the Zoomed and UndoneZoom events for that. Retrieving initial axes min. and max. values before and after zooming will give you the zooming ratio.
Best Regards,
Narcís Calvet / 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

ido
Newbie
Newbie
Posts: 19
Joined: Thu Aug 31, 2006 12:00 am

keep the bubble the same size even in zoom events

Post by ido » Thu May 22, 2008 12:19 pm

how can i change the radius for a series after calculating the zoom ratio.(I guess you meant the difference between the inital and current axes in the zoomed event...)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 22, 2008 12:41 pm

Hi idan,

Yes, exactly. You can change radius values like this:

Code: Select all

			for (int i = 0; i < bubble1.Count; i++)
			{
				bubble1.RadiusValues[i] *= ratio;
			}
Best Regards,
Narcís Calvet / 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