Duplicated
Last Updated: 25 Sep 2020 14:35 by ADMIN
Stefan
Created on: 25 Sep 2020 06:46
Category: UI for Xamarin
Type: Bug Report
0
Rad Cartesian Chart iOS Bug
On iOS devices if you have only 1 Series for Rad Cartesian Chart, series Name is cutoff(horizontally and vertically, depends where are you putting Categorical Axis)
Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
3 comments
ADMIN
Didi
Posted on: 25 Sep 2020 14:35

Hello Stefan,

Yes, the string. Empty is a workaround for the X-axis, For Y-axis I can suggest the following:

public class CustomChartRenderer : CartesianChartRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<RadCartesianChart> e)
        {
            base.OnElementChanged(e);

            if (this.Control != null)
            {
                this.Control.YAxis.Title = "     ";
            }
        }
    }

where the space between the double quotes is the characters needed to visualize the value of the axis label. 

For example, in my case the text for the axis label is Data1, so I left 5 blank space characters.  

This is the approach I can suggest. I hope it will be helpful for the scenario you have.

Regards,
Author nickname
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Stefan
Posted on: 25 Sep 2020 14:05

Hi Didi,

Thank you for update but this only resolves value on X axis.

When i use horizontal bars then its not helping.(i tried to put Yaxis.Title = string.Empty) but its not helping.

Do you have workaround for that maybe?

Attached Files:
ADMIN
Didi
Posted on: 25 Sep 2020 13:45

Hi Stefan,

Thank you for the provided images and explanation of the issue. This is a known issue and we have it logged in our feedback portal. Here is the link: https://feedback.telerik.com/xamarin/1366498-chart-ios-horizontalaxislabel-is-not-visible-when-only-one-data-is-applied-to-the-chart 

I will mark the type of this bug report "Duplicated". I can assure you that have raised the bug priority.

Workaround:

Create a custom renderer for iOS and set an empty string for its X-axis title, in this way the axis label value will be visualized. How to register chart renderer check here https://docs.telerik.com/devtools/xamarin/controls/chart/how-to/chart-how-to-register-custom-renderer

Here is how the CustomChartRenderer file looks:

 

using Telerik.XamarinForms.Chart;
using Telerik.XamarinForms.ChartRenderer.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(Telerik.XamarinForms.Chart.RadCartesianChart), typeof(CustomChartRenderer))]

namespace gauge.iOS
{
    public class CustomChartRenderer : CartesianChartRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<RadCartesianChart> e)
        {
            base.OnElementChanged(e);

            if (this.Control != null)
            {
                this.Control.XAxis.Title = string.Empty;
            }
        }
    }
}

Regards,

Didi
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).