- Home
- Forum
- Xamarin.iOS
- Is it possible to display only one DataMarker?
Is it possible to display only one DataMarker?
Hello,

We're trying to integrate a Chart to display remaining amount depending a list of transactions:

We would like ton display the DataMarker only for a transaction that has been selected by the user.
But we're only able to display or hide all the DataMarker of the Chart, by using:
DataMarker.ShowMarker = true;
DataMarker.ShowMarker = true;
Is there a way to achieve this?
Regards,
SIGN IN To post a reply.
2 Replies
DD
Devakumar Dhanapoosanam
Syncfusion Team
April 2, 2020 05:57 PM UTC
Hi Pierre-Christophe DUS,
Greetings from Syncfusion.
Currently we are working on your requirement “display DataMarker only for a transaction that has been selected by the user” and will update you the complete details on April 3, 2020.
Regards,
Devakumar D
DD
Devakumar Dhanapoosanam
Syncfusion Team
April 5, 2020 03:06 PM UTC
Hi Pierre-Christophe DUS,
Sorry for the delay.
We would like to let you know that you can achieve your requirement by using the SFChart SFChartTrackballBehavior instead of using the ChartDataMarker. You can use the the SFChartTrackballBehavior Show method to display marker for the currently selected datapoint. Please refer the below code snippet for more details,
C#:
|
public override void ViewDidLoad()
{
…
trackballBehavior = new SFChartTrackballBehavior();
trackballBehavior.LineStyle.Visible = false;
trackballBehavior.LabelStyle.Visible = false;
trackballBehavior.ActivationMode = SFChartTrackballActivationMode.TouchMove;
trackballBehavior.MarkerStyle.Visible = true;
trackballBehavior.MarkerStyle.MarkerType = SFChartDataMarkerType.Ellipse;
trackballBehavior.MarkerStyle.BorderColor = UIColor.FromRGB(38, 66, 118);
trackballBehavior.MarkerStyle.Color = UIColor.White;
trackballBehavior.MarkerStyle.Height = 15;
trackballBehavior.MarkerStyle.Width = 15;
trackballBehavior.MarkerStyle.BorderWidth = 4;
chart.Behaviors.Add(trackballBehavior);
…
}
private void Chart_SeriesRendered(object sender, EventArgs e)
{
if(series.SelectedDataPointIndex > -1)
{
ShowTrackballMarker(series.SelectedDataPointIndex);
}
}
private void Button_TouchUpInside(object sender, EventArgs e)
{
int index = random.Next(0, 6);
series.SelectedDataPointIndex = index;
ShowTrackballMarker(series.SelectedDataPointIndex);
}
private void ShowTrackballMarker(int index)
{
var Data = series.ItemsSource as ObservableCollection<ChartDataModel>;
if (Data != null && Data.Count > 0)
{
var selectedData = Data[index];
var x = chart.PointForValue(selectedData.Date.ToOADate(), chart.PrimaryAxis);
var y = chart.PointForValue(selectedData.YValue, chart.SecondaryAxis);
CGPoint point = new CGPoint(x, y);
trackballBehavior.Show(point);
}
} |
Please download the sample from below link,
Screenshot:
Please refer the below help document for more details,
Please let us know if you need any further assistance.
Regards,
Devakumar D
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
PD Pierre-Christophe DUS
- Apr 1, 2020 10:26 AM UTC
- Apr 5, 2020 03:06 PM UTC