我有一份显示测试集合的报告。测试报告实际上是另一个 xtrareport,在收集报告中显示为子报告。在这些测试报告中可以有多个子测试和。对于每个子测试,都有一个在脚本中创建的图表。这是为子测试创建图表的脚本:
private void xrChart1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
XRChart chrt = (XRChart)sender;
XYDiagram axis = (XYDiagram)chrt.Diagram;
if (chrt.Series.Count > 0)
{
while (chrt.Series[0].View is ScatterLineSeriesView)
{
chrt.Series.RemoveAt(0);
}
}
Series standardSeries = chrt.Series[0];
Series allBottleSeries = chrt.Series[1];
var curColVal = this.DetailReport1.GetCurrentColumnValue("ShowCurve");
if (curColVal == null)
{
return;
}
chrt.BeginInit();
chrt.Visible = (bool)curColVal;
if (chrt.Visible)
{
List<TSegment> segments = (List<TSegment>)this.DetailReport1.GetCurrentColumnValue("Segments");
if (segments != null)
{
foreach (TSegment segment in segments)
{
Series tempSeries = new Series();
ScatterLineSeriesView tempscatterLineSeriesView = new ScatterLineSeriesView();
tempscatterLineSeriesView.LineMarkerOptions.BorderVisible = false;
tempscatterLineSeriesView.MarkerVisibility = DefaultBoolean.False;
tempscatterLineSeriesView.LineStyle.Thickness = segment.Thickness;
tempscatterLineSeriesView.Color = segment.SegmentColor;
tempSeries.LabelsVisibility = DefaultBoolean.False;
tempSeries.View = tempscatterLineSeriesView;
tempSeries.ShowInLegend = false;
tempSeries.ArgumentDataMember = "X";
tempSeries.ArgumentScaleType = ScaleType.Numerical;
tempSeries.ValueDataMembersSerializable = "Y";
tempSeries.DataSource = segment.Points;
chrt.Series.Insert(0, tempSeries);
}
}
standardSeries.ValueDataMembers[0] = "ODValue";
standardSeries.ArgumentDataMember = "ConcentrationValue";
standardSeries.DataSource = this.DetailReport1.GetCurrentColumnValue("Standards");
allBottleSeries.ValueDataMembers[0] = "Y";
allBottleSeries.ArgumentDataMember = "X";
allBottleSeries.DataSource = this.DetailReport1.GetCurrentColumnValue("BottlePoints");
axis.AxisX.Logarithmic = (bool)this.DetailReport1.GetCurrentColumnValue("XPlotIsLog");
axis.AxisX.LogarithmicBase = (double)this.DetailReport1.GetCurrentColumnValue("LogarithmicBase");
axis.AxisX.Title.Text = (string)this.DetailReport1.GetCurrentColumnValue("UnitsOfConcentration");
axis.AxisX.Label.NumericOptions.Format = NumericFormat.Number;
axis.AxisX.Label.NumericOptions.Precision = (int)this.DetailReport1.GetCurrentColumnValue("NumberOfDigitsInResults");
axis.AxisY.Label.NumericOptions.Format = NumericFormat.Number;
axis.AxisY.Label.NumericOptions.Precision = (int)this.DetailReport1.GetCurrentColumnValue("NumberOfDigitsInMeasuredValues");
axis.AxisY.Logarithmic = (bool)this.DetailReport1.GetCurrentColumnValue("YPlotIsLog");
axis.AxisY.LogarithmicBase = axis.AxisX.LogarithmicBase;
axis.AxisY.Title.Text = (string)this.DetailReport1.GetCurrentColumnValue("UnitsOfStandardsInput");
axis.AxisY.WholeRange.AlwaysShowZeroLevel = !(bool)this.DetailReport1.GetCurrentColumnValue("ODAxisShouldNotStartAtZero");
}
chrt.EndInit();
}
现在,如果我单独查看此子报告,报告将正确显示。不同的子测试有不同的图表。
问题是当我显示收集报告时,子报告显示错误。所有的图表都没有什么不同。最后一个子测试的图表一直显示。
此脚本用于设置子报表的报表源:
private void Detail1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
((XRSubreport)sender).ReportSource = this.DetailReport.GetCurrentRow() as XtraReport;
}
有人知道这里发生了什么吗?