Double click chart series in IOS application
Double click chart series in IOS application
Hello,
I am developing an ios application using Teechart. I have created a bar chart. Now want 2 events :
1.) single tap/click on series : to display tooltip of x and y axes values.
2.) Double tap/click series : to drill down the chart.
I am able to find out the code for single click on series as follows:
this.chart.ClickSeries += (sender, s, valueIndex, e) =>
{ };
Please let me know how can i catch the double click on chart series. Sample code would be helpful.
Thanks
I am developing an ios application using Teechart. I have created a bar chart. Now want 2 events :
1.) single tap/click on series : to display tooltip of x and y axes values.
2.) Double tap/click series : to drill down the chart.
I am able to find out the code for single click on series as follows:
this.chart.ClickSeries += (sender, s, valueIndex, e) =>
{ };
Please let me know how can i catch the double click on chart series. Sample code would be helpful.
Thanks
Re: Double click chart series in IOS application
Hi,
Take a look at the discussion here:
http://www.teechart.net/support/viewtop ... recognizer
Instead of using the clickBackGround event, you could use the clickSeries. Then, you could use the uirecognizer parameter to know what kind of gesture has arrived and the numberOfTouches.
Take a look at the discussion here:
http://www.teechart.net/support/viewtop ... recognizer
Instead of using the clickBackGround event, you could use the clickSeries. Then, you could use the uirecognizer parameter to know what kind of gesture has arrived and the numberOfTouches.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Double click chart series in IOS application
Hi Yeray,
I am able to find double click on my chart.
Following is my code:
recognizer.NumberOfTouches.ToString() always gives me 1.
but my requirement is to find double and single click on CHART SERIES and find out the clicked x and y axes values.
For single click we already have ClickSeries event.
I am able to find double click on my chart.
Following is my code:
Code: Select all
var tapRecognizerSingle = new UITapGestureRecognizer(this,new MonoTouch.ObjCRuntime.Selector("HandleTapFromDouble"));
tapRecognizerSingle.NumberOfTapsRequired = 2;
tapRecognizerSingle.Delegate = new GestureDelegate();
this.chart.AddGestureRecognizer(tapRecognizerSingle);
[Export("HandleTapFromDouble")]
public void HandleTapFromDouble (UITapGestureRecognizer recognizer)
{
new UIAlertView("Double", "No of touches: " + recognizer.NumberOfTouches.ToString(),null,"OK",null).Show();
}
// delegate methods for UITapGestureRecognizer
public class GestureDelegate : UIGestureRecognizerDelegate
{
public override bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch)
{
return true;
}
public override bool ShouldBegin (UIGestureRecognizer recognizer)
{
return true;
}
public override bool ShouldRecognizeSimultaneously (UIGestureRecognizer gestureRecognizer, UIGestureRecognizer otherGestureRecognizer)
{
return true ;
}
}
but my requirement is to find double and single click on CHART SERIES and find out the clicked x and y axes values.
For single click we already have ClickSeries event.
Code: Select all
this.chart.ClickSeries += (sender, s, valueIndex, e) =>
{
string Yvalue = s.YValues [valueIndex].ToString();
string Xvalue = s.XValues [valueIndex].ToString();
string Title = s.Title;
string MarkValue = s.LegendString(valueIndex, LegendTextStyles.Plain);
Re: Double click chart series in IOS application
Hello,
I've been looking at the code you are using. The first code will add the gesture to the Chart, but not just to the Series of the Chart. In the case you want to control the touch over the Chart you could use the ClickBackground event, as it's used into the post Yeray said, there you should be able to control the numberoftouches used in recognizer.
Please do not hesitate to contact us if you still having problems.
I've been looking at the code you are using. The first code will add the gesture to the Chart, but not just to the Series of the Chart. In the case you want to control the touch over the Chart you could use the ClickBackground event, as it's used into the post Yeray said, there you should be able to control the numberoftouches used in recognizer.
Please do not hesitate to contact us if you still having problems.
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Double click chart series in IOS application
Hello
Thanks for your reply.
ClickBackground event will not serve my purpose. I want to find click on series event in following two cases;
1.) Single click on chart series only (not the background of the chart.) . For this we have [this.chart.ClickSeries += (sender, s, valueIndex, e) => ]
2.) Double click on chart series only (not the background of the chart.)
Please let me know how can i capture double click on chart series. And i want clicked series x and y axes values on double click.
Thanks
Thanks for your reply.
ClickBackground event will not serve my purpose. I want to find click on series event in following two cases;
1.) Single click on chart series only (not the background of the chart.) . For this we have [this.chart.ClickSeries += (sender, s, valueIndex, e) => ]
2.) Double click on chart series only (not the background of the chart.)
Please let me know how can i capture double click on chart series. And i want clicked series x and y axes values on double click.
Thanks
Re: Double click chart series in IOS application
Hello,
Ok, I'm going to prepare an example code and send it to you asap.
Ok, I'm going to prepare an example code and send it to you asap.
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Double click chart series in IOS application
Thanks Josep
I am waiting..
I am waiting..
Re: Double click chart series in IOS application
Hello,
sorry for delay, here an example of code which allows to catch double tap into the Chart view, and also checks if tap has been done over the Series pointer, hope that it helps :
sorry for delay, here an example of code which allows to catch double tap into the Chart view, and also checks if tap has been done over the Series pointer, hope that it helps :
Code: Select all
// This method could be called insode the ViewDidLoad
WireUpTapGestureRecognizer ();
protected void WireUpTapGestureRecognizer ()
{
// create a new tap gesture
UITapGestureRecognizer tapGesture = new UITapGestureRecognizer ();
// wire up the event handler (have to use a selector)
tapGesture.AddTarget ( () => {
Console.WriteLine("Chart tapped @" + tapGesture.LocationOfTouch (0, (UIView)_controller.chartController.View).ToString ());
if (_controller.chartController.chart.Series[0].Clicked(Point.Round(tapGesture.LocationOfTouch(0, (UIView)_controller.chartController.View)))==1)
Console.WriteLine("Series double clicked");
});
// configure it
tapGesture.NumberOfTapsRequired = 2;
// add the gesture recognizer to the view
_controller.chartController.View.AddGestureRecognizer (tapGesture);
}
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: Double click chart series in IOS application
Hello Josep,
Thanks for the sample code. It was very useful.
Following is my final code to drill on double click of chart series:
Thanks for the sample code. It was very useful.
Following is my final code to drill on double click of chart series:
Code: Select all
protected void WireUpTapGestureRecognizer()
{
// create a new tap gesture
UITapGestureRecognizer tapGesture = new UITapGestureRecognizer();
// configure it
tapGesture.NumberOfTapsRequired = 2;
// wire up the event handler (have to use a selector)
tapGesture.AddTarget(() => {
Steema.TeeChart.Styles.Series s = this.chart.Series [0];
int valueIndex = s.Clicked(Point.Round(tapGesture.LocationOfTouch(0, (UIView)this.chartView)));
int iSeriesCount = this.chart.Series.Count;
int iCounter = 1;
for (iCounter=1; iCounter<=iSeriesCount; iCounter ++)
{
if (this.chart.Series.Count >= iCounter)
{
s = this.chart.Series [iCounter - 1];
valueIndex = s.Clicked(Point.Round(tapGesture.LocationOfTouch(0, (UIView)this.chartView)));
if (valueIndex >= 0)
{
DrillChartOnClick(s, valueIndex);
}
}
}
}
);
// add the gesture recognizer to the view
this.chartView.AddGestureRecognizer(tapGesture);
}
Re: Double click chart series in IOS application
Hi,
ok, I'm glad to hear that.
best regards !
ok, I'm glad to hear that.
best regards !
Pep Jorge
http://support.steema.com
http://support.steema.com