Esempio n. 1
0
        public void PrepareGroupStyles(PlotGroupStyleCollection externalGroups, PlotGroupStyleCollection localGroups, IPlotArea layer, Processed2DPlotData pdata)
        {
            // first, we have to calculate the span of logical values from the minimum logical value to the maximum logical value
            int numberOfItems = 0;

            if (null != pdata)
            {
                double minLogicalX = double.MaxValue;
                double maxLogicalX = double.MinValue;
                foreach (int originalRowIndex in pdata.RangeList.OriginalRowIndices())
                {
                    numberOfItems++;

                    double logicalX = layer.XAxis.PhysicalVariantToNormal(pdata.GetXPhysical(originalRowIndex));
                    if (logicalX < minLogicalX)
                    {
                        minLogicalX = logicalX;
                    }
                    if (logicalX > maxLogicalX)
                    {
                        maxLogicalX = logicalX;
                    }
                }

                BarSizePosition2DGroupStyle.IntendToApply(externalGroups, localGroups, numberOfItems, minLogicalX, maxLogicalX);
            }
            BarSizePosition2DGroupStyle bwp = PlotGroupStyle.GetStyleToInitialize <BarSizePosition2DGroupStyle>(externalGroups, localGroups);

            if (null != bwp)
            {
                bwp.Initialize(_relInnerGapX, _relOuterGapX);
            }

            if (!_independentFillColor && null != _fillBrush)
            {
                ColorGroupStyle.PrepareStyle(externalGroups, localGroups, delegate()
                                             { return(_fillBrush.Color); });
            }
            else if (!_independentFrameColor && null != _framePen) // else if is used here because fill color has precedence over frame color
            {
                ColorGroupStyle.PrepareStyle(externalGroups, localGroups, delegate()
                                             { return(_framePen.Color); });
            }
        }
Esempio n. 2
0
        public void ApplyGroupStyles(PlotGroupStyleCollection externalGroups, PlotGroupStyleCollection localGroups)
        {
            _cachedColorForIndexFunction = null;

            BarSizePosition2DGroupStyle bwp = PlotGroupStyle.GetStyleToApply <BarSizePosition2DGroupStyle>(externalGroups, localGroups);

            if (null != bwp)
            {
                bwp.Apply(out _relInnerGapX, out _relOuterGapX, out _xSizeLogical, out _xOffsetLogical);
            }

            if (!_independentFillColor)
            {
                if (null == _fillBrush)
                {
                    _fillBrush = new BrushX(Drawing.ColorManagement.ColorSetManager.Instance.BuiltinDarkPlotColors[0]);
                }
                ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate(NamedColor c)
                                           { _fillBrush.Color = c; });

                // but if there is a color evaluation function, then use that function with higher priority
                VariableColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate(Func <int, Color> evalFunc)
                                                   { _cachedColorForIndexFunction = evalFunc; });
            }

            if (!_independentFrameColor)
            {
                if (null == _framePen)
                {
                    _framePen = new PenX(Drawing.ColorManagement.ColorSetManager.Instance.BuiltinDarkPlotColors[0]);
                }
                ColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate(NamedColor c)
                                           { _framePen.Color = c; });

                // but if there is a color evaluation function, then use that function with higher priority
                VariableColorGroupStyle.ApplyStyle(externalGroups, localGroups, delegate(Func <int, Color> evalFunc)
                                                   { _cachedColorForIndexFunction = evalFunc; });
            }
        }
Esempio n. 3
0
 public void CollectLocalGroupStyles(PlotGroupStyleCollection externalGroups, PlotGroupStyleCollection localGroups)
 {
     BarSizePosition2DGroupStyle.AddLocalGroupStyle(externalGroups, localGroups);
 }
Esempio n. 4
0
 public void CollectExternalGroupStyles(PlotGroupStyleCollection externalGroups)
 {
     BarSizePosition2DGroupStyle.AddExternalGroupStyle(externalGroups);
 }