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

Second YAxis do not work

1 Answer 58 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 06 Jun 2012, 12:28 PM
I have a chart with two YAxis. Before, both work. But now, second YAxis do not work and I don't know cause. Below my code.

private

 

 

RadChart criaGrafico(TransacoesNegadasPorBinBL bl)

{

 

RadChart radChart1 = new RadChart();

radChart1.Height = 450;

radChart1.Width = 1080;

radChart1.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.

 

AlignedPositions.Center;

radChart1.ChartTitle.TextBlock.Text = bl.tituloGrafico;

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(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.AutoSize =

 

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(8);

radChart1.PlotArea.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.

 

Unit.Percentage(7);

radChart1.PlotArea.Appearance.Dimensions.Height = 300;

radChart1.PlotArea.Appearance.Dimensions.Width = 1000;

 

// 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 chartSeries1 = radChart1.CreateSeries("Quant. Transações ", System.Drawing.Color.Blue, System.Drawing.Color.Blue, ChartSeriesType.Bar);

 

ChartSeries chartSeries2 = radChart1.CreateSeries("Percentual Negadas ", System.Drawing.Color.Red, System.Drawing.Color.Red, ChartSeriesType.Line);

chartSeries1.Type =

 

ChartSeriesType.Bar;

chartSeries2.Type =

 

ChartSeriesType.Line;

chartSeries2.Appearance.LabelAppearance.Visible =

 

false;

chartSeries1.DefaultLabelValue =

 

"#Y{F0}%";

 

//chartSeries2.Appearance.LabelAppearance.LabelConnectorStyle.

radChart1.Legend.Appearance.Overflow = Telerik.Charting.Styles.

 

Overflow.Row;

radChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.

 

AlignedPositions.Bottom;

radChart1.PlotArea.YAxis2.Visible = Telerik.Charting.Styles.

ChartAxisVisibility.True;

radChart1.PlotArea.YAxis2.AutoScale =

false;

//radChart1.PlotArea.YAxis2.AddRange(0, 0.8, 0.1);

chartSeries2.PlotArea.YAxis.YAxisType.ToString();

radChart1.PlotArea.YAxis2.AddRange(0, 1200, 100);

 

//A orientação do gráfico

radChart1.SeriesOrientation =

 

ChartSeriesOrientation.Vertical;

chartSeries1.PlotArea.XAxis.AddRange(0, bl.listaValor.Count, 1);

 

for (int i = 0; i < bl.listaValor.Count; i++)

{

chartSeries1.PlotArea.XAxis[i].TextBlock.Text = bl.listaValor[i];

}

chartSeries1.SetValues(bl.listaQuantTransacoes.ToArray());

chartSeries2.SetValues(bl.listaQuantTransacoes.ToArray());

 

return radChart1;

}


1 Answer, 1 is accepted

Sort by
0
Paulo
Top achievements
Rank 1
answered on 06 Jun 2012, 01:07 PM
I discovered the error. It was  this line:

radChart1.PlotArea.Appearance.Dimensions.Width = 1000;

I changed from 1000 to 940 and worked.  It was pushing the limits of the chart.

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