Hello,
I want to define the scale of the y-axis dynamically based on my data source. My current implementation uses the ItemDataBound event from the graph-object. It is the earliest moment, when the data are bound to the subreport. At this moment the scale is not properly set.
How can I solve my problem? Is there a way to set the properties of NumericalScale to an earlier moment? Any other solution for dynamically define a NumericalScale? Binding?
Best regards,
Roland
I want to define the scale of the y-axis dynamically based on my data source. My current implementation uses the ItemDataBound event from the graph-object. It is the earliest moment, when the data are bound to the subreport. At this moment the scale is not properly set.
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)) };How can I solve my problem? Is there a way to set the properties of NumericalScale to an earlier moment? Any other solution for dynamically define a NumericalScale? Binding?
Best regards,
Roland