Border around PlotArea

Border around PlotArea

Forum member · Aug 19, 2013
Hi, Is there any way to set Borders around the PlotArea of a Chart? I am trying to create a chart which has a border around its PlotArea. This border should be thicker than the GridLines. The best solution I have come up with so far is to simply set a second pair of Axis anchored to the right respectively to the top of the PlotArea. Doing this I am running into some problems: The procedure works fine for the right border, by setting a NumericYAxis with AnchorType to the Right and simply setting the Visibility of the Labels to false. However trying to do the same thing with the XAxis I am getting a Null Reference Exception, when trying to add the XAxis to the PlotArea. This is the code I am using at the moment: IndexedXAxis upbrdr = new IndexedXAxis(0); uprbrdr.LabelsLabels.Visible = false; uprbrdr.AnchorType = XAxisAnchorType.Top; plotArea.XAxes.Add(uprbrdr); What am I missing or is there an easier way of adding Borders to the PlotArea? thanks, maldi

Re: Border around PlotArea

Support · Aug 19, 2013
Hello Maldi, We did some testing on our end and we are also seeing the similar error. We will forward this information to our developers to look into it further and we will post the further updates as soon as it is fixed. As a workaround you can try setting the XAxisAnchorType to Top for the default X-Axis through which you are adding series to the chart and add a new IndexedXAxis to the chart by setting the XAxisAnchorType to Floating. Below is the sample code for it. Document doc = new Document(); Page page = new Page(); doc.Pages.Add(page); Chart chart = new Chart(0, 0, page.Dimensions.Body.Width - 20, page.Dimensions.Body.Height - 50); chart.BackgroundColor = RgbColor.LightGrey; Title firstTitle = new Title("title1"); IndexedColumnSeries columnSeries1 = new IndexedColumnSeries("Download Count"); AutoGradient autogradient1 = new AutoGradient(180f, CmykColor.Red, CmykColor.IndianRed); columnSeries1.Color = autogradient1; PlotArea plotArea = chart.PrimaryPlotArea; plotArea.Series.Add(columnSeries1); columnSeries1.Values.Add(117); columnSeries1.XAxis.Labels.Add(new IndexedXAxisLabel("1", 0)); columnSeries1.Values.Add(25); columnSeries1.XAxis.Labels.Add(new IndexedXAxisLabel("2", 1)); columnSeries1.Values.Add(10); columnSeries1.XAxis.Labels.Add(new IndexedXAxisLabel("3", 2)); columnSeries1.Values.Add(10); columnSeries1.XAxis.Labels.Add(new IndexedXAxisLabel("4", 3)); columnSeries1.Values.Add(5); columnSeries1.XAxis.Labels.Add(new IndexedXAxisLabel("5", 4)); columnSeries1.Legend.Visible = false; columnSeries1.XAxis.Labels.FontSize = 8; columnSeries1.XAxis.LabelPosition = XAxisLabelPosition.BelowPlotArea; columnSeries1.XAxis.MajorTickMarks.Visible = false; columnSeries1.YAxis.Min = 0; Title lTitle = new Title("Downloads"); columnSeries1.YAxis.Titles.Add(lTitle); columnSeries1.XAxis.AnchorType = XAxisAnchorType.Top; chart.Layout(); IndexedXAxis upbrdr = new IndexedXAxis(); upbrdr.Labels.Visible = false; upbrdr.AnchorType = XAxisAnchorType.Floating; plotArea.XAxes.Add(upbrdr); IndexedYAxis upbrdr1 = new IndexedYAxis(0); upbrdr1.Labels.Visible = false; upbrdr1.AnchorType = YAxisAnchorType.Right; plotArea.YAxes.Add(upbrdr1); page.Elements.Add(chart); doc.Draw(@"MyDocument.pdf"); Thanks, ceTe Software Support Team.

Re: Border around PlotArea

Forum member · Aug 20, 2013
Thank you for this workaround, worked fine for me. Plus it allows me to set the Gridlines on the xAxis between the indices. There is however some issue with the display of the Grid Lines on the yAxis. If you set the yAxis Interval equal to the interval of the gridlines the last gridline won't get displayed if the maximum value of the yAxis is not an integer multiple of the interval. Example code on this issue: NumericYAxis yAxis = new NumericYAxis(); yAxis.Interval = 3; yAxis.MajorGridLines = new YAxisGridLines(3); yAxis.Min = 0; yAxis.Max = 16; This is the reason why I failed on setting the upper border by a MajorGridLine and using the MinorGridLines instead for displaying the gridlines in the chart. It would be great if you could have a look into this. Thanks

Re: Border around PlotArea

Support · Aug 20, 2013
Hello Maldi, Can you please send over the following details to our [^a|mailto:support@cete.com|opennewwindow|support ^] team so that they can look into it further? 1.Complete sample code using which we can recreate the behavior. 2.Output PDF document. 3.More details about your requirements with reference to the output PDF. Thanks, ceTe Software Support Team.

Re: Border around PlotArea

Support · Oct 30, 2014
Hello, The latest build available on the website contains the fix for this issue. It can be downloaded from the customer area by logging in with the product serial number. If you are evaluating the product the latest build can be downloaded here . Thanks, ceTe Software Support Team.