Currently I am using Telerik Reports of
- V5.1.11.713
- RunTime Version v2.0.50727
Any help is greatly appreciated
another exception that we faced id GDI+ failed exception
3 Answers, 1 is accepted
We would appreciate if you elaborate on how to reproduce this problem on our end. First where does the problem occur - in some of the report viewers or upon exporting/printing? How huge is your data and how do you bind the chart item? What is the operating system and do you have a large number of report items? What data calculations (aggregates, conditional formatting) you utilize, what is the rendering media, the size of the generated document (if this occurs upon export)? Large data or large number of items requires additional resources in terms of powerful CPUs, and enough memory to handle all the operations.
Does the problem occur when you upgrade to the latest Q3 2011 release?
Greetings,
Steve
the Telerik team
Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!
Hi Steve,
thank you for your reply.,
Still the issue isnt resolved, we verified with Q3’11 of Telerik Reporting & Q2’11 of Telerik Reporting. Find the system Environment info
OS: XP SP3
Processor: Intel P(R) D 2.79Ghz
Ram: 4GB
Development : VS2010 Professional / Silverlight 4
Browsers verified: IE 8+, Chrome & mozilla
Current Issues :
- Getting parament not valid error for 1500+ bars in bar/column chart
- Getting Genric GDI+ error and IIS is getting crashed while Viewing, exporting and printing the report for 1000+ bars.
- Zoom mode is varying for page to page view of 1000+bar data chart[for ex in page 1 for normal view it requires 45% and for another page displaying empty page with the same zoom factor].
Find the enclosed sample code for more information and suggest us the proper settings so that the report is correctly rendered Waiting for your reply.
#region [Assemblies References]
using
System;
using
Telerik.Reporting;
using
Telerik.Reporting.Drawing;
using
System.Data;
using
System.Collections.Generic;
using
Telerik.Reporting.Charting;
using
Telerik.Reporting.Charting.Styles;
using
System.Runtime.Serialization;
using
System.IO;
using
System.Text;
using
System.Drawing;
using
System.Linq;
#endregion
namespace
Telerik.Reports
{
/// <summary>
/// Summary description for Report1.
/// </summary>
public
partial
class
SampleEvaluationsReport : Telerik.Reporting.Report
{
DataTable dtResults =
new
DataTable();
#region [Constructor]
public
SampleEvaluationsReport()
{
//Providing the DataSource event for the report
InitializeComponent();
//Adidng tempary columns
for
(
int
i = 0; i < 15; i++)
{
dtResults.Columns.Add(
" Column "
+ i.ToString(), i == 0 ?
typeof
(
string
) :
typeof
(
int
));
}
//Dumping temp data to the data table
for
(
int
i = 0; i < 250; i++)
{
Random r =
new
Random();
dtResults.Rows.Add(
new
object
[] {
"Chart Series "
+i.ToString(),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100),
r.Next(100) }
);
}
//Call the chart generator method
generateChart(dtResults, 1, 2);
}
#endregion
#region [generateChart]
private
int
formatedLabelmaxlength = 0;
private
int
formatedLabelmaxdepth = 0;
/* ************************/
/* Methos to provide custom word wrap for X-Axis[labels with long text, as we are facing alignment issues wit the default settings]
/* ***********************/
private
string
formatTextWrap(
string
sourceText)
{
int
divider = 80;
string
[] sourceTextlist = sourceText.Split(
' '
);
int
lineCount = 0;
string
strResultText =
string
.Empty;
string
strLine =
string
.Empty;
foreach
(
string
strWord
in
sourceTextlist)
{
if
(strLine.Length < divider)
{
strLine += strWord +
" "
;
formatedLabelmaxlength = formatedLabelmaxlength < strLine.Length ? strLine.Length : formatedLabelmaxlength;
}
else
{
formatedLabelmaxlength = formatedLabelmaxlength < strLine.Length ? strLine.Length : formatedLabelmaxlength;
lineCount++;
strResultText += strLine +
"\n"
;
strLine =
string
.Empty;
}
}
if
(strLine.Length > 0)
{
strResultText += strLine;
}
formatedLabelmaxdepth = formatedLabelmaxdepth < lineCount ? lineCount : formatedLabelmaxdepth;
return
strResultText;
}
private
void
generateChart(DataTable dtResults,
int
chartType,
int
GraphType)
{
ChartSeriesType CurrentChartType = ChartSeriesType.Bar;
ChartSeriesOrientation ChartOrientation = ChartSeriesOrientation.Vertical;
float
reportWidth = 5;
float
reportHeight = 8;
float
xAxisMargin = 0f;
float
xAxisLableMargin = 0f;
int
xAxisRotationAngle = 0;
AlignedPositions xAxisTextAlignedPositions = AlignedPositions.Left;
AlignedPositions xAxisLabelAlignedPositions = AlignedPositions.Top;
AlignedPositions xAxisAxisLabel = AlignedPositions.Top;
#region Format Data
for
(
int
i = 0; i < dtResults.Rows.Count; i++)
{
dtResults.Rows[i][0] = formatTextWrap(dtResults.Rows[i][0].ToString());
}
#endregion
#region Graph Type
switch
(chartType)
{
case
1:
//Column
CurrentChartType = ChartSeriesType.Bar;
ChartOrientation = ChartSeriesOrientation.Vertical;
xAxisTextAlignedPositions = AlignedPositions.Left;
xAxisLabelAlignedPositions = AlignedPositions.Top;
xAxisAxisLabel = AlignedPositions.Top;
xAxisRotationAngle = 270;
break
;
case
2:
//Bar
CurrentChartType = ChartSeriesType.Bar;
ChartOrientation = ChartSeriesOrientation.Horizontal;
xAxisTextAlignedPositions = AlignedPositions.Left;
xAxisLabelAlignedPositions = AlignedPositions.Right;
xAxisAxisLabel = AlignedPositions.Left;
xAxisRotationAngle = 0;
break
;
case
3:
//Line
CurrentChartType = ChartSeriesType.Line;
ChartOrientation = ChartSeriesOrientation.Vertical;
xAxisTextAlignedPositions = AlignedPositions.Left;
xAxisLabelAlignedPositions = AlignedPositions.Top;
xAxisAxisLabel = AlignedPositions.Top;
xAxisRotationAngle = 270;
break
;
default
:
break
;
}
#endregion
int
totalBarCount = dtResults.Rows.Count * (dtResults.Columns.Count - 1);
int
maxXAxisTextlength = formatedLabelmaxlength > 80 ? 80 : formatedLabelmaxlength;
GetChartProperties(ChartOrientation, totalBarCount, maxXAxisTextlength,
ref
reportWidth,
ref
reportHeight,
ref
xAxisMargin,
ref
xAxisLableMargin);
#region Chart Formating
this
.chartGeneric.Skin =
"Mac"
;
this
.chartGeneric.AutoLayout =
false
;
this
.chartGeneric.AutoTextWrap =
false
;
this
.chartGeneric.BitmapResolution = 96F;
this
.chartGeneric.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
this
.chartGeneric.ChartTitle.Visible =
false
;
this
.chartGeneric.PlotArea.Appearance.Position.X = 0;
this
.chartGeneric.PlotArea.Appearance.Position.Y = 0;
this
.chartGeneric.PlotArea.Chart.Appearance.Position.X = 0;
this
.chartGeneric.PlotArea.Chart.Appearance.Position.Y = 0;
this
.chartGeneric.PlotArea.EmptySeriesMessage.TextBlock.Text =
"There is nothing to display"
;
this
.chartGeneric.PlotArea.XAxis.AxisLabel.Visible =
true
;
this
.chartGeneric.PlotArea.YAxis.AxisLabel.Visible =
true
;
this
.chartGeneric.SeriesOrientation = ChartOrientation;
this
.chartGeneric.PlotArea.XAxis.AxisLabel.Appearance.Dimensions.Margins =
new
ChartMargins(0);
this
.chartGeneric.PlotArea.XAxis.AxisLabel.Appearance.Dimensions.Paddings =
new
ChartPaddings(0);
this
.chartGeneric.PlotArea.XAxis.AutoShrink =
false
;
this
.chartGeneric.PlotArea.XAxis.AutoScale =
false
;
this
.chartGeneric.PlotArea.XAxis.Appearance.TextAppearance.MaxLength = 255;
this
.chartGeneric.PlotArea.XAxis.Appearance.TextAppearance.AutoTextWrap = AutoTextWrap.False;
this
.chartGeneric.Appearance.TextQuality = TextQuality.SystemDefault;
this
.chartGeneric.PlotArea.XAxis.Appearance.Color = Color.Black;
this
.chartGeneric.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;
this
.chartGeneric.DefaultType = CurrentChartType;
this
.chartGeneric.PlotArea.XAxis.AxisLabel.TextBlock.Text = dtResults.Columns[0].ColumnName;
this
.chartGeneric.PlotArea.YAxis.AxisLabel.TextBlock.Text =
"(in numbers) "
;
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Top = 50;
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Right = 250;
this
.chartGeneric.Appearance.BarWidthPercent = totalBarCount > 5 ? 100 : 20;
this
.chartGeneric.Appearance.BarOverlapPercent = -10;
this
.chartGeneric.PlotArea.XAxis.AxisLabel.Appearance.Dimensions.Margins.Left =
new
Telerik.Reporting.Charting.Styles.Unit(5);
this
.chartGeneric.PlotArea.XAxis.Appearance.TextAppearance.Position.AlignedPosition = xAxisTextAlignedPositions;
this
.chartGeneric.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = xAxisLabelAlignedPositions;
this
.chartGeneric.PlotArea.XAxis.AxisLabel.Appearance.Position.AlignedPosition = xAxisAxisLabel;
this
.chartGeneric.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = xAxisRotationAngle;
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Left = 50;
if
(ChartOrientation == ChartSeriesOrientation.Vertical)
{
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Left = 50;
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Bottom = xAxisMargin;
this
.chartGeneric.PlotArea.XAxis.Appearance.TextAppearance.Dimensions.Margins.Bottom = xAxisLableMargin;
}
else
{
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Left = xAxisMargin;
this
.chartGeneric.PlotArea.Appearance.Dimensions.Margins.Bottom = 50;
this
.chartGeneric.PlotArea.XAxis.Appearance.TextAppearance.Dimensions.Margins.Left = xAxisLableMargin;
}
#endregion
#region Legend Formating
this
.chartGeneric.Legend.Appearance.Position.AlignedPosition = AlignedPositions.TopRight;
this
.chartGeneric.Legend.Appearance.Dimensions.Margins =
new
ChartMargins(5);
this
.chartGeneric.Legend.Appearance.Dimensions.Paddings =
new
ChartPaddings(5);
this
.chartGeneric.Legend.Appearance.Overflow = Overflow.Column;
this
.chartGeneric.Legend.Appearance.Dimensions.Width = 75;
this
.chartGeneric.Legend.Appearance.ItemTextAppearance.AutoTextWrap = AutoTextWrap.True;
this
.chartGeneric.Legend.Appearance.Location = LabelLocation.OutsidePlotArea;
this
.chartGeneric.Legend.Appearance.ItemTextAppearance.Position.AlignedPosition = AlignedPositions.Top;
#endregion
#region Chart Series
chartGeneric.Series.Clear();
chartGeneric.DataSource = dtResults;
List<ChartSeries> chartSeries =
new
List<ChartSeries>();
chartGeneric.PlotArea.XAxis.DataLabelsColumn = dtResults.Columns[0].ColumnName.Trim();
for
(
int
counter = 1; counter < dtResults.Columns.Count; counter++)
{
ChartSeries series =
new
ChartSeries()
{
DataYColumn = dtResults.Columns[counter].ColumnName,
Name = dtResults.Columns[counter].Caption,
YAxisType = ChartYAxisType.Primary,
Type = chartGeneric.DefaultType
};
series.Appearance.LabelAppearance.LabelLocation = Telerik.Reporting.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
if
(ChartOrientation == ChartSeriesOrientation.Vertical)
{
series.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.Top;
}
else
{
series.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.Right;
}
series.Appearance.BarWidthPercent = 90;
series.Appearance.TextAppearance.TextProperties.Color = Color.Black;
series.Appearance.TextAppearance.Dimensions.Margins =
new
ChartMargins(0);
series.Appearance.TextAppearance.Dimensions.Paddings =
new
ChartPaddings(0);
chartSeries.Add(series);
}
// add the series to the chart, chart to page.
chartGeneric.Series.AddRange(chartSeries.ToArray());
#endregion
#region Chart Dimensions
this
.chartGeneric.Docking = DockingStyle.None;
this
.chartGeneric.Appearance.Position.AlignedPosition = AlignedPositions.Center;
this
.chartGeneric.Location =
new
PointU(
new
Telerik.Reporting.Drawing.Unit(0),
new
Telerik.Reporting.Drawing.Unit(0));
this
.chartGeneric.Width =
new
Telerik.Reporting.Drawing.Unit(reportWidth, Telerik.Reporting.Drawing.UnitType.Inch);
this
.chartGeneric.Height =
new
Telerik.Reporting.Drawing.Unit(reportHeight, Telerik.Reporting.Drawing.UnitType.Inch);
#endregion
#region Page Dimensions
this
.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Custom;
this
.PageSettings.PaperSize =
new
Telerik.Reporting.Drawing.SizeU(
new
Telerik.Reporting.Drawing.Unit(reportWidth + 0.5, Telerik.Reporting.Drawing.UnitType.Inch),
new
Telerik.Reporting.Drawing.Unit(reportHeight + 1.0 +
this
.pageHeaderSection1.Height.Value, Telerik.Reporting.Drawing.UnitType.Inch));
#endregion
}
/**************************
* manually caluculation for the chart margin's, width & height based on the x-axis label text length
* ********************************/
private
void
GetChartProperties(ChartSeriesOrientation objChartOrientation,
int
totalBarCount,
int
maxXAxisTextlength,
ref
float
reportWidth,
ref
float
reportHeight,
ref
float
xAxisMargin,
ref
float
xAxisLableMargin)
{
if
(objChartOrientation == ChartSeriesOrientation.Horizontal)
{
float
tempwidth = reportWidth;
reportWidth = reportHeight;
reportHeight = tempwidth;
}
xAxisMargin = (maxXAxisTextlength * 7) + 60;
xAxisLableMargin = (maxXAxisTextlength * 6) + 10;
if
(objChartOrientation == ChartSeriesOrientation.Vertical)
{
if
(maxXAxisTextlength > 50)
{
reportHeight += (
float
)(6 - (reportWidth - (maxXAxisTextlength * 0.0625)));
}
if
(formatedLabelmaxdepth < totalBarCount)
{
if
(totalBarCount > 5)
{
//reportWidth += (float)reportWidth + (totalBarCount - 3) / 9;
reportWidth += (
float
)reportWidth + (totalBarCount * .3f);
}
}
else
{
if
(formatedLabelmaxdepth > 3)
{
reportWidth += (
float
)reportWidth + (formatedLabelmaxdepth * .1f);
}
}
}
else
{
if
(maxXAxisTextlength > 50)
{
reportWidth += (
float
)(8 - (reportWidth - (maxXAxisTextlength * 0.0625)));
}
if
(formatedLabelmaxdepth < totalBarCount)
{
if
(totalBarCount > 5)
{
// reportHeight += (float)reportHeight + (totalBarCount - 5) / 9;
reportHeight += (
float
)reportHeight + (totalBarCount * .3f);
}
}
else
{
if
(formatedLabelmaxdepth > 3)
{
reportHeight += (
float
)reportHeight + (formatedLabelmaxdepth * .1f);
}
}
}
}
#endregion
}
}
Thanks,
Kishore V
Thank you for the sample code which helped us reproduce the problem on our end. I've logged the problem in our bug tracking system and we would look into it for subsequent version of the product.
Generally have in mind that while the product was designed to be easily customizable and feature rich it does not cope well with extremely busy charts or rendering a lot of graphs on a single page. We are continually improving performance as we go but still the bottom line is that it is targeted for casual situations which do not require a performance or memory solution. There is a trade off to make between high customization and performance/memory footprint and we've gone the rich features path as it is what most of our customers are interested in.
Additionally we're not really sure of the real world case/usage of such a long chart i.e. it certainly cannot be printed on a regular printer and is hard to look at and make conclusions as well. Can you elaborate why you need such chart, what printer you use to print it and does anyone actually look at the chart in the report or exported formats?
Your Telerik points have been updated for bringing this to our attention.
All the best,
Steve
the Telerik team
Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!