or


var dataItem = (Telerik.Reporting.Processing.DataItem)sender;var list = dataItem.DataSource as IList<InclinationProfileItemModel>;if (list == null) return;list = new List<InclinationProfileItemModel>(list.OrderBy(l => l.InclinationInDistanceUnitToStart));var minY = list.First().InclinationInDistanceUnitToStart;var maxY = list.Last().InclinationInDistanceUnitToStart;var inclMax = Math.Abs(maxY - minY);if (inclMax < 1) this.UnitToStartLineSeriesGraphAxisY.Scale = new NumericalScale { MajorStep = 0.25, MinorStep = 0.25, Minimum = Math.Min(0, Math.Floor(minY)), Maximum = Math.Max(1, Math.Ceiling(maxY)) };else if (inclMax < 5) this.UnitToStartLineSeriesGraphAxisY.Scale = new NumericalScale { MajorStep = 1, MinorStep = 1, Minimum = Math.Min(0, Math.Floor(minY)), Maximum = Math.Max(1, Math.Ceiling(maxY)) };else if (inclMax < 20) this.UnitToStartLineSeriesGraphAxisY.Scale = new NumericalScale { MajorStep = 5, MinorStep = 5, Minimum = Math.Min(0, Math.Floor(minY)), Maximum = Math.Max(1, Math.Ceiling(maxY)) };else this.UnitToStartLineSeriesGraphAxisY.Scale = new NumericalScale { MajorStep = 10, MinorStep = 10, Minimum = Math.Min(0, Math.Floor(minY)), Maximum = Math.Max(1, Math.Ceiling(maxY)) };public ParentReport(){ InitializeComponent(); ItemDataBinding += ReportDataBinding;}public void ReportDataBinding(object sender, EventArgs e){ var processingReport = (Telerik.Reporting.Processing.Report)sender; var report = (Telerik.Reporting.Report)processingReport.ItemDefinition; GroupHeaderArea2 = (Telerik.Reporting.GroupHeaderSection)report.Items.Find("GroupHeaderArea2", true)[0]; GroupHeaderArea2.ItemDataBinding += AssignSubReportDataSource;}public void AssignSubReportDataSource(object sender, EventArgs e){ Telerik.Reporting.Processing.GroupSection groupSection = (Telerik.Reporting.Processing.GroupSection)sender; Telerik.Reporting.Processing.TextBox txtName = (Telerik.Reporting.Processing.TextBox)groupSection.ChildElements.Find("txtName", true)[0]; NavigateToReportAction action = (NavigateToReportAction)((Telerik.Reporting.TextBox)txtName.ItemDefinition).Action; InstanceReportSource subReportSource = (InstanceReportSource)action.ReportSource; ((Telerik.Reporting.Report)subreportSource.ReportDocument).NeedDataSource += subReport_NeedDataSource;}protected void subReport_NeedDataSource(object sender, EventArgs e){ ((Telerik.Reporting.Processing.Report)sender).DataSource = this.DataSource;}