ChartMouseListener events error using ZoomStyle.INCHART

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Novus
Newbie
Newbie
Posts: 2
Joined: Mon May 12, 2014 12:00 am

ChartMouseListener events error using ZoomStyle.INCHART

Post by Novus » Wed Aug 20, 2014 1:56 pm

Hi,

After starting to use the ZoomStyle.INCHART_MULTI im my charts, the ChartMouseListener events stopped working, how can I reuse the backgroundClicked(ChartMouseEvent arg0)) event with this style of zoom?

Code: Select all

chart.getZoom().setZoomStyle(ZoomStyle.INCHART_MULTI);

Code: Select all

chart1.addChartMouseListener(new ChartMouseListener() {
			
			@Override
			public void titleClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void legendClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void backgroundClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
                               This event is no longer triggered with this zoom Style

			}
			
			@Override
			public void axesClicked(ChartMouseEvent arg0) {
				// TODO Auto-generated method stub
				
			}
		} );

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: ChartMouseListener events error using ZoomStyle.INCHART

Post by Yeray » Thu Aug 21, 2014 11:11 am

Hello Novus,

I could reproduce the problem so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=894
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: ChartMouseListener events error using ZoomStyle.INCHART

Post by Yeray » Thu Aug 21, 2014 11:13 am

Hi again,

I've already found a fix for it so the next maintenance release will include it.

I see you own the TeeChart sources so here it is the fix:
At TChart.java, at the beginning of the onTouch method you'll see this:

Code: Select all

	public boolean onTouch(View v, MotionEvent event) {
	//...
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN: {
			if (chart.getZoom().getZoomStyle() != ZoomStyle.INCHART_MULTI)
			  triggerEvent(event, FrameworkMouseEvent.MOUSE_PRESSED);
	//...
Just remove the if condition to have this:

Code: Select all

	public boolean onTouch(View v, MotionEvent event) {
	//...
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN: {
			triggerEvent(event, FrameworkMouseEvent.MOUSE_PRESSED);
	//...
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Novus
Newbie
Newbie
Posts: 2
Joined: Mon May 12, 2014 12:00 am

Re: ChartMouseListener events error using ZoomStyle.INCHART

Post by Novus » Thu Aug 21, 2014 5:41 pm

thanks, I'll try to modify the source code here.

Post Reply