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

How to increase distance between values in x axis

2 Answers 472 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
FMorales
Top achievements
Rank 1
FMorales asked on 25 Nov 2014, 03:29 PM
Hi, 

I have created a simple bar chart but I would like to increase the distance between the values on x-axis and get the bars a little bit more longer.

There is a simple ways to do it?

here I attach my simple chart.

Thanks a lot

2 Answers, 1 is accepted

Sort by
0
FMorales
Top achievements
Rank 1
answered on 26 Nov 2014, 11:09 AM
Hi again, 

simply I would like to add more space between labels.

Could I make bigger the space between labels??

Thanks
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Nov 2014, 02:58 PM
Hello Farncisco,

Thank you for writing.

You can control at what distance the labels will be rendered on the LinearAxis, by setting the MajorStep property:
public Form1()
{
    InitializeComponent();
 
    BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
    barSeries.Name = "Q1";
    barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(128, "White"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(111, "Jones"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(118, "Marshall"));
    this.radChartView1.Series.Add(barSeries);
 
    BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName");
    barSeries2.Name = "Q2";
    barSeries2.DataPoints.Add(new CategoricalDataPoint(153, "Harley"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(130, "Smith"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(88, "Jones"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(109, "Marshall"));
    this.radChartView1.Series.Add(barSeries2);
 
    CartesianGrid grid = this.radChartView1.GetArea<CartesianArea>().GetGrid<CartesianGrid>();
    this.radChartView1.GetArea<CartesianArea>().Orientation = Orientation.Horizontal;
    grid.DrawVerticalStripes = true;
    grid.DrawHorizontalStripes = false;
     
    LinearAxis verticalAxis = barSeries.HorizontalAxis as LinearAxis;
    if (verticalAxis != null)
    {
        verticalAxis.MajorStep = 10;
        verticalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
    }
}


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

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ChartView
Asked by
FMorales
Top achievements
Rank 1
Answers by
FMorales
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or