This is a migrated thread and some comments may be shown as answers.

DateTimeCategoricalAxis

5 Answers 96 Views
Chart - Xamarin.Android
This is a migrated thread and some comments may be shown as answers.
Itamar
Top achievements
Rank 1
Itamar asked on 06 Mar 2017, 11:13 AM

Hello

We working with the chart in xamarin android 
The horizontal axis is  DateTimeCategoricalAxis
DateTimeComponent = DateTimeComponent.TimeInMillis
LabelFormat = "HH:mm"
LabelFitMode = AxisLabelFitMode.None,


ShowLine=false,
I have some questions:
1.How to hide the ticks
2.When the LabelLayoutMode = AxisLabelLayoutMode.Inner in the vertical axis
There is gap from the left (look in the attached file)
3.I can’t change the label format in the horizontal axis it not working 
4.When the grid adds to the view it fills parent width after I add the series the width is 
Change the there is gap from the right (look in the attached file)

the desired result from the horizontal axis label format is in the attached file 

i cant do this my data is to big and i have 5 deferent series 

public class Converter : Java.Lang.Object, IFunction
    {
        public Java.Lang.Object Apply(Java.Lang.Object p0)
        {
            MajorTickModel tick = (MajorTickModel)p0;

            // Use the collection index to get the correct date from your data.
            // Then you can return the correct string based on that date.
            return tick.CollectionIndex().ToString();
        }
    }

Best Regards


5 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 09 Mar 2017, 11:40 AM
Hello Itamar,

Thank you for contacting us.

1. The axes have a property that controls the color of the ticks. You can use it to set a transparent color so that the ticks will not be visible:

chart.HorizontalAxis.TickColor = Android.Graphics.Color.Transparent;

2. The gap happens so that the labels of the horizontal axis are fully visible. You can change the current plot mode to between ticks and the gap will be minimized:

horizontalAxis.PlotMode = AxisPlotMode.BetweenTicks;

3. I'm not able to reproduce the issue with the LabelFormat. When I set a format as you have ("HH:mm"), it is correctly applied. However, in the end of the post you have included a converter, so I'd like to point out that if you use the converter the value that you return will be used as label instead of the LabelFormat. From the screenshot it seems like you have a more customized approach to the labels which the LabelFormat will not provide. In order to have different labels for the different points, you need to provide a custom label renderer for the axis. Here's a link to our documentation that shows how you can create a custom renderer, the example is for series labels, but the axis labels are quite similar.

4. As in the second question, the spacing is necessary to accommodate the labels from the horizontal axis, which can be changed with the PlotMode property.

I hope this answers your questions. Let us know if we can assist you further.

Regards,
Todor
Telerik by Progress
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
0
Itamar
Top achievements
Rank 1
answered on 13 Mar 2017, 10:00 AM

Thanks for the answer 
I attached picture of the chart the gap in the right is very big 
The chart not fill all is parent width 
Best Regards
0
Nikolay
Telerik team
answered on 14 Mar 2017, 09:35 AM
Hello Itamar,

Thank you for getting back to us.

By default the RadChartView should fill the parent width. It looks like the gap is caused by unnecessary padding on the parent element. If that is the problem simply remove the padding or adjust it however you like. Otherwise, please send us code we can use to reproduce the issue.

I hope this information helps.If you need assistance with anything else please let us know.

Regards,
Nikolay
Telerik by Progress
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
0
Itamar
Top achievements
Rank 1
answered on 14 Mar 2017, 10:31 AM

Thanks for your answer 

When the chart doesn’t have series, it fills all the parent width (I Attached picture)
 After we add the series it has gap from the right 
The chart in LinearLayout  match_parent
There is not padding margin 


Best Regards

0
Itamar
Top achievements
Rank 1
answered on 14 Mar 2017, 12:13 PM

 Thanks 

We set horizontalAxis.LastLabelVisibility = AxisLastLabelVisibility.Hidden;
This solve the gap

Best Regards

Tags
Chart - Xamarin.Android
Asked by
Itamar
Top achievements
Rank 1
Answers by
Todor
Telerik team
Itamar
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or