When trying to print the chart out using the ultrachart's PrintDocument property, custom annotations appear in the wrong location and modifications made during the FillSceneGraph and ChartDrawItem events do not appear as part of the print document. Is there any way to solve this problem?
You are correct, I am not using the latest version. If this is an issue that has been fixed, that is great.
As for the annotations, I am using row/column location to position them on the chart. It looks like what is happening to them has less to do with the chart being resized, and more to do with the fact that the annotations dont seem to factor in the margins on the page moving the chart's start point. I believe this is the case because in the tests I have done, the chart is always narrower on the print preview than it was in my control, and yet all of the annotations appear to the left of where they should. The annotations themselves appear to be correctly spaced, but their location is entirely not where it should be. This may be a bug you might want to look into.
I know that its possible to render the image to a print document, in fact I have done that just to prove that it works, but I much prefer the appearance of the print document from the chart object, minus the problems I am getting. I will look into the pdf option.
Thank you for the reply. If you have any more feedback on the annotation issue it would be much appreciated.
how are you positioning the annotations? are their X and Y coordinates specified by percent values, data values, or pixel values?
oops, i missed that detail from your last post. if you could send a sample project, steps to reproduce, or just screenshots, that would help me address the problem - providing a workaround or fixing it for a future hotfix release.
I am having the same issue. I have several BoxAnnotations on my ScatterChart that were position by Pixel, but when they print, the positions are way off. I tried a test and placed several BoxAnnotations by percentage and still these did not position correctly when printed.
How else can I handle this without exporting to an image first? How would I go about making this work in the PrintPage event as you suggested?
by default, the chart will resize to fit the page, so the size and aspect ratio will be altered, making pixel and percentage-based locations invalid from one image to the next.
if you access the PrintDocument property of the control and handle its PrintPage event before invoking the Print method, i think you can change the target size of the chart.
you could also just create your own PrintDocument object and add the chart to its graphics (e.Graphics in PrintPage) as a bitmap.
If I want to go down the road of saving the chart as an image and then printing it, how do I go about doing that?
I know it will potentially change the locations of things set by pixel location (which makes sense) or percentage location (which makes no sense, whether the object is 10 pixes or 10000 pixels in size, 1 percent is still 1 percent).
However, I located my annotations by row/column location. Again, just as with percentage, a row is a row, and a column is a column, and the locations of the annotations should appear over the row and column where they have been located regardless of whether the size of the chart changes to fit the page. If these things are not working correctly, in my opinion, there is a bug in the software.
Have you actually tested this out, is there a fix coming anytime in the forseeable future? Everything else appears to be resized and relocated correctly, I am not sure why it is that custom annotations can not be handled in this way as well.
this code worked for me without any problems using version 8.3.20083.1009. what version of the dll are you using? does this code work for you?
private void Form1_Load(object sender, EventArgs e) { this.ultraChart1.Data.DataSource = Infragistics.UltraChart.Data.DemoTable.Table(); this.ultraChart1.Data.DataBind(); BoxAnnotation boxAnno = new BoxAnnotation(); boxAnno.PE = new PaintElement(Color.PaleGreen); boxAnno.Text = "hello"; boxAnno.Location.Type = LocationType.RowColumn; boxAnno.Location.Row = boxAnno.Location.Column = -2; this.ultraChart1.Annotations.Add(boxAnno); PrintDocument doc = this.ultraChart1.PrintDocument; doc.Print(); //this.ultraChart1.PrintChart(); }