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

Legend do not appear

1 Answer 35 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 23 May 2012, 02:00 PM
This is my code. I have 3 series, but the third serie the legend does not appear. The graph does not appear, but is posible does not have a value. Why does not legend appear? Below my code.

private RadChart criaChart1(DesempenhoMensalBL bl)
        {
            RadChart radChart1 = new RadChart();

            radChart1.Height = 200;
            radChart1.Width = 1000;
            radChart1.ChartTitle.TextBlock.Text = "Evolução Mensal Aprovadas Débito";
            radChart1.ChartTitle.TextBlock.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Center;
            radChart1.ChartTitle.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font("Arial", 15, System.Drawing.FontStyle.Bold);
            radChart1.ChartTitle.Appearance.Dimensions.AutoSize = false;
            radChart1.ChartTitle.Appearance.Dimensions.Height = 25;
            radChart1.ChartTitle.Appearance.Dimensions.Width = 750;
            radChart1.ChartTitle.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.Unit.Percentage(20);
            radChart1.ChartTitle.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.Unit.Percentage(8);

            //Muda a cor de fundo do gráfico para transparente
            radChart1.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
            radChart1.Appearance.FillStyle.MainColor = System.Drawing.Color.Transparent;
            radChart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
            radChart1.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.Transparent;

            radChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Bottom;
            radChart1.Legend.Appearance.Overflow = Telerik.Charting.Styles.Overflow.Row;

           
            radChart1.SeriesOrientation = ChartSeriesOrientation.Vertical;

            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;

            radChart1.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Inside;
            radChart1.PlotArea.XAxis.AutoScale = false;
            radChart1.PlotArea.XAxis.IsZeroBased = false;
            radChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.LongDate;
            radChart1.PlotArea.XAxis.Appearance.CustomFormat = "MMM/yy";
            radChart1.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false;
            //radChart.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = (float)45;
            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", 10);

            radChart1.PlotArea.XAxis.AddRange(bl.datetimeDataInicial.ToOADate(), bl.datetimeDataFinal.ToOADate(), bl.dayStep);
            radChart1.Legend.Appearance.ItemMarkerAppearance.Dimensions.Width = 25;

            radChart1.Legend.Appearance.ItemMarkerAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Rectangle;

            radChart1.Legend.Appearance.ItemMarkerAppearance.Dimensions.Width = 25;
            radChart1.Legend.Appearance.ItemMarkerAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Rectangle;

            radChart1.PlotArea.YAxis.Appearance.CustomFormat = "0\\%";
            radChart1.PlotArea.YAxis.AutoScale = false;
            radChart1.PlotArea.YAxis.AddRange(0, 6000, 1200);
            radChart1.AutoLayout = true;

            ChartSeries chartSeries1 = radChart1.CreateSeries("Débito-Master", System.Drawing.Color.Red, System.Drawing.Color.Red, ChartSeriesType.Bar);
            ChartSeries chartSeries3 = radChart1.CreateSeries("Débito-Visa", System.Drawing.Color.Silver, System.Drawing.Color.Silver, ChartSeriesType.Bar);
            ChartSeries chartSeries5 = radChart1.CreateSeries("Meta de Aprovação 90%", System.Drawing.Color.Black, System.Drawing.Color.Black, ChartSeriesType.Line);

            chartSeries1.Type = ChartSeriesType.Bar;
            chartSeries3.Type = ChartSeriesType.Bar;
            chartSeries5.Type = ChartSeriesType.Line;

            chartSeries1.SetValues(bl.listaDebitoMaster.ToArray());
            chartSeries3.SetValues(bl.listaDebitoVisa.ToArray());
            chartSeries5.SetValues(bl.metaAprovacao);

            for (int i = 0; i < 3; i++)
            {
                radChart1.Series[i].Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                radChart1.Series[i].Appearance.LabelAppearance.RotationAngle = (float)270;
            }

            return radChart1;
        }


1 Answer, 1 is accepted

Sort by
0
Paulo
Top achievements
Rank 1
answered on 24 May 2012, 01:44 PM
I solved. This is problem:
 radChart1.Legend.Appearance.Dimensions.Width = 400;
I made
 radChart1.Legend.Appearance.Dimensions.Width = 600;
So, worked.

Thread resolved.
Tags
Chart (Obsolete)
Asked by
Paulo
Top achievements
Rank 1
Answers by
Paulo
Top achievements
Rank 1
Share this question
or