public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { var pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out var plotDataList)) { pb.Add(pbclone); return; } // we put zero into the y-Boundaries, since the addition starts with that value pb.Add(new AltaxoVariant(0.0)); AltaxoVariant[] ySumArray = null; int idx = -1; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { idx++; var gpi = (G2DPlotItem)pi; Processed2DPlotData pdata = plotDataList[gpi]; if (null != pdata) { // Note: we can not use AddUp function here, since // when we have positive/negative items, the intermediate bounds // might be wider than the bounds of the end result if (ySumArray == null) { ySumArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] = pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } else // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] += pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } } } } }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { if (!(pb is NumericalBoundaries)) { CoordinateTransformingStyleBase.MergeYBoundsInto(pb, coll); return; } NumericalBoundaries ybounds = (NumericalBoundaries)pb.Clone(); ybounds.Reset(); int nItems = 0; foreach (IGPlotItem pi in coll) { if (pi is IYBoundsHolder) { IYBoundsHolder ybpi = (IYBoundsHolder)pi; ybpi.MergeYBoundsInto(ybounds); } if (pi is G2DPlotItem) { nItems++; } } if (nItems == 0) { _yinc = 0; } else { _yinc = (ybounds.UpperBound - ybounds.LowerBound) / nItems; } int idx = 0; foreach (IGPlotItem pi in coll) { if (pi is IYBoundsHolder) { IYBoundsHolder ybpi = (IYBoundsHolder)pi; ybounds.Reset(); ybpi.MergeYBoundsInto(ybounds); ybounds.Shift(_yinc * idx); pb.Add(ybounds); } if (pi is G2DPlotItem) { idx++; } } }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { var pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out var plotDataList)) { pb.Add(pbclone); return; } pb.Add(0); pb.Add(100); }