3 Answers, 1 is accepted
This can be achieved with our Intelligent Labels feature.
All the best,Evgenia
the Telerik team
RadChart criaGrafico(ComparativoEmissoresBL bl)
{
RadChart radChart1 = new RadChart();
radChart1.Height = 400;
radChart1.Width = 1024;
radChart1.ChartTitle.TextBlock.Text = bl.nomeTituloChart;
radChart1.ChartTitle.TextBlock.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Center;
radChart1.ChartTitle.Appearance.Dimensions.AutoSize =
false;
radChart1.ChartTitle.Appearance.Dimensions.Height = 50;
radChart1.ChartTitle.Appearance.Dimensions.Width = 750;
radChart1.ChartTitle.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.
Unit.Percentage(5);
radChart1.ChartTitle.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.
Unit.Percentage(5);
radChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Bottom;
radChart1.Legend.Appearance.Overflow = Telerik.Charting.Styles.
Overflow.Row;
radChart1.Legend.Appearance.Dimensions.AutoSize =
false;
radChart1.Legend.Appearance.Dimensions.Height = 25;
radChart1.Legend.Appearance.Dimensions.Width = 400;
radChart1.Legend.Appearance.Border.Color = System.Drawing.
Color.Transparent;
radChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Bottom;
radChart1.Legend.TextBlock.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Center;
radChart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.
FillType.Solid;
radChart1.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.
Color.Transparent;
radChart1.PlotArea.Appearance.Border.Visible =
false;
radChart1.PlotArea.Appearance.Dimensions.Margins.Top = Telerik.Charting.Styles.
Unit.Percentage(20);
radChart1.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.
Unit.Percentage(30);
radChart1.PlotArea.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.
Unit.Percentage(5);
radChart1.PlotArea.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.
Unit.Percentage(5);
radChart1.PlotArea.Appearance.Dimensions.Width = 800;
// Telerik.Charting.Styles.Unit.Pixel(400);
radChart1.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.
ChartAxisLayoutMode.Inside;
radChart1.PlotArea.XAxis.AutoScale =
false;
radChart1.PlotArea.XAxis.IsZeroBased =
false;
radChart1.PlotArea.XAxis.Appearance.MajorGridLines.Visible =
false;
radChart1.PlotArea.XAxis.Appearance.TextAppearance.AutoTextWrap = Telerik.Charting.Styles.
AutoTextWrap.True;
radChart1.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Top;
radChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font =
new System.Drawing.Font("Arial", 8);
radChart1.Legend.Appearance.ItemMarkerAppearance.Dimensions.Width = 25;
radChart1.Legend.Appearance.ItemMarkerAppearance.Figure = Telerik.Charting.Styles.
DefaultFigures.Rectangle;
//ChartSeries chartSeries = new ChartSeries();
//Instacia as series que serão mostradas nos gráficos
ChartSeries chartSeries1 = radChart1.CreateSeries((DateTime.Now.Year - 3).ToString(), System.Drawing.Color.Blue, System.Drawing.Color.Blue, ChartSeriesType.Bar);
ChartSeries chartSeries2 = radChart1.CreateSeries((DateTime.Now.Year - 2).ToString(), System.Drawing.Color.Green, System.Drawing.Color.Green, ChartSeriesType.Bar);
ChartSeries chartSeries3 = radChart1.CreateSeries((DateTime.Now.Year - 1).ToString(), System.Drawing.Color.BlueViolet, System.Drawing.Color.BlueViolet, ChartSeriesType.Bar);
ChartSeries chartSeries4 = radChart1.CreateSeries("Variação " + (DateTime.Now.Year - 2).ToString() + "-" + (DateTime.Now.Year - 1).ToString(), System.Drawing.Color.Red, System.Drawing.Color.Red, ChartSeriesType.Line);
chartSeries1.Type =
ChartSeriesType.Bar;
chartSeries2.Type =
ChartSeriesType.Bar;
chartSeries3.Type =
ChartSeriesType.Bar;
chartSeries4.Type =
ChartSeriesType.Line;
//A orientação do gráfico
radChart1.SeriesOrientation =
ChartSeriesOrientation.Vertical;
radChart1.Legend.Appearance.Overflow = Telerik.Charting.Styles.
Overflow.Row;
radChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.
AlignedPositions.Bottom;
radChart1.PlotArea.XAxis.AddRange(1, bl.stringArrayEmissores.Length, 1);
for (int i = 0; i < bl.stringArrayEmissores.Length; i++)
{
radChart1.PlotArea.XAxis[i].TextBlock.Text = bl.stringArrayEmissores[i];
}
chartSeries1.SetValues(bl.doubleArray2008);
chartSeries2.SetValues(bl.doubleArray2009);
chartSeries3.SetValues(bl.doubleArray2010);
chartSeries4.SetValues(bl.doubleArrayVariacao);
return radChart1;
}
radChart1.IntelligentLabelsEnabled = true;
Thanks for all.