/// <summary> /// Sets the scale and create the necessary event links. /// </summary> /// <param name="scale"></param> protected void InternalSetScale(NumericalScale scale) { if (ChildSetMember(ref _scale, scale)) { _doesScaleNeedsDataUpdate = true; } }
public NumericAxisRescaleController(NumericAxisRescaleConditions doc, NumericalScale ax) { _doc = doc; _axis = ax; SetElements(true); }
/// <summary> /// This will create a point list out of the data, which can be used to plot the data. In order to create this list, /// the function must have knowledge how to calculate the points out of the data. This will be done /// by a function provided by the calling function. /// </summary> /// <param name="layer">The plot layer.</param> /// <returns>An array of plot points in layer coordinates.</returns> public Processed2DPlotData GetRangesAndPoints( Gdi.IPlotArea layer) { const int functionPoints = 1000; const double MaxRelativeValue = 1E6; // allocate an array PointF to hold the line points PointF[] ptArray = new PointF[functionPoints]; Processed2DPlotData result = new Processed2DPlotData(); MyPlotData pdata = new MyPlotData(); result.PlotPointsInAbsoluteLayerCoordinates = ptArray; double[] xPhysArray = new double[functionPoints]; double[] yPhysArray = new double[functionPoints]; pdata._xPhysical = xPhysArray; pdata._yPhysical = yPhysArray; result.XPhysicalAccessor = new IndexedPhysicalValueAccessor(pdata.GetXPhysical); result.YPhysicalAccessor = new IndexedPhysicalValueAccessor(pdata.GetYPhysical); // double xorg = layer.XAxis.Org; // double xend = layer.XAxis.End; // Fill the array with values // only the points where x and y are not NaNs are plotted! int i, j; bool bInPlotSpace = true; int rangeStart = 0; PlotRangeList rangeList = new PlotRangeList(); result.RangeList = rangeList; Gdi.G2DCoordinateSystem coordsys = layer.CoordinateSystem; NumericalScale xaxis = layer.XAxis as NumericalScale; NumericalScale yaxis = layer.YAxis as NumericalScale; if (xaxis == null || yaxis == null) { return(null); } for (i = 0, j = 0; i < functionPoints; i++) { double x_rel = ((double)i) / (functionPoints - 1); double x = xaxis.NormalToPhysical(x_rel); double y = Evaluate(x); if (Double.IsNaN(x) || Double.IsNaN(y)) { if (!bInPlotSpace) { bInPlotSpace = true; rangeList.Add(new PlotRange(rangeStart, j)); } continue; } // double x_rel = layer.XAxis.PhysicalToNormal(x); double y_rel = yaxis.PhysicalToNormal(y); // chop relative values to an range of about -+ 10^6 if (y_rel > MaxRelativeValue) { y_rel = MaxRelativeValue; } if (y_rel < -MaxRelativeValue) { y_rel = -MaxRelativeValue; } // after the conversion to relative coordinates it is possible // that with the choosen axis the point is undefined // (for instance negative values on a logarithmic axis) // in this case the returned value is NaN double xcoord, ycoord; if (coordsys.LogicalToLayerCoordinates(new Logical3D(x_rel, y_rel), out xcoord, out ycoord)) { if (bInPlotSpace) { bInPlotSpace = false; rangeStart = j; } xPhysArray[j] = x; yPhysArray[j] = y; ptArray[j].X = (float)xcoord; ptArray[j].Y = (float)ycoord; j++; } else { if (!bInPlotSpace) { bInPlotSpace = true; rangeList.Add(new PlotRange(rangeStart, j)); } } } // end for if (!bInPlotSpace) { bInPlotSpace = true; rangeList.Add(new PlotRange(rangeStart, j)); // add the last range } return(result); }
public LogarithmicAxisRescaleController(LogarithmicAxisRescaleConditions doc, NumericalScale ax) : base(doc, ax) { }
//private List<ColumnSizeLocation> GetColumnsSizeLocation() //{ // List<ColumnSizeLocation> result = new List<ColumnSizeLocation>(); // int widthUnits = 0; // var columns = ChartReportReportDTO.EntityListView.EntityListViewAllColumns.Where(x => x.RelationshipTailID == 0); // foreach (var column in columns) // { // widthUnits += (column.WidthUnit == 0 ? 1 : column.WidthUnit); // } // var width = reportWidth; // var perUnitWidth = width.Divide(widthUnits); // var consumedWidthUnits = 0; // if (ReportGroups != null) // foreach (var reportGroup in ReportGroups) // { // ColumnSizeLocation columnSizeLocation = new ColumnSizeLocation(); // columnSizeLocation.LictViewColumnID = reportGroup.ListViewColumnID; // SetColumnSizePosition(columnSizeLocation, reportGroup.EntityListViewColumn.WidthUnit, ref consumedWidthUnits, perUnitWidth); // result.Add(columnSizeLocation); // } // foreach (var column in columns) // { // if (!result.Any(x => x.LictViewColumnID == column.ID)) // { // ColumnSizeLocation columnSizeLocation = new ColumnSizeLocation(); // columnSizeLocation.LictViewColumnID = column.ID; // SetColumnSizePosition(columnSizeLocation, column.WidthUnit, ref consumedWidthUnits, perUnitWidth); // result.Add(columnSizeLocation); // } // } // return result; //} //private void SetColumnSizePosition(ColumnSizeLocation columnSizeLocation, int currentWidthUnits, ref int consumedWidthUnits, Unit perUnitWidth) //{ // if (currentWidthUnits == 0) // currentWidthUnits = 1; // var width = currentWidthUnits * perUnitWidth; // columnSizeLocation.Width = width; // var xlocation = (reportWidth - width) - consumedWidthUnits * perUnitWidth; // columnSizeLocation.XLocation = xlocation; // consumedWidthUnits += currentWidthUnits; //} // private Telerik.Reporting.DetailSection detailSection1; // private Telerik.Reporting.Graph graph1; //private Telerik.Reporting.PolarCoordinateSystem polarCoordinateSystem1; //private Telerik.Reporting.GraphAxis graphAxis1; //private Telerik.Reporting.GraphAxis graphAxis2; //private Telerik.Reporting.BarSeries barSeries1; private Tuple <Report, Graph> SetReportDetails(Report report) { var detail = new Telerik.Reporting.DetailSection(); //detail.Height = Telerik.Reporting.Drawing.Unit.Cm(0.5); detail.Name = "detail"; ReportStyles.SetReportDetailStyle(detail.Style); report.Items.Add(detail); var graph = new Graph(); graph.Name = "graph1"; graph.Width = reportWidth; graph.Height = report.PageSettings.PaperSize.Height / 2; //reportWidth = report.Width; detail.Items.Add(graph); graph.Legend.Width = Unit.Cm(4); graph.Legend.Style.LineColor = System.Drawing.Color.LightGray; graph.Legend.Style.LineWidth = Telerik.Reporting.Drawing.Unit.Inch(0D); graph.PlotAreaStyle.LineColor = System.Drawing.Color.LightGray; graph.PlotAreaStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Inch(0D); //graph.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6D), Telerik.Reporting.Drawing.Unit.Inch(3D)); GraphAxis categoryAxis = new GraphAxis(); GraphAxis valueAxis = new GraphAxis(); CategoryScale categoryScale1 = new CategoryScale(); categoryAxis.LabelPlacement = Telerik.Reporting.GraphAxisLabelPlacement.AtMaximum; categoryAxis.MajorGridLineStyle.LineColor = System.Drawing.Color.LightGray; categoryAxis.MajorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D); categoryAxis.MajorGridLineStyle.Visible = true; categoryAxis.MinorGridLineStyle.LineColor = System.Drawing.Color.LightGray; categoryAxis.MinorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D); categoryAxis.MinorGridLineStyle.Visible = false; categoryAxis.Name = "categoryAxis"; //categoryScale1.PositionMode = Telerik.Reporting.AxisPositionMode.OnTicks; categoryScale1.SpacingSlotCount = 0.1D; categoryAxis.Style.LineWidth = Telerik.Reporting.Drawing.Unit.Inch(0D); categoryAxis.Scale = categoryScale1; categoryAxis.Style.Visible = true; valueAxis.LabelAngle = 90; valueAxis.MajorGridLineStyle.LineColor = System.Drawing.Color.LightGray; valueAxis.MajorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D); valueAxis.MajorGridLineStyle.Visible = true; valueAxis.MinorGridLineStyle.LineColor = System.Drawing.Color.LightGray; valueAxis.MinorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D); valueAxis.MinorGridLineStyle.Visible = false; valueAxis.Name = "valueAxis"; NumericalScaleCrossAxisPosition numericalScaleCrossAxisPosition1 = new NumericalScaleCrossAxisPosition(); numericalScaleCrossAxisPosition1.Position = Telerik.Reporting.GraphScaleCrossAxisPosition.AtMinimum; numericalScaleCrossAxisPosition1.Value = 0D; NumericalScale numericalScale1 = new NumericalScale(); numericalScale1.CrossAxisPositions.Add(numericalScaleCrossAxisPosition1); valueAxis.Scale = numericalScale1; //valueAxis.Style.Visible = false; var polarCoordinateSystem = new PolarCoordinateSystem(); polarCoordinateSystem.AngularAxis = categoryAxis; polarCoordinateSystem.Name = "polarCoordinateSystem1"; polarCoordinateSystem.RadialAxis = valueAxis; graph.CoordinateSystems.Add(polarCoordinateSystem); var valuecolumn = ChartReportReportDTO.EntityChartReportValues.First(); var categoryColumn = ChartReportReportDTO.EntityChartReportCategories.First(); var categoryGroup = new GraphGroup(); categoryGroup.Name = categoryColumn.EntityListViewColumn.RelativeColumnName; categoryGroup.Groupings.Add(new Grouping(string.Format("= Fields.{0}", categoryColumn.EntityListViewColumn.RelativeColumnName))); categoryGroup.Sortings.Add(new Telerik.Reporting.Sorting(string.Format("= Fields.{0}", categoryColumn.EntityListViewColumn.RelativeColumnName), Telerik.Reporting.SortDirection.Asc)); graph.CategoryGroups.Add(categoryGroup); //if(ChartReportReportDTO.EntityChartReportSeries.Count>0) //{ //} var column = ChartReportReportDTO.EntityChartReportSeries.First(); var barSeries = new Telerik.Reporting.BarSeries(); barSeries.ArrangeMode = Telerik.Reporting.GraphSeriesArrangeMode.Stacked; graph.Series.Add(barSeries); barSeries.Name = column.EntityListViewColumn.RelativeColumnName; barSeries.CategoryGroup = categoryGroup; barSeries.CoordinateSystem = polarCoordinateSystem; barSeries.DataPointLabel = string.Format("= {0}(Fields.{1})", valuecolumn.FunctionType.ToString(), valuecolumn.EntityListViewColumn.RelativeColumnName); barSeries.DataPointLabelStyle.Visible = false; barSeries.LegendItem.Value = "= Fields.Name"; barSeries.Y = string.Format("= {0}(Fields.{1})+0.1", valuecolumn.FunctionType.ToString(), valuecolumn.EntityListViewColumn.RelativeColumnName); barSeries.LegendItem.Value = string.Format("= Fields.{0}", column.EntityListViewColumn.RelativeColumnName); var serieGroup = new GraphGroup(); //اگر نام ست نشده باشد گزارش درست کار نمیکند!!!!؟ serieGroup.Name = column.EntityListViewColumn.RelativeColumnName; serieGroup.Groupings.Add(new Telerik.Reporting.Grouping(string.Format("= Fields.{0}", column.EntityListViewColumn.RelativeColumnName))); serieGroup.Sortings.Add(new Telerik.Reporting.Sorting(string.Format("= Fields.{0}", column.EntityListViewColumn.RelativeColumnName), Telerik.Reporting.SortDirection.Asc)); graph.SeriesGroups.Add(serieGroup); barSeries.SeriesGroup = serieGroup; barSeries.ToolTip.Text = string.Format("= {0}(Fields.{1})", valuecolumn.FunctionType.ToString(), valuecolumn.EntityListViewColumn.RelativeColumnName); // barSeries.ToolTip.Title = string.Format("= Fields.{0}", column.EntityListViewColumn.RelativeColumnName); var legendValue = string.Format("= Fields.{0}", column.EntityListViewColumn.RelativeColumnName); var parentGeoup = serieGroup; foreach (var cColumn in ChartReportReportDTO.EntityChartReportSeries.Where(x => x != column)) { var newGroup = new GraphGroup(); newGroup.Name = cColumn.EntityListViewColumn.RelativeColumnName; newGroup.Groupings.Add(new Telerik.Reporting.Grouping(string.Format("= Fields.{0}", cColumn.EntityListViewColumn.RelativeColumnName))); newGroup.Sortings.Add(new Telerik.Reporting.Sorting(string.Format("= Fields.{0}", cColumn.EntityListViewColumn.RelativeColumnName), Telerik.Reporting.SortDirection.Asc)); parentGeoup.ChildGroups.Add(newGroup); barSeries.SeriesGroup = newGroup; parentGeoup = newGroup; legendValue += "+ \'/\' +" + string.Format(" Fields.{0}", cColumn.EntityListViewColumn.RelativeColumnName); } barSeries.LegendItem.Value = legendValue; barSeries.ToolTip.Title = legendValue; return(new Tuple <Report, Graph>(report, graph)); }