我使用XtraReport
来显示我的报告。我想将我的图表添加到另一个下面。以下是我在XtraReport
添加新图表的代码。
foreach (Control viewControl in Panel.Controls)
{
if (viewControl.GetType() == typeof(ChartControl))
{
XRChart chart = new XRChart();
ChartControl chartControl = viewControl as ChartControl;
if (chartControl != null)
{
foreach (ISeries series in chartControl.Series)
{
Series s = new Series(series.Name, ViewType.Bar);
s.Points.Add(
new SeriesPoint(
series.Points.First().UserArgument.ToString(),
series.Points.First().UserValues.FirstOrDefault()
)
);
chart.Series.Add(s);
}
myReport.Detail.Controls.Add(chart);
}
}
}
我找不到在两个XtraChart
之间插入断行的方法。
答案 0 :(得分:1)
您需要使用XRControl.TopF
属性缩进图表。您可以从上一个图表的XRControl.BottomF
属性获得缩进的值
这是一个例子:
float topF = 0;
foreach (Control viewControl in Panel.Controls)
{
var chartControl = viewControl as ChartControl;
if (chartControl == null)
continue;
var chart = new XRChart();
foreach (ISeries series in chartControl.Series)
{
var s = new Series(series.Name, ViewType.Bar);
s.Points.Add(
new SeriesPoint(
series.Points.First().UserArgument.ToString(),
series.Points.First().UserValues.FirstOrDefault()
)
);
chart.Series.Add(s);
}
chart.TopF = topF; // Indent chart.
topF = chart.BottomF; // Set next value to the topF.
myReport.Detail.Controls.Add(chart);
}