示例#1
0
        public void PaintPreprocessing(System.Drawing.Graphics g, IPaintContext paintContext, IPlotArea layer, PlotItemCollection coll)
        {
            if (!CanUseStyle(layer, coll, out var plotDataDict))
            {
                return;
            }
            else
            {
                paintContext.AddValue(this, plotDataDict);
            }

            AltaxoVariant[] ysumArray = null;
            foreach (IGPlotItem pi in coll)
            {
                if (pi is G2DPlotItem)
                {
                    var 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)
                {
                    var gpi = pi as G2DPlotItem;
                    Processed2DPlotData pdata = plotDataDict[gpi];
                    yArray = AbsoluteStackTransform.AddUp(yArray, pdata);
                    var 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;

                        var rel = new Logical3D(
                            layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalIndex)),
                            layer.YAxis.PhysicalVariantToNormal(y));
                        layer.CoordinateSystem.LogicalToLayerCoordinates(rel, out var xabs, out var 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;
                }
            }
        }
 public AbsoluteStackTransform(AbsoluteStackTransform from)
 {
 }
示例#3
0
 public AbsoluteStackTransform(AbsoluteStackTransform from)
 {
 }
示例#4
0
 private static bool CanUseStyle(IPlotArea layer, PlotItemCollection coll, out Dictionary <G2DPlotItem, Processed2DPlotData> plotDataList)
 {
     return(AbsoluteStackTransform.CanUseStyle(layer, coll, out plotDataList));
 }
示例#5
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                AbsoluteStackTransform s = null != o ? (AbsoluteStackTransform)o : new AbsoluteStackTransform();

                return(s);
            }