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
XamCategoryChart not showing X axis labels
posted

Hi,

My chart doesn't show X-axis labels. My data is a list of objects. This is the object:

        public class DealDataChart
        {
            public double      DealBuyAmount { get; set; }
            public DateTime DealDate { get; set; }
        }

Do I need more data?

I just want the DealBuyAmount (Y-axis) to be plotted against DealDate (X-axis).

Xaml:
        <ig:XamCategoryChart x:Name="mychart1"
                             ChartType="SplineArea"
                             ItemsSource="{Binding Path=DataItems}"
                             Title="Deals"
                             Subtitle="(Amount and Date)"
                             
                             XAxisLabelFontSize="16"
                             XAxisLabelTextColor="Red"
                             XAxisLabelFontAttributes="Bold"
                             XAxisLabel="{}{Date:dd/MM/yyyy}" >
        </ig:XamCategoryChart>

I did try setting XAxisLabelVisibility to Visible but it didnt do anything.

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Edgaras,

    I have been investigating into the sample code that you have provided, and the reason you are not currently seeing labels in the Xamarin XamCategoryChart is because currently, the XamCategoryChart is configured to use the first string property found on the data item by default as its labels. You do not currently have a string property on your data item, and so no label is shown. This information can be found in the first paragraph of this documentation article.

    If you do not wish to define a string property on your data item, you can use the XAxisFormatLabel event of the chart instead. The event arguments of this event will return you the data item that the label is being drawn for as well as a Label property so that you can define what you would like to show as a Label.

    Please let me know if you have any other questions or concerns on this matter.

Children
No Data