This is a migrated thread and some comments may be shown as answers.
cut label
3 Answers 22 Views
This is a migrated thread and some comments may be shown as answers.
Guido
Top achievements
Rank 1
Guido asked on 21 Apr 2016, 04:33 PM

hi,

how can I solve the problem of the date labels cut on the x axis.

see attached image

tanks in advance. Guido.

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Apr 2016, 10:17 AM
Hello Guido,

Thank you for writing.

You should set the ClipLabels property to false for the horizontal axis:
public Form1()
{
    InitializeComponent();
 
    LineSeries series = new LineSeries();
    series.DataPoints.Add(new CategoricalDataPoint(6, DateTime.Now));
    series.DataPoints.Add(new CategoricalDataPoint(4, DateTime.Now.AddDays(1)));
    series.DataPoints.Add(new CategoricalDataPoint(7, DateTime.Now.AddDays(2)));
    series.DataPoints.Add(new CategoricalDataPoint(5, DateTime.Now.AddDays(3)));
    DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
    categoricalAxis.DateTimeComponent = DateTimeComponent.Day;
    categoricalAxis.ClipLabels = false;
    series.HorizontalAxis = categoricalAxis;
    radChartView1.Series.Add(series);
}

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Guido
Top achievements
Rank 1
answered on 25 Apr 2016, 05:12 PM

Hi Dess.

Tanks for the reply.

The example works, but how can I do if I use DataSource?

In this case, assigne categoricalAxis to the series produces two axes x:

Dim categoricalAxis As New DateTimeCategoricalAxis()
            categoricalAxis.ClipLabels = False

            With RadChartView1
                .Series.Clear()
                .ShowLegend = True
                .LegendTitle = "Legenda"
                .Controllers.Add(New SmartLabelsController())
                .ShowGrid = True
            End With

            With Spese
                .ValueMember = "SpeseAl"
                .CategoryMember = "Aggiornamento"
                .LegendTitle = "Spese"
                .DataSource = dt
                .ShowLabels = True
                .Palette = New PaletteEntry(Color.Gainsboro, Color.Green)
                .HorizontalAxis = categoricalAxis
            End With
            RadChartView1.Series.Add(Spese)

 

see attached image.

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Apr 2016, 10:53 AM
Hello Guido,

Thank you for writing back. 

Please refer to the following code snippet demonstrating how to access the horizontal axis when binding RadChartView and disable labels clipping:
Private table As DataTable
Sub New()
    InitializeComponent()
    table = New DataTable()
    table.Columns.Add("Value", GetType(Double))
    table.Columns.Add("Name", GetType(String))
    Dim rand As New Random
    For index = 1 To 10
        table.Rows.Add(rand.Next(0, 50), DateTime.Now.AddDays(index))
    Next
    Dim lineSeria As New LineSeries()
    RadChartView1.Series.Add(lineSeria)
    lineSeria.ValueMember = "Value"
    lineSeria.CategoryMember = "Name"
    lineSeria.DataSource = table
    lineSeria.HorizontalAxis.ClipLabels = False
End Sub

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Asked by
Guido
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Guido
Top achievements
Rank 1
Share this question
or