0

I use XtraReport to show my report. I want to add my chart to below the other one. Here is my code to add a new chart on 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);
        }
    }
}

I could not find the way to insert a break line between two XtraChart.

M. Schena
  • 2,039
  • 1
  • 21
  • 29
cagin
  • 5,772
  • 14
  • 74
  • 130

1 Answers1

1

You need to indent your charts by using XRControl.TopF property. The value of indent you can get from the XRControl.BottomF property of previous chart.
Here is example:

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);    
}
nempoBu4
  • 6,521
  • 8
  • 35
  • 40