Line chart does not respond to background color

4 posts, 0 answers
  1. Peter
    Peter avatar
    10 posts
    Member since:
    Apr 2017

    Posted 09 Apr Link to this post

    Hello all,

     

    I'm trying to set the background color of my line chart (RadCartesianChart). This is the code that i'm using:

     

    ```

      var chart = new RadCartesianChart
                {
                    BackgroundColor = Color.Black,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.Fill,
                    HeightRequest = Device.RuntimePlatform == Device.Android ? 200 : 250,
                    HorizontalAxis = new CategoricalAxis
                    {               
                        LabelTextColor = AppResources.Get<Color>("TextColor"),
                        LabelFontSize = 10,
                        LabelFitMode = AxisLabelFitMode.Rotate,
                        LabelFormatter = new HorizontalAxisLabelFormatter()
                    },
                    VerticalAxis = new NumericalAxis
                    {
                        LabelTextColor = AppResources.Get<Color>("TextColor"),
                        LabelFontSize = 10,
                        LabelFormatter = new VerticalAxisLabelFormatter()
                    },
                };

    ```

     

    However, when i run this in the iOS simulator, the result is as follows (see attachment).

     

    The background color stays white. The labels do go white, but the chart itself does not.

    When i try to do this with a bar chart, it does work. On Android the chart also has a black background color.

    Does anybody know what I am missing?

     

    Thanks in advance,

    Reense

  2. Didi
    Admin
    Didi avatar
    180 posts

    Posted 09 Apr Link to this post

    Hello Peter,

    Thank you for the provided code.

    I have tested the described scenario but on my side the BackgroundColor is applied to the RadChart control as expected. I have attached my test project for reference. Please take a look at it and may I ask you to modify it accordion your setup and send it back to me? In this way I could research it further. Also note that you should open a support ticket and attach the project there because in the forum only image attachments are allowed.

    Thank you in advance.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Peter
    Peter avatar
    10 posts
    Member since:
    Apr 2017

    Posted 10 Apr in reply to Didi Link to this post

    Hey, thanks for replying!

    I tried the sample you provided. However, when I try to run this, Visual Studio says that it can't find the package Telerik.UI.for.Xamarin version 2019.1.318.1. When I manually install Telerik.UI.for.Xamarin version 2018.1.405.2 (latest stable release) I still get the same, the line chart has a white background. I attached a screenshot with my result.

    The only thing that i've done to your sample is installing the latest stable release of the package from the nuget source. No source code is altered.

     

    Is the background problem specific to this release of Telerik.UI.for.Xamarin?

     

     


  4. Didi
    Admin
    Didi avatar
    180 posts

    Posted 10 Apr Link to this post

    Hello Peter,

    Thank you for the attached file.

    I have tested the scenario with Telerik UI for Xamarin v 2018.1.405.2 but I could not reproduce the issue with the chart background color. I have attached the project and image for reference. Regarding to the Telerik UI for Xamarin versions please note that the latest stable version of the suite is 2019.1.318.1.

    Next Steps:

    Please open a support ticket and attach a modified version of the project with the exact setup you have. Once we are able to reproduce the behavior we will be able to investigate it further and provide more information on the matter.

    Thank you in advance.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top