Completed
Last Updated: 07 Aug 2024 15:11 by ADMIN
Release 2024.3.806 (2024 Q3)
Mark
Created on: 05 Jun 2024 09:43
Category: UI for WinForms
Type: Bug Report
0
RadChartView: CartesianGridLineAnnotation not position correctly

The annotation line is supposed to be at 05 point but instead it is between 05 and 06.

1 comment
ADMIN
Nadya | Tech Support Engineer
Posted on: 05 Jun 2024 10:00

Hello, Mark,

Thank you for reporting this. You can use the following workaround:

PublicClass CustomCartesianGridLineAnnotationDrawPart
Inherits
CartesianGridLineAnnotationDrawPart PublicSubNew(element As CartesianGridLineAnnotation, renderer As CartesianRenderer) MyBase.New(element, renderer) EndSub

PublicOverridesSub Draw()

Dim fi As FieldInfo = GetType(CartesianGridLineAnnotation).GetField("model", BindingFlags.Instance Or BindingFlags.NonPublic) Dim model As ChartAnnotationModel = TryCast(fi.GetValue(Me.Element), ChartAnnotationModel) Dim rect As RectangleF = ChartRenderer.ToRectangleF(model.LayoutSlot) rect.Offset(Me.ViewportOffsetX, Me.ViewportOffsetY) rect.Offset(New PointF(-15, 0)) Dim graphics As Graphics = TryCast(Me.Renderer.Surface, Graphics) Dim radGraphics As RadGdiGraphics = New RadGdiGraphics(graphics) Dim path As GraphicsPath = New GraphicsPath() path.AddLine(rect.Location, New PointF(rect.Right, rect.Bottom)) Dim border As BorderPrimitiveImpl = New BorderPrimitiveImpl(Me.Element, Nothing) border.PaintBorder(radGraphics, Nothing, path, rect) rect.Size = graphics.MeasureString(Me.Element.Label, Me.Element.Font) rect.Offset(Me.Element.PositonOffset.Width + 1, Me.Element.PositonOffset.Height + 1) Dim tp As TextParams = New TextParams() tp.font = Me.Element.Font tp.foreColor = Me.Element.ForeColor tp.paintingRectangle = rect tp.text = Me.Element.Label Dim fill As FillPrimitiveImpl = New FillPrimitiveImpl(Me.Element, Nothing) fill.PaintFill(radGraphics, Nothing, rect) radGraphics.DrawString(tp, New SizeF(rect.Height, rect.Width)) EndSubEndClass

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.