protected void DrawHorizontalLabel(ChartValueItem entry, SKCanvas canvas, SKRect frame, SKRect chart) { if (!DisplayHorizontalValuesBySlider) { return; } // Draws the horizontal value the slider is on // if (string.IsNullOrEmpty(entry?.Label)) { return; } float x = chart.GetInsideXValue(TouchedPoint.X); if (ChartType == ChartType.Bar) { x = entry.Point.X; } // Draws background using (var boundPaint = new SKPaint { Color = SliderColor.ToSKColor(), StrokeCap = SKStrokeCap.Round, Style = SKPaintStyle.StrokeAndFill, StrokeWidth = SliderWidth }) { var bounds = boundPaint.GetBounds( entry.Label, x, frame.Bottom + HorizontalTextSize + (HorizontalTextSize / 4), padding: InternalSliderDetailPadding); if (bounds.Right > frame.Right) { bounds.Left = frame.Right - bounds.Width + SliderWidth; bounds.Right = frame.Right + SliderWidth; } else if (bounds.Left < frame.Left) { bounds.Right = frame.Left + bounds.Width - SliderWidth; bounds.Left = frame.Left - SliderWidth; } canvas.DrawRoundRect(new SKRoundRect(bounds, SliderDetailCornerRadius), boundPaint); // Draws text using (var textPaint = new SKPaint { IsAntialias = true, TextSize = HorizontalTextSize, Color = SliderDetailTextColor.ToSKColor(), Typeface = FontTypeService.GetFontFamily(GetType().Assembly), TextAlign = SKTextAlign.Center, FakeBoldText = true }) { canvas.DrawText(entry.Label, bounds.MidX, bounds.MidY + (bounds.Height / 4), textPaint); } } }