Esempio n. 1
0
        /// <summary>
        /// Creates a default axis style.
        /// </summary>
        public AxisLineStyle(Main.Properties.IReadOnlyPropertyBag context)
        {
            double penWidth        = GraphDocument.GetDefaultPenWidth(context);
            double majorTickLength = GraphDocument.GetDefaultMajorTickLength(context);
            var    color           = GraphDocument.GetDefaultForeColor(context);

            _axisPen = new PenX(color, penWidth)
            {
                ParentObject = this
            };
            _majorTickPen = new PenX(color, penWidth)
            {
                ParentObject = this
            };
            _minorTickPen = new PenX(color, penWidth)
            {
                ParentObject = this
            };
            _majorTickLength         = majorTickLength;
            _minorTickLength         = majorTickLength / 2;
            _showFirstUpMajorTicks   = true; // true if right major ticks should be visible
            _showFirstDownMajorTicks = true; // true if left major ticks should be visible
            _showFirstUpMinorTicks   = true; // true if right minor ticks should be visible
            _showFirstDownMinorTicks = true; // true if left minor ticks should be visible
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a default axis style.
        /// </summary>
        public AxisLineStyle(bool showTicks, CSAxisSide preferredTickSide, Main.Properties.IReadOnlyPropertyBag context)
        {
            double penWidth        = GraphDocument.GetDefaultPenWidth(context);
            double majorTickLength = GraphDocument.GetDefaultMajorTickLength(context);
            var    color           = GraphDocument.GetDefaultForeColor(context);

            _axisPen         = new PenX3D(color, penWidth);
            _majorTickPen    = new PenX3D(color, penWidth);
            _minorTickPen    = new PenX3D(color, penWidth);
            _majorTickLength = majorTickLength;
            _minorTickLength = majorTickLength / 2;

            if (showTicks)
            {
                _showFirstUpMajorTicks    = preferredTickSide == CSAxisSide.FirstUp;
                _showFirstDownMajorTicks  = preferredTickSide == CSAxisSide.FirstDown;
                _showSecondUpMajorTicks   = preferredTickSide == CSAxisSide.SecondUp;
                _showSecondDownMajorTicks = preferredTickSide == CSAxisSide.SecondDown;

                _showFirstUpMinorTicks    = preferredTickSide == CSAxisSide.FirstUp;
                _showFirstDownMinorTicks  = preferredTickSide == CSAxisSide.FirstDown;
                _showSecondUpMinorTicks   = preferredTickSide == CSAxisSide.SecondUp;
                _showSecondDownMinorTicks = preferredTickSide == CSAxisSide.SecondDown;
            }
        }
Esempio n. 3
0
 public FloatingScale(Main.Properties.IReadOnlyPropertyBag context)
     : base(new ItemLocationDirectAutoSize())
 {
     _scaleSpanValue = 0.25;
     _tickSpacing    = new SpanTickSpacing();
     _axisStyle      = new AxisStyle(new CSLineID(0, 0), true, false, true, null, context);
 }
Esempio n. 4
0
        public DensityImageLegend(DensityImagePlotItem plotItem, Main.IDocumentNode futureParentObject, PointD2D initialLocation, PointD2D graphicSize, Main.Properties.IReadOnlyPropertyBag context)
            : base(new ItemLocationDirect())
        {
            if (null == plotItem)
            {
                throw new ArgumentNullException("plotItem");
            }
            if (null == futureParentObject)
            {
                throw new ArgumentNullException("futureParentObject");
            }

            ParentObject = futureParentObject;
            PlotItem     = plotItem;
            if (null == _plotItemProxy.DocumentPath)
            {
                throw new ArgumentException("No path could be found between plotItem and futureParentObject. This is an indication that one of the objects is not rooted.");
            }

            SetSize(graphicSize.X, graphicSize.Y, Main.EventFiring.Suppressed);
            SetPosition(initialLocation, Main.EventFiring.Suppressed);

            // _orientationIsVertical = true;
            // _scaleIsReversed = false;

            var cachedScale      = (NumericalScale)PlotItem.Style.Scale.Clone();
            var scaleTickSpacing = Altaxo.Graph.Scales.Scale.CreateDefaultTicks(cachedScale.GetType());

            _cachedArea = new DensityLegendArea(Size, true, false, cachedScale, scaleTickSpacing);
            //_cachedArea.ParentObject = this; // --> moved to the end of this function

            _axisStyles = new AxisStyleCollection();
            _axisStyles.UpdateCoordinateSystem(_cachedArea.CoordinateSystem);
            // _axisStyles.ParentObject = this; --> see below

            var sx0 = new AxisStyle(CSLineID.X0, true, true, false, "Z values", context);

            sx0.AxisLineStyle.FirstDownMajorTicks = true;
            sx0.AxisLineStyle.FirstUpMajorTicks   = false;
            sx0.AxisLineStyle.FirstDownMinorTicks = true;
            sx0.AxisLineStyle.FirstUpMinorTicks   = false;

            var sx1 = new AxisStyle(CSLineID.X1, true, false, false, null, context);

            sx1.AxisLineStyle.FirstDownMajorTicks = false;
            sx1.AxisLineStyle.FirstUpMajorTicks   = false;
            sx1.AxisLineStyle.FirstDownMinorTicks = false;
            sx1.AxisLineStyle.FirstUpMinorTicks   = false;

            var sy0 = new AxisStyle(CSLineID.Y0, true, false, false, "Color map", context);
            var sy1 = new AxisStyle(CSLineID.Y1, true, false, false, null, context);

            _axisStyles.Add(sx0);
            _axisStyles.Add(sx1);
            _axisStyles.Add(sy0);
            _axisStyles.Add(sy1);

            sx0.Title.Rotation = 90;
            sx0.Title.Location.ParentAnchorX = RADouble.NewRel(0);   // Left
            sx0.Title.Location.ParentAnchorY = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sx0.Title.X = -Width / 3;
            sx0.Title.Y = 0;

            sy0.Title.Location.ParentAnchorX = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.ParentAnchorY = RADouble.NewRel(0);   // Top
            sy0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sy0.Title.X = 0;
            sy0.Title.Y = sy0.Title.Height / 2;

            // set the parent objects
            _axisStyles.ParentObject = this;
            _cachedArea.ParentObject = this;
            UpdateTransformationMatrix();
        }