I am using a Bar Chart, which displays very big amount of data, almost more than 2 pages.
I am converting this Whole Web page to PDF using another tool.
Now the problem is i need to use the page break in chart at 45 th bar,does any body has idea how do i can include page break in a chart.
Thanks in advance
This may not help you any, and it has nothing to do with the chart control, but I have handled page breaks for other things using the CSS "page-break-before: always" style. Something like this:
<tr style="page-break-before: always;">
If you could get access to the style on the 46th row and inject that style into it, you may get the page break you want. There is also a page-break-after and page-break-inside style.
Hi Joe,
Thanks for the reply.
But i didn't find any properties in Ultrachart to assign the styles, that is the problem.
Thanks,
how about this:
this.UltraChart1.Style["page-break-before"] = "always";
I need to break the Bar chart in between.
For example if the bar chart has 100 bars, then i need to break the chart at 40th bar and also at 80th bar.
maybe you could save the chart as an image, then split that up into three images? this would probably not use the regular PDF rendering code, and you couldn't tell the chart where to break based on what bar you're on, you'd have to base the image splitting off pixel coordinates.
using (MemoryStream imageStream = new MemoryStream()){ this.UltraChart1.SaveTo(imageStream, RenderingType.Image); using (Image chartImage = Image.FromStream(imageStream)) { Bitmap topImage = new Bitmap(chartImage.Width, chartImage.Height / 2); Bitmap bottomImage = new Bitmap(chartImage.Width, chartImage.Height / 2); Graphics topGraphics = Graphics.FromImage(topImage); Graphics bottomGraphics = Graphics.FromImage(bottomImage); int halfHeight = chartImage.Height / 2; Rectangle destRect = new Rectangle(Point.Empty, topImage.Size); topGraphics.DrawImage(chartImage, destRect, 0, 0, chartImage.Width, halfHeight, GraphicsUnit.Pixel); bottomGraphics.DrawImage(chartImage, destRect, 0, halfHeight, chartImage.Width, halfHeight, GraphicsUnit.Pixel); topImage.Save(@"C:\top.png", ImageFormat.Png); bottomImage.Save(@"C:\bottom.png", ImageFormat.Png); topGraphics.Dispose(); bottomGraphics.Dispose(); topImage.Dispose(); bottomImage.Dispose(); }}
Hi David, Thanks for the response.
Can you give an example to split the image in ASP.Net code.