public static void Paint(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { for (int i = coll.Count - 1; i >= 0; --i) { coll[i].Paint(g, paintContext, layer, i == coll.Count - 1 ? null : coll[i + 1], i == 0 ? null : coll[i - 1]); } }
public static void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { foreach (IGPlotItem pi in coll) { pi.Paint(g, layer); } }
public static void Paint(IGraphicsContext3D g, Altaxo.Graph.IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { for (int i = coll.Count - 1; i >= 0; --i) { coll[i].Paint(g, paintContext, layer, i == coll.Count - 1 ? null : coll[i + 1], i == 0 ? null : coll[i - 1]); } }
/// <summary> /// Determines whether the plot items in <paramref name="coll"/> can be plotted as stack. Presumption is that all plot items /// have the same number of plot points, and that all items have the same order of x values associated with the plot points. /// </summary> /// <param name="layer">Plot layer.</param> /// <param name="coll">Collection of plot items.</param> /// <param name="plotDataList">Output: dictionary with associates each plot item with a list of processed plot data.</param> /// <returns>Returns <c>true</c> if the plot items in <paramref name="coll"/> can be plotted as stack; otherwise, <c>false</c>.</returns> public static bool CanUseStyle(IPlotArea layer, PlotItemCollection coll, out Dictionary <G3DPlotItem, Processed3DPlotData> plotDataList) { plotDataList = new Dictionary <G3DPlotItem, Processed3DPlotData>(); AltaxoVariant[] xArray = null; AltaxoVariant[] yArray = null; int idx = -1; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { idx++; var gpi = (G3DPlotItem)pi; Processed3DPlotData pdata = gpi.GetRangesAndPoints(layer); plotDataList.Add(gpi, pdata); if (xArray == null) { xArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; yArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; xArray[j] = pdata.GetXPhysical(originalIndex); yArray[j] = pdata.GetYPhysical(originalIndex); } } else // this is not the first item { if (pdata.RangeList.PlotPointCount != xArray.Length) { return(false); } int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; if (xArray[j] != pdata.GetXPhysical(originalIndex)) { return(false); } if (yArray[j] != pdata.GetYPhysical(originalIndex)) { return(false); } } } } } return(idx >= 1); }
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 PaintPreprocessing(IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { if (!CanUseStyle(layer, coll, out var plotDataDict)) { return; } else { paintContext.AddValue(this, plotDataDict); } AltaxoVariant[] vSumArray = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { var gpi = pi as G3DPlotItem; var pdata = plotDataDict[gpi]; vSumArray = AbsoluteStackTransform.AddUp(vSumArray, pdata); } } // now plot the data - the summed up y is in yArray AltaxoVariant[] vArray = null; Processed3DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { var gpi = pi as G3DPlotItem; var pdata = plotDataDict[gpi]; vArray = AbsoluteStackTransform.AddUp(vArray, pdata); var localArray = new AltaxoVariant[vArray.Length]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant v = 100 * vArray[j] / vSumArray[j]; localArray[j] = v; var rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalIndex)), layer.ZAxis.PhysicalVariantToNormal(v)); layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out var pabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = pabs; } // we have also to exchange the accessor for the physical z value and replace it by our own one pdata.ZPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate(int i) { return(localArray[i]); }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } }
public void PaintPreprocessing(IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { if (!CanUseStyle(layer, coll, out var plotDataDict)) { return; } else { paintContext.AddValue(this, plotDataDict); } AltaxoVariant[] vArray = null; // First, add up all items since we start always with the last item int idx = -1; Processed3DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { idx++; var gpi = pi as G3DPlotItem; Processed3DPlotData pdata = plotDataDict[gpi]; if (null == pdata) { continue; } vArray = AddUp(vArray, pdata); if (idx > 0) // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; var rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalIndex)), layer.ZAxis.PhysicalVariantToNormal(vArray[j])); layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out var pabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = pabs; } } // we have also to exchange the accessor for the physical y value and replace it by our own one var localArray = (AltaxoVariant[])vArray.Clone(); var localArrayHolder = new LocalArrayHolder(localArray, pdata); pdata.ZPhysicalAccessor = localArrayHolder.GetPhysical; pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { System.Drawing.Region[] clippingColl = new System.Drawing.Region[coll.Count]; Processed2DPlotData[] plotDataColl = new Processed2DPlotData[coll.Count]; double[] xincColl = new double[coll.Count]; double[] yincColl = new double[coll.Count]; int idx = -1; Processed2DPlotData previousPlotData = null; for (int i = 0; i < coll.Count; i++) { if (coll[i] is G2DPlotItem) { idx++; double currxinc = xincColl[i] = idx * _xinc * _scaleXInc; double curryinc = yincColl[i] = idx * _yinc * _scaleYInc; G2DPlotItem gpi = coll[i] as G2DPlotItem; Processed2DPlotData plotdata = plotDataColl[i] = gpi.GetRangesAndPoints(layer); plotdata.PreviousItemData = previousPlotData; previousPlotData = plotdata; int j = -1; foreach (int rowIndex in plotdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant xx = plotdata.GetXPhysical(rowIndex) + currxinc; AltaxoVariant yy = plotdata.GetYPhysical(rowIndex) + curryinc; Logical3D rel = new Logical3D(layer.XAxis.PhysicalVariantToNormal(xx), layer.YAxis.PhysicalVariantToNormal(yy)); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); plotdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } if (_useClipping) { GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); } } } for (int i = coll.Count - 1; i >= 0; i--) { if (null == plotDataColl[i]) { coll[i].Paint(g, layer); } else { TransformedLayerWrapper layerwrapper = new TransformedLayerWrapper(layer, xincColl[i], yincColl[i]); ((G2DPlotItem)coll[i]).Paint(g, layerwrapper, plotDataColl[i]); } } }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList; IPhysicalBoundaries 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 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++; G2DPlotItem gpi = (G2DPlotItem)pi; Processed2DPlotData pdata = plotDataList[gpi]; // 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 MergeXBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { if (!(pb is NumericalBoundaries)) { CoordinateTransformingStyleBase.MergeXBoundsInto(pb, coll); return; } NumericalBoundaries xbounds = (NumericalBoundaries)pb.Clone(); xbounds.Reset(); int nItems = 0; foreach (IGPlotItem pi in coll) { if (pi is IXBoundsHolder) { IXBoundsHolder xbpi = (IXBoundsHolder)pi; xbpi.MergeXBoundsInto(xbounds); } if (pi is G2DPlotItem) { nItems++; } } if (nItems == 0) { _xinc = 0; } else { _xinc = (xbounds.UpperBound - xbounds.LowerBound) / nItems; } int idx = 0; foreach (IGPlotItem pi in coll) { if (pi is IXBoundsHolder) { IXBoundsHolder xbpi = (IXBoundsHolder)pi; xbounds.Reset(); xbpi.MergeXBoundsInto(xbounds); xbounds.Shift(_xinc * idx); pb.Add(xbounds); } if (pi is G2DPlotItem) { idx++; } } }
public static void MergeYBoundsInto(IPhysicalBoundaries pb, PlotItemCollection coll) { foreach (IGPlotItem pi in coll) { if (pi is IYBoundsHolder) { IYBoundsHolder plotItem = (IYBoundsHolder)pi; plotItem.MergeYBoundsInto(pb); } } }
public static void MergeZBoundsInto(IPhysicalBoundaries pb, PlotItemCollection coll) { foreach (IGPlotItem pi in coll) { if (pi is IZBoundsHolder) { var plotItem = (IZBoundsHolder)pi; plotItem.MergeZBoundsInto(pb); } } }
/// <summary> /// Plots selected data columns of a table. /// </summary> /// <param name="table">The source table.</param> /// <param name="selectedColumns">The data columns of the table that should be plotted.</param> /// <param name="graph">The graph document to plot into.</param> /// <param name="templatePlotStyle">The plot style which is the template for all plot items.</param> /// <param name="groupStyles">The group styles for the newly built plot item collection.</param> public static Altaxo.Gui.Graph.Gdi.Viewing.IGraphController Plot( DataTable table, IAscendingIntegerCollection selectedColumns, Graph.Gdi.GraphDocument graph, G2DPlotStyleCollection templatePlotStyle, PlotGroupStyleCollection groupStyles) { List <IGPlotItem> pilist = CreatePlotItems(table, selectedColumns, templatePlotStyle); // now create a new Graph with this plot associations var gc = Current.ProjectService.CreateNewGraph(graph); var xylayer = gc.Doc.RootLayer.Layers.OfType <Altaxo.Graph.Gdi.XYPlotLayer>().First(); // Set x and y axes according to the first plot item in the list if (pilist.Count > 0 && (pilist[0] is XYColumnPlotItem)) { var firstitem = (XYColumnPlotItem)pilist[0]; if (firstitem.Data.XColumn is TextColumn) { xylayer.Scales[0] = new TextScale(); } else if (firstitem.Data.XColumn is DateTimeColumn) { xylayer.Scales[0] = new DateTimeScale(); } if (firstitem.Data.YColumn is TextColumn) { xylayer.Scales[1] = new TextScale(); } else if (firstitem.Data.YColumn is DateTimeColumn) { xylayer.Scales[1] = new DateTimeScale(); } } var newPlotGroup = new PlotItemCollection(xylayer.PlotItems); foreach (IGPlotItem pi in pilist) { newPlotGroup.Add(pi); } if (groupStyles != null) { newPlotGroup.GroupStyles = groupStyles; } else { newPlotGroup.CollectStyles(newPlotGroup.GroupStyles); } xylayer.PlotItems.Add(newPlotGroup); return(gc); }
/// <summary> /// Plots selected data columns of a table. /// </summary> /// <param name="table">The source table.</param> /// <param name="selectedColumns">The data columns of the table that should be plotted.</param> /// <param name="graph">The graph document to plot into.</param> /// <param name="templatePlotStyle">The plot style which is the template for all plot items.</param> /// <param name="groupStyles">The group styles for the newly built plot item collection.</param> public static IGraphController Plot(DataTable table, IAscendingIntegerCollection selectedColumns, Graph.Gdi.GraphDocument graph, G2DPlotStyleCollection templatePlotStyle, PlotGroupStyleCollection groupStyles) { List <IGPlotItem> pilist = CreatePlotItems(table, selectedColumns, templatePlotStyle); // now create a new Graph with this plot associations Altaxo.Graph.GUI.IGraphController gc = Current.ProjectService.CreateNewGraph(graph); // Set x and y axes according to the first plot item in the list if (pilist.Count > 0 && (pilist[0] is XYColumnPlotItem)) { XYColumnPlotItem firstitem = (XYColumnPlotItem)pilist[0]; if (firstitem.Data.XColumn is TextColumn) { gc.Doc.Layers[0].LinkedScales.SetScale(0, new Graph.Scales.TextScale()); } else if (firstitem.Data.XColumn is DateTimeColumn) { gc.Doc.Layers[0].LinkedScales.SetScale(0, new Graph.Scales.DateTimeScale()); } if (firstitem.Data.YColumn is TextColumn) { gc.Doc.Layers[0].LinkedScales.SetScale(1, new Graph.Scales.TextScale()); } else if (firstitem.Data.YColumn is DateTimeColumn) { gc.Doc.Layers[0].LinkedScales.SetScale(1, new Graph.Scales.DateTimeScale()); } } PlotItemCollection newPlotGroup = new PlotItemCollection(gc.Doc.Layers[0].PlotItems); foreach (IGPlotItem pi in pilist) { newPlotGroup.Add(pi); } if (groupStyles != null) { newPlotGroup.GroupStyles = groupStyles; } else { newPlotGroup.CollectStyles(newPlotGroup.GroupStyles); } gc.Doc.Layers[0].PlotItems.Add(newPlotGroup); return(gc); }
public void MergeZBoundsInto(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.MergeZBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out var plotDataList)) { pb.Add(pbclone); return; } pb.Add(0); pb.Add(100); }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList; IPhysicalBoundaries 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 plotDataList)) { pb.Add(pbclone); return; } pb.Add(0); pb.Add(100); }
private void TransferTreeToDoc(NGTreeNode rootnode, PlotItemCollection picoll) { picoll.Clear(); foreach (NGTreeNode node in rootnode.Nodes) { IGPlotItem item = (IGPlotItem)node.Tag; if (item is PlotItemCollection) // if this is a plot item collection { TransferTreeToDoc(node, (PlotItemCollection)item); } picoll.Add(item); } }
public bool Apply() { if (!this.m_bDirty) { return(true); // not dirty - so no need to apply something } _originalDoc.Clear(); // first, clear all Plot items TransferTreeToDoc(_plotItemsRootNode, _originalDoc); if (_useDocument == UseDocument.Copy) { _doc = _originalDoc.Clone(); } SetElements(true); // Reload the applied contents to make sure it is synchronized return(true); // all ok }
/// <summary> /// Initialize the controller with the document. If successfull, the function has to return true. /// </summary> /// <param name="args">The arguments neccessary to create the controller. Normally, the first argument is the document, the second can be the parent of the document and so on.</param> /// <returns>True if successfull, else false.</returns> public bool InitializeDocument(params object[] args) { if (args == null || args.Length == 0) { return(false); } _doc = _originalDoc = args[0] as PlotItemCollection; if (null == _originalDoc) { return(false); } if (_useDocument == UseDocument.Copy) { _doc = _originalDoc.Clone(); } _plotItemsTree = _plotItemsRootNode.Nodes; SetElements(true); return(true); }
private void AddToNGTreeNode(NGTreeNode node, PlotItemCollection picoll) { foreach (IGPlotItem pa in picoll) { if (pa is PlotItemCollection) // if this is a plot item collection { // add only one item to the list box, namely a PLCon group item with // all the members of that group NGTreeNode grpNode = new NGTreeNode(); grpNode.Text = "PlotGroup"; grpNode.Tag = pa; node.Nodes.Add(grpNode); // add all the items in the group also to the list of added items AddToNGTreeNode(grpNode, (PlotItemCollection)pa); } else // else if the item is not in a plot group { NGTreeNode toAdd = new NGTreeNode(); toAdd.Text = pa.GetName(2); toAdd.Tag = pa; node.Nodes.Add(toAdd); } } }
public bool Apply() { if(!this.m_bDirty) return true; // not dirty - so no need to apply something _originalDoc.Clear(); // first, clear all Plot items TransferTreeToDoc(_plotItemsRootNode, _originalDoc); if (_useDocument== UseDocument.Copy) _doc = _originalDoc.Clone(); SetElements(true); // Reload the applied contents to make sure it is synchronized return true; // all ok }
private void TransferTreeToDoc(NGTreeNode rootnode, PlotItemCollection picoll) { picoll.Clear(); foreach (NGTreeNode node in rootnode.Nodes) { IGPlotItem item = (IGPlotItem)node.Tag; if (item is PlotItemCollection) // if this is a plot item collection TransferTreeToDoc(node, (PlotItemCollection)item); picoll.Add(item); } }
public void PaintPreprocessing(IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { Dictionary<G3DPlotItem, Processed3DPlotData> plotDataDict = null; if (!CanUseStyle(layer, coll, out plotDataDict)) { return; } else { paintContext.AddValue(this, plotDataDict); } AltaxoVariant[] vSumArray = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { var gpi = pi as G3DPlotItem; var pdata = plotDataDict[gpi]; vSumArray = AbsoluteStackTransform.AddUp(vSumArray, pdata); } } // now plot the data - the summed up y is in yArray AltaxoVariant[] vArray = null; Processed3DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { var gpi = pi as G3DPlotItem; var pdata = plotDataDict[gpi]; vArray = AbsoluteStackTransform.AddUp(vArray, pdata); AltaxoVariant[] localArray = new AltaxoVariant[vArray.Length]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant v = 100 * vArray[j] / vSumArray[j]; localArray[j] = v; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalIndex)), layer.ZAxis.PhysicalVariantToNormal(v)); PointD3D pabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out pabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = pabs; } // we have also to exchange the accessor for the physical z value and replace it by our own one pdata.ZPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate (int i) { return localArray[i]; }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } }
/// <summary> /// Initialize the controller with the document. If successfull, the function has to return true. /// </summary> /// <param name="args">The arguments neccessary to create the controller. Normally, the first argument is the document, the second can be the parent of the document and so on.</param> /// <returns>True if successfull, else false.</returns> public bool InitializeDocument(params object[] args) { if (args == null || args.Length == 0) return false; _doc = _originalDoc = args[0] as PlotItemCollection; if (null == _originalDoc) return false; if (_useDocument == UseDocument.Copy) _doc = _originalDoc.Clone(); _plotItemsTree = _plotItemsRootNode.Nodes; SetElements(true); return true; }
/// <summary> /// Creates a layer with position <paramref name="position"/> and size <paramref name="size"/>. /// </summary> /// <param name="position">The position of the layer on the printable area in points (1/72 inch).</param> /// <param name="size">The size of the layer in points (1/72 inch).</param> /// <param name="coordinateSystem">The coordinate system to use for the layer.</param> public XYPlotLayer(PointF position, SizeF size, G2DCoordinateSystem coordinateSystem) { this._changeEventSuppressor = new Altaxo.Main.EventSuppressor(EhChangeEventResumed); this.Location = new XYPlotLayerPositionAndSize(); this.CoordinateSystem = coordinateSystem; this.Size = size; this.Position = position; this.AxisStyles = new AxisStyleCollection(); this.LinkedScales = new LinkedScaleCollection(); this.GridPlanes = new GridPlaneCollection(); this.GridPlanes.Add( new GridPlane(CSPlaneID.Front)); this.GraphObjects = new GraphicCollection(); this.Legends = new GraphicCollection(); CalculateMatrix(); LinkedLayerLink = new Main.RelDocNodeProxy(null, this); PlotItems = new PlotItemCollection(this); }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataDict; if (!CanUseStyle(layer, coll, out plotDataDict)) { CoordinateTransformingStyleBase.Paint(g, layer, coll); return; } AltaxoVariant[] yArray = null; // First, add up all items since we start always with the last item int idx = -1; Processed2DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { idx++; G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; yArray = AddUp(yArray, pdata); if(idx>0) // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(yArray[j])); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } } // we have also to exchange the accessor for the physical y value and replace it by our own one AltaxoVariant[] localArray = (AltaxoVariant[])yArray.Clone(); pdata.YPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate(int i) { return localArray[i]; }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } for (int i = coll.Count - 1; i >= 0; --i) { IGPlotItem pi = coll[i]; if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; gpi.Paint(g, layer, pdata); } else { pi.Paint(g, layer); } } }
public void PaintPreprocessing(IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { Dictionary<G3DPlotItem, Processed3DPlotData> plotDataDict = null; if (!CanUseStyle(layer, coll, out plotDataDict)) { return; } else { paintContext.AddValue(this, plotDataDict); } AltaxoVariant[] vArray = null; // First, add up all items since we start always with the last item int idx = -1; Processed3DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { idx++; G3DPlotItem gpi = pi as G3DPlotItem; Processed3DPlotData pdata = plotDataDict[gpi]; vArray = AddUp(vArray, pdata); if (idx > 0) // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(pdata.GetYPhysical(originalIndex)), layer.ZAxis.PhysicalVariantToNormal(vArray[j])); PointD3D pabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out pabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = pabs; } } // we have also to exchange the accessor for the physical y value and replace it by our own one AltaxoVariant[] localArray = (AltaxoVariant[])vArray.Clone(); LocalArrayHolder localArrayHolder = new LocalArrayHolder(localArray, pdata); pdata.ZPhysicalAccessor = localArrayHolder.GetPhysical; pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } }
public void PaintChild(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int i) { CachedPaintData paintData = paintContext.GetValue<CachedPaintData>(this); if (_useClipping) { //g.SetClip(clippingColl[i], CombineMode.Replace); g.Clip = paintData._clippingColl[i]; } if (null == paintData._plotDataColl[i]) { coll[i].Paint(g, paintContext, layer, i == coll.Count - 1 ? null : coll[i - 1], i == 0 ? null : coll[i - 1]); } else { TransformedLayerWrapper layerwrapper = new TransformedLayerWrapper(layer, paintData._xincColl[i], paintData._yincColl[i]); ((G2DPlotItem)coll[i]).Paint(g, layerwrapper, paintData._plotDataColl[i], i == coll.Count - 1 ? null : paintData._plotDataColl[i + 1], i == 0 ? null : paintData._plotDataColl[i - 1]); } // The clipping region is no longer needed, so we can dispose it if (_useClipping) { if (i == 0) g.Clip = paintData._clippingColl[0]; // restore the original clipping region else paintData._clippingColl[i].Dispose(); // for i!=0 dispose the clipping region } }
private static bool CanUseStyle(IPlotArea layer, PlotItemCollection coll, out Dictionary <G3DPlotItem, Processed3DPlotData> plotDataList) { return(AbsoluteStackTransform.CanUseStyle(layer, coll, out plotDataList)); }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { CoordinateTransformingStyleBase.MergeYBoundsInto(pb, coll); }
public void PaintPreprocessing(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { var paintData = new CachedPaintData { _clippingColl = new System.Drawing.Region[coll.Count], _plotDataColl = new Processed2DPlotData[coll.Count], _xincColl = new double[coll.Count], _yincColl = new double[coll.Count] }; paintContext.AddValue(this, paintData); // First prepare int idx = -1; Processed2DPlotData previousPlotData = null; for (int i = 0; i < coll.Count; i++) { if (coll[i] is G2DPlotItem) { idx++; double currxinc = paintData._xincColl[i] = idx * _xinc * _scaleXInc; double curryinc = paintData._yincColl[i] = idx * _yinc * _scaleYInc; G2DPlotItem gpi = coll[i] as G2DPlotItem; Processed2DPlotData plotdata = paintData._plotDataColl[i] = gpi.GetRangesAndPoints(layer); plotdata.PreviousItemData = previousPlotData; previousPlotData = plotdata; int j = -1; foreach (int rowIndex in plotdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant xx = plotdata.GetXPhysical(rowIndex) + currxinc; AltaxoVariant yy = plotdata.GetYPhysical(rowIndex) + curryinc; Logical3D rel = new Logical3D(layer.XAxis.PhysicalVariantToNormal(xx), layer.YAxis.PhysicalVariantToNormal(yy)); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); plotdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } // if clipping is used, we must get a clipping region for every plot item // and combine the regions from if (_useClipping) { if (i == 0) paintData._clippingColl[i] = g.Clip; Plot.Styles.LinePlotStyle linestyle = null; foreach (Plot.Styles.IG2DPlotStyle st in gpi.Style) { if (st is Plot.Styles.LinePlotStyle) { linestyle = st as Plot.Styles.LinePlotStyle; break; } } if (null != linestyle) { GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); linestyle.GetFillPath(path, layer, plotdata, CSPlaneID.Bottom); if ((i + 1) < paintData._clippingColl.Length) { paintData._clippingColl[i + 1] = (Region)paintData._clippingColl[i].Clone(); paintData._clippingColl[i + 1].Exclude(path); } } else { if ((i + 1) < paintData._clippingColl.Length) paintData._clippingColl[i + 1] = paintData._clippingColl[i]; } } } } }
static bool CanUseStyle(IPlotArea layer, PlotItemCollection coll, out Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList) { return AbsoluteStackTransform.CanUseStyle(layer, coll, out plotDataList); }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataDict; if (!CanUseStyle(layer, coll, out plotDataDict)) { CoordinateTransformingStyleBase.Paint(g, layer, coll); return; } AltaxoVariant[] ysumArray = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; ysumArray = AbsoluteStackTransform.AddUp(ysumArray, pdata); } } // now plot the data - the summed up y is in yArray AltaxoVariant[] yArray = null; Processed2DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; yArray = AbsoluteStackTransform.AddUp(yArray, pdata); AltaxoVariant[] localArray = new AltaxoVariant[yArray.Length]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant y = 100*yArray[j]/ysumArray[j]; localArray[j] = y; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(y)); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } // we have also to exchange the accessor for the physical y value and replace it by our own one pdata.YPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate(int i) { return localArray[i]; }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } for (int i = coll.Count - 1; i >= 0; --i) { IGPlotItem pi = coll[i]; if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; gpi.Paint(g, layer, pdata); } else { pi.Paint(g, layer); } } }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { Dictionary <G2DPlotItem, Processed2DPlotData> plotDataDict; if (!CanUseStyle(layer, coll, out plotDataDict)) { CoordinateTransformingStyleBase.Paint(g, layer, coll); return; } AltaxoVariant[] ysumArray = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; ysumArray = AbsoluteStackTransform.AddUp(ysumArray, pdata); } } // now plot the data - the summed up y is in yArray AltaxoVariant[] yArray = null; Processed2DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; yArray = AbsoluteStackTransform.AddUp(yArray, pdata); AltaxoVariant[] localArray = new AltaxoVariant[yArray.Length]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant y = 100 * yArray[j] / ysumArray[j]; localArray[j] = y; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(y)); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } // we have also to exchange the accessor for the physical y value and replace it by our own one pdata.YPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate(int i) { return(localArray[i]); }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } for (int i = coll.Count - 1; i >= 0; --i) { IGPlotItem pi = coll[i]; if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; gpi.Paint(g, layer, pdata); } else { pi.Paint(g, layer); } } }
public void PaintPreprocessing(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll) { var paintData = new CachedPaintData { _clippingColl = new System.Drawing.Region[coll.Count], _plotDataColl = new Processed2DPlotData[coll.Count], _xincColl = new double[coll.Count], _yincColl = new double[coll.Count] }; paintContext.AddValue(this, paintData); // First prepare int idx = -1; Processed2DPlotData previousPlotData = null; for (int i = 0; i < coll.Count; i++) { if (coll[i] is G2DPlotItem) { idx++; double currxinc = paintData._xincColl[i] = idx * _xinc * _scaleXInc; double curryinc = paintData._yincColl[i] = idx * _yinc * _scaleYInc; var gpi = coll[i] as G2DPlotItem; Processed2DPlotData plotdata = paintData._plotDataColl[i] = gpi.GetRangesAndPoints(layer); plotdata.PreviousItemData = previousPlotData; previousPlotData = plotdata; int j = -1; foreach (int rowIndex in plotdata.RangeList.OriginalRowIndices()) { j++; AltaxoVariant xx = plotdata.GetXPhysical(rowIndex) + currxinc; AltaxoVariant yy = plotdata.GetYPhysical(rowIndex) + curryinc; var rel = new Logical3D(layer.XAxis.PhysicalVariantToNormal(xx), layer.YAxis.PhysicalVariantToNormal(yy)); layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out var xabs, out var yabs); plotdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } // if clipping is used, we must get a clipping region for every plot item // and combine the regions from if (_useClipping) { if (i == 0) { paintData._clippingColl[i] = g.Clip; } Plot.Styles.LinePlotStyle linestyle = null; foreach (Plot.Styles.IG2DPlotStyle st in gpi.Style) { if (st is Plot.Styles.LinePlotStyle) { linestyle = st as Plot.Styles.LinePlotStyle; break; } } if (null != linestyle) { var path = new System.Drawing.Drawing2D.GraphicsPath(); linestyle.GetFillPath(path, layer, plotdata, CSPlaneID.Bottom); if ((i + 1) < paintData._clippingColl.Length) { paintData._clippingColl[i + 1] = paintData._clippingColl[i].Clone(); paintData._clippingColl[i + 1].Exclude(path); } } else { if ((i + 1) < paintData._clippingColl.Length) { paintData._clippingColl[i + 1] = paintData._clippingColl[i]; } } } } } }
/// <summary> /// Plots selected data columns of a table. /// </summary> /// <param name="table">The source table.</param> /// <param name="selectedColumns">The data columns of the table that should be plotted.</param> /// <param name="graph">The graph document to plot into.</param> /// <param name="templatePlotStyle">The plot style which is the template for all plot items.</param> /// <param name="groupStyles">The group styles for the newly built plot item collection.</param> public static IGraphController Plot( DataTable table, IAscendingIntegerCollection selectedColumns, GraphDocument graph, G3DPlotStyleCollection templatePlotStyle, PlotGroupStyleCollection groupStyles) { List<IGPlotItem> pilist = CreatePlotItems(table, selectedColumns, templatePlotStyle); // now create a new Graph with this plot associations var gc = Current.ProjectService.CreateNewGraph3D(graph); var layer = gc.Doc.RootLayer.Layers.OfType<XYZPlotLayer>().First(); // Set x and y axes according to the first plot item in the list if (pilist.Count > 0 && (pilist[0] is XYZColumnPlotItem)) { var firstitem = (XYZColumnPlotItem)pilist[0]; if (firstitem.Data.XColumn is TextColumn) layer.Scales[0] = new TextScale(); else if (firstitem.Data.XColumn is DateTimeColumn) layer.Scales[0] = new DateTimeScale(); if (firstitem.Data.YColumn is TextColumn) layer.Scales[1] = new TextScale(); else if (firstitem.Data.YColumn is DateTimeColumn) layer.Scales[1] = new DateTimeScale(); if (firstitem.Data.ZColumn is TextColumn) layer.Scales[2] = new TextScale(); else if (firstitem.Data.ZColumn is DateTimeColumn) layer.Scales[2] = new DateTimeScale(); } PlotItemCollection newPlotGroup = new PlotItemCollection(layer.PlotItems); foreach (IGPlotItem pi in pilist) { newPlotGroup.Add(pi); } if (groupStyles != null) newPlotGroup.GroupStyles = groupStyles; else newPlotGroup.CollectStyles(newPlotGroup.GroupStyles); layer.PlotItems.Add(newPlotGroup); return gc; }
public void PaintChild(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int i) { CachedPaintData paintData = paintContext.GetValue <CachedPaintData>(this); if (_useClipping) { //g.SetClip(clippingColl[i], CombineMode.Replace); g.Clip = paintData._clippingColl[i]; } if (null == paintData._plotDataColl[i]) { coll[i].Paint(g, paintContext, layer, i == coll.Count - 1 ? null : coll[i - 1], i == 0 ? null : coll[i - 1]); } else { var layerwrapper = new TransformedLayerWrapper(layer, paintData._xincColl[i], paintData._yincColl[i]); ((G2DPlotItem)coll[i]).Paint(g, layerwrapper, paintData._plotDataColl[i], i == coll.Count - 1 ? null : paintData._plotDataColl[i + 1], i == 0 ? null : paintData._plotDataColl[i - 1]); } // The clipping region is no longer needed, so we can dispose it if (_useClipping) { if (i == 0) { g.Clip = paintData._clippingColl[0]; // restore the original clipping region } else { paintData._clippingColl[i].Dispose(); // for i!=0 dispose the clipping region } } }
/// <summary> /// Determines whether the plot items in <paramref name="coll"/> can be plotted as stack. Presumption is that all plot items /// have the same number of plot points, and that all items have the same order of x values associated with the plot points. /// </summary> /// <param name="layer">Plot layer.</param> /// <param name="coll">Collection of plot items.</param> /// <param name="plotDataList">Output: dictionary with associates each plot item with a list of processed plot data.</param> /// <returns>Returns <c>true</c> if the plot items in <paramref name="coll"/> can be plotted as stack; otherwise, <c>false</c>.</returns> public static bool CanUseStyle(IPlotArea layer, PlotItemCollection coll, out Dictionary<G3DPlotItem, Processed3DPlotData> plotDataList) { plotDataList = new Dictionary<G3DPlotItem, Processed3DPlotData>(); AltaxoVariant[] xArray = null; AltaxoVariant[] yArray = null; int idx = -1; foreach (IGPlotItem pi in coll) { if (pi is G3DPlotItem) { idx++; G3DPlotItem gpi = (G3DPlotItem)pi; Processed3DPlotData pdata = gpi.GetRangesAndPoints(layer); plotDataList.Add(gpi, pdata); if (xArray == null) { xArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; yArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; xArray[j] = pdata.GetXPhysical(originalIndex); yArray[j] = pdata.GetYPhysical(originalIndex); } } else // this is not the first item { if (pdata.RangeList.PlotPointCount != xArray.Length) return false; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; if (xArray[j] != pdata.GetXPhysical(originalIndex)) return false; if (yArray[j] != pdata.GetYPhysical(originalIndex)) return false; } } } } return idx >= 1; }
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); int idx = 0; foreach (IGPlotItem pi in coll) { if (pi is IYBoundsHolder) { IYBoundsHolder ybpi = (IYBoundsHolder)pi; ybounds.Reset(); ybpi.MergeYBoundsInto(ybounds); ybounds.Shift(_yinc * _scaleYInc * idx); pb.Add(ybounds); } if (pi is G2DPlotItem) idx++; } }
public void PaintChild(IGraphicsContext3D g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int indexOfChild) { var plotDataDict = paintContext.GetValueOrDefault<Dictionary<G3DPlotItem, Processed3DPlotData>>(this); if (null == plotDataDict) // if initializing this dict was not successfull, then make a normal plot { coll[indexOfChild].Paint(g, paintContext, layer, indexOfChild == coll.Count - 1 ? null : coll[indexOfChild + 1], indexOfChild == 0 ? null : coll[indexOfChild - 1]); return; } Processed3DPlotData prevPlotData = null; Processed3DPlotData nextPlotData = null; if ((indexOfChild + 1) < coll.Count && (coll[indexOfChild + 1] is G3DPlotItem)) prevPlotData = plotDataDict[coll[indexOfChild + 1] as G3DPlotItem]; if (indexOfChild > 0 && (coll[indexOfChild - 1] is G3DPlotItem)) nextPlotData = plotDataDict[coll[indexOfChild - 1] as G3DPlotItem]; if (coll[indexOfChild] is G3DPlotItem) { var gpi = coll[indexOfChild] as G3DPlotItem; gpi.Paint(g, layer, plotDataDict[gpi], prevPlotData, nextPlotData); } else { coll[indexOfChild].Paint(g, paintContext, layer, null, null); } }
public void PaintChild(IGraphicsContext3D g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll, int indexOfChild) { var plotDataDict = paintContext.GetValueOrDefault <Dictionary <G3DPlotItem, Processed3DPlotData> >(this); if (null == plotDataDict) // if initializing this dict was not successfull, then make a normal plot { coll[indexOfChild].Paint(g, paintContext, layer, indexOfChild == coll.Count - 1 ? null : coll[indexOfChild + 1], indexOfChild == 0 ? null : coll[indexOfChild - 1]); return; } Processed3DPlotData prevPlotData = null; Processed3DPlotData nextPlotData = null; if ((indexOfChild + 1) < coll.Count && (coll[indexOfChild + 1] is G3DPlotItem)) { prevPlotData = plotDataDict[coll[indexOfChild + 1] as G3DPlotItem]; } if (indexOfChild > 0 && (coll[indexOfChild - 1] is G3DPlotItem)) { nextPlotData = plotDataDict[coll[indexOfChild - 1] as G3DPlotItem]; } if (coll[indexOfChild] is G3DPlotItem) { var gpi = coll[indexOfChild] as G3DPlotItem; gpi.Paint(g, layer, plotDataDict[gpi], prevPlotData, nextPlotData); } else { coll[indexOfChild].Paint(g, paintContext, layer, null, null); } }
public void Paint(System.Drawing.Graphics g, IPlotArea layer, PlotItemCollection coll) { Dictionary <G2DPlotItem, Processed2DPlotData> plotDataDict; if (!CanUseStyle(layer, coll, out plotDataDict)) { CoordinateTransformingStyleBase.Paint(g, layer, coll); return; } AltaxoVariant[] yArray = null; // First, add up all items since we start always with the last item int idx = -1; Processed2DPlotData previousItemData = null; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { idx++; G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; yArray = AddUp(yArray, pdata); if (idx > 0) // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; Logical3D rel = new Logical3D( layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)), layer.YAxis.PhysicalVariantToNormal(yArray[j])); double xabs, yabs; layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out xabs, out yabs); pdata.PlotPointsInAbsoluteLayerCoordinates[j] = new System.Drawing.PointF((float)xabs, (float)yabs); } } // we have also to exchange the accessor for the physical y value and replace it by our own one AltaxoVariant[] localArray = (AltaxoVariant[])yArray.Clone(); pdata.YPhysicalAccessor = new IndexedPhysicalValueAccessor(delegate(int i) { return(localArray[i]); }); pdata.PreviousItemData = previousItemData; previousItemData = pdata; } } for (int i = coll.Count - 1; i >= 0; --i) { IGPlotItem pi = coll[i]; if (pi is G2DPlotItem) { G2DPlotItem gpi = pi as G2DPlotItem; Processed2DPlotData pdata = plotDataDict[gpi]; gpi.Paint(g, layer, pdata); } else { pi.Paint(g, layer); } } }