Devexpress:如何在 XtraReport 中将控件添加到另一个控件下方
Devexpress: How to add a control to below the other control in XtraReport
我用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
之间插入分隔线的方法。
您需要使用上一张图表的 XRControl.TopF
property. The value of indent you can get from the 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);
}
我用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
之间插入分隔线的方法。
您需要使用上一张图表的 XRControl.TopF
property. The value of indent you can get from the 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);
}