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

To remove chart border or plotarea border

3 Answers 218 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nirav
Top achievements
Rank 1
Nirav asked on 22 Oct 2013, 11:08 AM
Hello Guys,

I am programmatically generating the chart using the below code and while doing so i am getting unexpected border on Right and Bottom side of the chart [refer the attachment] so can you please give us an idea about how to remove those border?

i have already searched a lot about it and tried following options,

Chart.Appearance.Border.Visible = false;
Chart.Appearance.Border.Color = Color.Transparent; // or Color.White
 
Chart.PlotArea.Appearance.Border.Visible = false;
Chart.PlotArea.Appearance.Border.Color = Color.Transparent; // or Color.White

even tried to set the Border thickness to zero but still getting the border so please let us help to remove the border at the earliest.

Refer actual code below if needed,

Telerik.Reporting.Chart defChart = new Telerik.Reporting.Chart();
                        defChart.BitmapResolution = 96F;
                        defChart.ChartTitle.TextBlock.Text = departmentName;
                        defChart.ChartTitle.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(new FontFamily("Segoe UI"), 10.0f, FontStyle.Regular);
                        defChart.ChartTitle.Appearance.Position.Auto = false;
                        defChart.ChartTitle.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.TopLeft;
                        defChart.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
                        defChart.Name = "chtContactsPerDay" + departmentCount;
                        defChart.PlotArea.EmptySeriesMessage.Appearance.Visible = true;
                        defChart.PlotArea.EmptySeriesMessage.Visible = true;
                        defChart.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(19.05000114440918D), Telerik.Reporting.Drawing.Unit.Cm(5.3340005874633789D));
                        defChart.Location = new Telerik.Reporting.Drawing.PointU(locationX, locationY);
                        defChart.AutoLayout = true;
 
                        defChart.Appearance.Border.Visible = false;
                defChart.Appearance.Shadow.Color = System.Drawing.Color.Transparent;
                defChart.Appearance.Shadow.Position = Telerik.Reporting.Charting.Styles.ShadowPosition.Behind;
                defChart.ChartTitle.Appearance.Shadow.Color = System.Drawing.Color.Transparent;
                defChart.ChartTitle.Appearance.Shadow.Position = Telerik.Reporting.Charting.Styles.ShadowPosition.Behind;
                defChart.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
                defChart.Legend.Appearance.Shadow.Color = System.Drawing.Color.Transparent;
                defChart.Legend.Appearance.Shadow.Position = Telerik.Reporting.Charting.Styles.ShadowPosition.Behind;
                defChart.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
                defChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.Transparent;
                defChart.PlotArea.Appearance.Shadow.Color = System.Drawing.Color.Transparent;
                defChart.PlotArea.Appearance.Shadow.Position = Telerik.Reporting.Charting.Styles.ShadowPosition.Behind;
                defChart.PlotArea.EmptySeriesMessage.Appearance.Visible = true;
                defChart.PlotArea.EmptySeriesMessage.Visible = true;
                defChart.IntelligentLabelsEnabled = false;
                defChart.Appearance.ImageQuality = Telerik.Reporting.Charting.Styles.ImageQuality.HighQuality | Telerik.Reporting.Charting.Styles.ImageQuality.AntiAlias;
                defChart.Appearance.TextQuality = Telerik.Reporting.Charting.Styles.TextQuality.ClearTypeGridFit;
                defChart.BitmapResolution = 600;
                defChart.PlotArea.Appearance.Border.Visible = false;
                defChart.PlotArea.EmptySeriesMessage.TextBlock.Text = ReportResources.NoDataFoundMessage;
                defChart.PlotArea.EmptySeriesMessage.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(new FontFamily("Segoe UI"), 10.0f, FontStyle.Regular);
 
                        defChart.ChartTitle.Visible = true;
 
                        Telerik.Reporting.Charting.Styles.ChartMargins chartMargins1 = new Telerik.Reporting.Charting.Styles.ChartMargins();
                        chartMargins1.Bottom = new Telerik.Reporting.Charting.Styles.Unit(12D, Telerik.Reporting.Charting.Styles.UnitType.Percentage);
                        chartMargins1.Left = new Telerik.Reporting.Charting.Styles.Unit(12D, Telerik.Reporting.Charting.Styles.UnitType.Percentage);
                        chartMargins1.Right = new Telerik.Reporting.Charting.Styles.Unit(10D, Telerik.Reporting.Charting.Styles.UnitType.Percentage);
                        chartMargins1.Top = new Telerik.Reporting.Charting.Styles.Unit(10D, Telerik.Reporting.Charting.Styles.UnitType.Percentage);
 
                        defChart.PlotArea.Appearance.Dimensions.Margins = chartMargins1;
                        defChart.PlotArea.YAxis.AxisLabel.Appearance.RotationAngle = 180F;
                        defChart.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 270F;
                        defChart.SeriesOrientation = ChartSeriesOrientation.Vertical;
 
                        ChartSeries serie = new ChartSeries();
                        serie.Type = ChartSeriesType.Bar;
                        serie.Clear();
                        serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.Nothing;
                        serie.Appearance.ShowLabels = true;
                        serie.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
                        serie.Appearance.LabelAppearance.LabelLocation = Telerik.Reporting.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
 
                        foreach (string key in countWeekday.Keys)
                        {
                            ChartSeriesItem item = new ChartSeriesItem();
                            item.YValue = (double)countWeekday[key];
                            item.Name = key;
                            item.Label.TextBlock.Text = string.Format("{0} ({1})", item.Name, item.YValue);
                            item.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
                            item.Label.Appearance.RotationAngle = 270;
                            serie.Items.Add(item);
                        }
                        defChart.Series.Add(serie);
                        pnlContactsPerDay_Chart.Items.Add(defChart);



Thanks,
Nirav


3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 25 Oct 2013, 12:21 PM
Hello Nirav,

 You'll need to hide the PlotArea border by turning off its visibility:

RadChart1.PlotArea.Appearance.Border.Visible = false;

Regards,

Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Nirav
Top achievements
Rank 1
answered on 29 Oct 2013, 09:39 AM
Hello Evgenia,

Thanks for the answer but i have already tried disabling the border of plot area but it still shows the border and i have also mentioned the codes [first code snippet] which is already tried.

so can you please tell me what could be other scenario causing this problem?

Regards,
Nirav
0
Evgenia
Telerik team
answered on 31 Oct 2013, 02:32 PM
Hello Nirav,

On a second glance it looks to me that these unwanted borders are actually the Axes of the Chart. Could you try and tweak the PlotArea -> XAxis / YAxis -> Appearance properties so that you either reduce their thickness or modify their Color?

Regards,
Evgenia
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
General Discussions
Asked by
Nirav
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Nirav
Top achievements
Rank 1
Share this question
or