Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
[Xamarin][XamDoughnutChart] - Label new line and font size
posted

Hi,

I am using the XamDoughnutChart (Charts) component in xamarin and I want the label in this format:
Name
Value



Is it possible?
I want to change de fonte size of the label too.

Best regards,
Tiago

Parents
  • 29105
    Verified Answer
    Offline posted

    Hello Tiago, 

    Thank you for contacting Infragistics. The RingSeries allows for the label colors to be changed based LabelInnerColor and LabelOuterColor. However if you want to make further customizations, like changing the text, it will be limited by the FormatLabel event. This event exposes the Label and the Item. I tried this out but you cannot style the font or font size out of the box through the event args.

    eg.

    public partial class MainPage : ContentPage
        {
            public MainPage()
            {
                InitializeComponent();
            }
    
            private void ringSeries_FormatLabel(object sender, Infragistics.XamarinForms.Controls.Charts.PieChartFormatLabelEventArgs args)
            {
                var item = args.Item;
                if (item.Item.GetType() == typeof(FinancialDataPoint))
                {
                    var finItem = (FinancialDataPoint)item.Item;
                    if (finItem != null)
                        args.Label = finItem.Spending.ToString();
                }
               
            }
        }
    
        public class FinancialDataCollection : ObservableCollection<FinancialDataPoint>
        {
            public FinancialDataCollection()
            {
                this.Add(new FinancialDataPoint { Spending = 20, Budget = 60, Label = "Administration" });
                this.Add(new FinancialDataPoint { Spending = 80, Budget = 40, Label = "Sales" });
                this.Add(new FinancialDataPoint { Spending = 30, Budget = 60, Label = "IT" });
                this.Add(new FinancialDataPoint { Spending = 80, Budget = 40, Label = "Marketing" });
                this.Add(new FinancialDataPoint { Spending = 40, Budget = 60, Label = "Development" });
                this.Add(new FinancialDataPoint { Spending = 60, Budget = 20, Label = "CustomerSupport" });
            }
    
        }
        public class FinancialDataPoint
        {
            public string Label { get; set; }
            public double Spending { get; set; }
            public double Budget { get; set; }
        }

    I suggest submitting a new product idea. 

    You can suggest new product ideas for future versions (or vote for existing ones) at <https://ko.infragistics.com/community/ideas>.
    Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
    Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it.

Reply Children
No Data