Esempio n. 1
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="TextScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="TextScale" /></param>
 public TextScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
Esempio n. 2
0
        internal static void PickScale( GraphPane pane, Graphics g, float scaleFactor, Scale scale )
        {
            // Test for trivial condition of range = 0 and pick a suitable default
            if ( scale._max - scale._min < 1.0 )
            {
                if ( scale._maxAuto )
                    scale._max = scale._min + 0.5;
                else
                    scale._min = scale._max - 0.5;
            }
            else
            {
                // Calculate the new step size
                if ( scale._majorStepAuto )
                {
                    // Calculate the step size based on targetSteps
                    scale._majorStep = Scale.CalcStepSize( scale._max - scale._min,
                        ( scale._ownerAxis is XAxis || scale._ownerAxis is X2Axis ) ?
                                Default.TargetXSteps : Default.TargetYSteps );

                    if ( scale.IsPreventLabelOverlap )
                    {
                        // Calculate the maximum number of labels
                        double maxLabels = (double) scale.CalcMaxLabels( g, pane, scaleFactor );

                        // Calculate a step size based on the width of the labels
                        double tmpStep = Math.Ceiling( ( scale._max - scale._min ) / maxLabels );

                        // Use the greater of the two step sizes
                        if ( tmpStep > scale._majorStep )
                            scale._majorStep = tmpStep;
                    }

                }

                scale._majorStep = (int)scale._majorStep;
                if ( scale._majorStep < 1.0 )
                    scale._majorStep = 1.0;

                // Calculate the new minor step size
                if ( scale._minorStepAuto )
                    scale._minorStep = Scale.CalcStepSize( scale._majorStep,
                        ( scale._ownerAxis is XAxis || scale._ownerAxis is X2Axis ) ?
                                Default.TargetMinorXSteps : Default.TargetMinorYSteps );

                if ( scale._minAuto )
                    scale._min -= 0.5;
                if ( scale._maxAuto )
                    scale._max += 0.5;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="OrdinalScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="OrdinalScale" /></param>
 public OrdinalScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
Esempio n. 4
0
        /// <summary>
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected Axis( SerializationInfo info, StreamingContext context )
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32( "schema" );

            _cross = info.GetDouble( "cross" );
            _crossAuto = info.GetBoolean( "crossAuto" );

            _majorTic = (MajorTic)info.GetValue( "MajorTic", typeof( MajorTic ) );
            _minorTic = (MinorTic)info.GetValue( "MinorTic", typeof( MinorTic ) );
            _majorGrid = (MajorGrid)info.GetValue( "majorGrid", typeof( MajorGrid ) );
            _minorGrid = (MinorGrid)info.GetValue( "minorGrid", typeof( MinorGrid ) );

            _isVisible = info.GetBoolean( "isVisible" );

            _title = (AxisLabel) info.GetValue( "title", typeof( AxisLabel ) );

            _minSpace = info.GetSingle( "minSpace" );

            _color = (Color)info.GetValue( "color", typeof( Color ) );

            _isAxisSegmentVisible = info.GetBoolean( "isAxisSegmentVisible" );

            _axisGap = info.GetSingle( "axisGap" );

            _scale = (Scale)info.GetValue( "scale", typeof( Scale ) );
            _scale._ownerAxis = this;
        }
Esempio n. 5
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="ExponentScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="ExponentScale" /></param>
 public ExponentScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
Esempio n. 6
0
        /// <summary>
        /// Default constructor for <see cref="Axis"/> that sets all axis properties
        /// to default values as defined in the <see cref="Default"/> class.
        /// </summary>
        public Axis()
        {
            _scale = new LinearScale( this );

            _cross = 0.0;

            _crossAuto = true;

            _majorTic = new MajorTic();
            _minorTic = new MinorTic();

            _majorGrid = new MajorGrid();
            _minorGrid = new MinorGrid();

            _axisGap = Default.AxisGap;

            _minSpace = Default.MinSpace;
            _isVisible = true;

            _isAxisSegmentVisible = Default.IsAxisSegmentVisible;

            _title = new AxisLabel( "", Default.TitleFontFamily, Default.TitleFontSize,
                    Default.TitleFontColor, Default.TitleFontBold,
                    Default.TitleFontUnderline, Default.TitleFontItalic );
            _title.FontSpec.Fill = new Fill( Default.TitleFillColor, Default.TitleFillBrush,
                    Default.TitleFillType );

            _title.FontSpec.Border.IsVisible = false;

            _color = Default.Color;
        }
Esempio n. 7
0
        /// <summary>
        /// The Copy Constructor.
        /// </summary>
        /// <param name="rhs">The Axis object from which to copy</param>
        public Axis( Axis rhs )
        {
            _scale = rhs._scale.Clone( this );

            _cross = rhs._cross;

            _crossAuto = rhs._crossAuto;

            _majorTic = rhs.MajorTic.Clone();
            _minorTic = rhs.MinorTic.Clone();

            _majorGrid = rhs._majorGrid.Clone();
            _minorGrid = rhs._minorGrid.Clone();

            _isVisible = rhs.IsVisible;

            _isAxisSegmentVisible = rhs._isAxisSegmentVisible;

            _title = (AxisLabel) rhs.Title.Clone();

            _axisGap = rhs._axisGap;

            _minSpace = rhs.MinSpace;

            _color = rhs.Color;
        }
Esempio n. 8
0
        /// <summary>
        /// Copy Constructor.  Create a new <see cref="Scale" /> object based on the specified
        /// existing one.
        /// </summary>
        /// <param name="rhs">The <see cref="Scale" /> object to be copied.</param>
        /// <param name="owner">The <see cref="Axis" /> object that will own the
        /// new instance of <see cref="Scale" /></param>
        public Scale( Scale rhs, Axis owner )
        {
            _ownerAxis = owner;

            _min = rhs._min;
            _max = rhs._max;
            _majorStep = rhs._majorStep;
            _minorStep = rhs._minorStep;
            _exponent = rhs._exponent;
            _baseTic = rhs._baseTic;

            _minAuto = rhs._minAuto;
            _maxAuto = rhs._maxAuto;
            _majorStepAuto = rhs._majorStepAuto;
            _minorStepAuto = rhs._minorStepAuto;
            _magAuto = rhs._magAuto;
            _formatAuto = rhs._formatAuto;

            _minGrace = rhs._minGrace;
            _maxGrace = rhs._maxGrace;

            _mag = rhs._mag;

            _isUseTenPower = rhs._isUseTenPower;
            _isReverse = rhs._isReverse;
            _isPreventLabelOverlap = rhs._isPreventLabelOverlap;
            _isVisible = rhs._isVisible;
            _isSkipFirstLabel = rhs._isSkipFirstLabel;
            _isSkipLastLabel = rhs._isSkipLastLabel;
            _isSkipCrossLabel = rhs._isSkipCrossLabel;

            _majorUnit = rhs._majorUnit;
            _minorUnit = rhs._minorUnit;

            _format = rhs._format;

            _isLabelsInside = rhs._isLabelsInside;
            _align = rhs._align;
            _alignH = rhs._alignH;

            _fontSpec = (FontSpec) rhs._fontSpec.Clone();

            _labelGap = rhs._labelGap;

            if ( rhs._textLabels != null )
                _textLabels = (string[])rhs._textLabels.Clone();
            else
                _textLabels = null;
        }
Esempio n. 9
0
 /*
 /// <summary>
 /// Implement the <see cref="ICloneable" /> interface in a typesafe manner by just
 /// calling the typed version of Clone />
 /// </summary>
 /// <remarks>
 /// Note that this method must be called with an explicit cast to ICloneable, and
 /// that it is inherently virtual.  For example:
 /// <code>
 /// ParentClass foo = new ChildClass();
 /// ChildClass bar = (ChildClass) ((ICloneable)foo).Clone();
 /// </code>
 /// Assume that ChildClass is inherited from ParentClass.  Even though foo is declared with
 /// ParentClass, it is actually an instance of ChildClass.  Calling the ICloneable implementation
 /// of Clone() on foo actually calls ChildClass.Clone() as if it were a virtual function.
 /// </remarks>
 /// <returns>A deep copy of this object</returns>
 object ICloneable.Clone()
 {
     throw new NotImplementedException( "Can't clone an abstract base type -- child types must implement ICloneable" );
     //return new PaneBase( this );
 }
 */
 /// <summary>
 /// A construction method that creates a new <see cref="Scale"/> object using the
 /// properties of an existing <see cref="Scale"/> object, but specifying a new
 /// <see cref="AxisType"/>.
 /// </summary>
 /// <remarks>
 /// This constructor is used to change the type of an existing <see cref="Axis" />.
 /// By specifying the old <see cref="Scale"/> object, you are giving a set of properties
 /// (which encompasses all fields associated with the scale, since the derived types
 /// have no fields) to be used in creating a new <see cref="Scale"/> object, only this
 /// time having the newly specified object type.</remarks>
 /// <param name="oldScale">The existing <see cref="Scale" /> object from which to
 /// copy the field data.</param>
 /// <param name="type">An <see cref="AxisType"/> representing the type of derived type
 /// of new <see cref="Scale" /> object to create.</param>
 /// <returns>The new <see cref="Scale"/> object.</returns>
 public Scale MakeNewScale( Scale oldScale, AxisType type )
 {
     switch ( type )
     {
         case AxisType.Linear:
             return new LinearScale( oldScale, _ownerAxis );
         case AxisType.Date:
             return new DateScale( oldScale, _ownerAxis );
         case AxisType.Log:
             return new LogScale( oldScale, _ownerAxis );
         case AxisType.Exponent:
             return new ExponentScale( oldScale, _ownerAxis );
         case AxisType.Ordinal:
             return new OrdinalScale( oldScale, _ownerAxis );
         case AxisType.Text:
             return new TextScale( oldScale, _ownerAxis );
         case AxisType.DateAsOrdinal:
             return new DateAsOrdinalScale( oldScale, _ownerAxis );
         case AxisType.LinearAsOrdinal:
             return new LinearAsOrdinalScale( oldScale, _ownerAxis );
         default:
             throw new Exception( "Implementation Error: Invalid AxisType" );
     }
 }
Esempio n. 10
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="LinearScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="LinearScale" /></param>
 public LinearScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
Esempio n. 11
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="LinearAsOrdinalScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="LinearAsOrdinalScale" /></param>
 public LinearAsOrdinalScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
Esempio n. 12
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="LogScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="LogScale" /></param>
 public LogScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }