Approved
Last Updated: 14 Aug 2019 12:11 by ADMIN
ADMIN
Nikolay
Created on: 27 Apr 2017 15:54
Category: Chart
Type: Bug Report
1
Chart: [Android] CartesianChartGrid X MajorLines are not showing
After setting the MajorLinesVisibility property to GridLineVisibility.Xy only the Y lines are showing up.
1 comment
ADMIN
Didi
Posted on: 14 Aug 2019 12:11
Workaround for this issue:

You can implement your own custom renderer an configure the native control's gridlines in it. Mainly, you will need to create a class inside the Android project and then register your custom renderer using the ExportRenderer assembly level attribute. For example:

public class CustomChartRenderer : CartesianChartRenderer
{
    public CustomChartRenderer(Context context) : base(context)
    {
    }
    protected override void OnElementChanged(ElementChangedEventArgs<RadCartesianChart> e)
    {
        base.OnElementChanged(e);
  
        if(this.Control != null)
        {
            this.Control.Grid = new Com.Telerik.Widget.Chart.Visualization.CartesianChart.CartesianChartGrid();
            this.Control.Grid.MajorLinesVisibility = Com.Telerik.Widget.Chart.Visualization.CartesianChart.GridLineVisibility.Xy;
            this.Control.Grid.LineThickness = (float)this.Element.Grid.MajorLineThickness;
            this.Control.Grid.LineColor = this.Element.Grid.MajorLineColor.ToAndroid();
            this.Control.Grid.VerticalLineThickness = (float)this.Element.Grid.MajorLineThickness; ;
            this.Control.Grid.VerticalLineColor = this.Element.Grid.MajorLineColor.ToAndroid();
        }
    }
}

[assembly: ExportRenderer(typeof(RadCartesianChart), typeof(CustomChartRenderer))]

I have attached a sample how the renderer is implemented.

Regards,
Didi
Progress Telerik

Attached Files: