protected override View GetView(TooltipView tooltipView)
{
LinearLayout rootLayout = new LinearLayout(Chart.Context);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,
LinearLayout.LayoutParams.MatchParent);
rootLayout.Orientation = Orientation.Vertical;
rootLayout.LayoutParameters = layoutParams;
TextView xLabel = new TextView(Chart.Context);
string date = (tooltipView.ChartDataPoint as DataModel).XValue.ToString();
var doubleToDate = DateTime.FromOADate(Convert.ToDouble(date));
var formattedDate = doubleToDate.ToString("dd/MM/yy hh:mm");
xLabel.Text = "Date:" + formattedDate.ToString();
xLabel.TextSize = 15;
xLabel.SetTextColor(Color.White);
TextView yLabel = new TextView(Chart.Context);
yLabel.Text = "YValue: " + (tooltipView.ChartDataPoint as DataModel).YValue.ToString();
yLabel.TextSize = 15;
yLabel.SetTextColor(Color.White);
rootLayout.AddView(xLabel);
rootLayout.AddView(yLabel);
tooltipView.AddView(rootLayout);
return tooltipView;
} |