示例#1
0
        /// <summary>
        /// Construct a <see cref="ScaleState"/> from the specified <see cref="Axis"/>
        /// </summary>
        /// <param name="axis">The <see cref="Axis"/> from which to collect the scale
        /// range settings.</param>
        public ScaleState( Axis axis )
        {
            _min = axis._scale._min;
            _minorStep = axis._scale._minorStep;
            _majorStep = axis._scale._majorStep;
            _max = axis._scale._max;
            _majorUnit = axis._scale._majorUnit;
            _minorUnit = axis._scale._minorUnit;

            _format = axis._scale._format;
            _mag = axis._scale._mag;
            //this.numDec = axis.NumDec;

            _minAuto = axis._scale._minAuto;
            _majorStepAuto = axis._scale._majorStepAuto;
            _minorStepAuto = axis._scale._minorStepAuto;
            _maxAuto = axis._scale._maxAuto;

            _formatAuto = axis._scale._formatAuto;
            _magAuto = axis._scale._magAuto;
        }
示例#2
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;
        }
示例#3
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)
 {
 }
示例#4
0
 /// <summary>
 /// Create a new clone of the current item, with a new owner assignment
 /// </summary>
 /// <param name="owner">The new <see cref="Axis" /> instance that will be
 /// the owner of the new Scale</param>
 /// <returns>A new <see cref="Scale" /> clone.</returns>
 public override Scale Clone( Axis owner )
 {
     return new LinearScale( this, owner );
 }
示例#5
0
 public TextScale( Axis owner )
     : base(owner)
 {
 }
示例#6
0
        private void SetSpace( Axis axis, float clientSize, ref float spaceNorm, ref float spaceAlt )
        {
            //spaceNorm = 0;
            //spaceAlt = 0;

            float crossFrac = axis.CalcCrossFraction( this );
            float crossPix = crossFrac * ( 1 + crossFrac ) * ( 1 + crossFrac * crossFrac ) * clientSize;

            if ( !axis.IsPrimary( this ) && axis.IsCrossShifted( this ) )
                axis._tmpSpace = 0;

            if ( axis._tmpSpace < crossPix )
                axis._tmpSpace = 0;
            else if ( crossPix > 0 )
                axis._tmpSpace -= crossPix;

            if ( axis._scale._isLabelsInside && ( axis.IsPrimary( this ) || ( crossFrac != 0.0 && crossFrac != 1.0 ) ) )
                spaceAlt = axis._tmpSpace;
            else
                spaceNorm = axis._tmpSpace;
        }
示例#7
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="DateScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="DateScale" /></param>
 public DateScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
示例#8
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="DateAsOrdinalScale" /> object from which to copy</param>
 /// <param name="owner">The <see cref="Axis" /> object that will own the
 /// new instance of <see cref="DateAsOrdinalScale" /></param>
 public DateAsOrdinalScale( Scale rhs, Axis owner )
     : base(rhs, owner)
 {
 }
示例#9
0
        /// <summary>
        /// Setup some temporary transform values in preparation for rendering the
        /// <see cref="Axis"/>.
        /// </summary>
        /// <remarks>
        /// This method is typically called by the parent <see cref="GraphPane"/>
        /// object as part of the <see cref="GraphPane.Draw"/> method.  It is also
        /// called by <see cref="GraphPane.GeneralTransform(double,double,CoordType)"/> and
        /// <see cref="GraphPane.ReverseTransform( PointF, out double, out double )"/>
        /// methods to setup for coordinate transformations.
        /// </remarks>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="axis">
        /// The parent <see cref="Axis" /> for this <see cref="Scale" />
        /// </param>
        public virtual void SetupScaleData( GraphPane pane, Axis axis )
        {
            // save the ChartRect data for transforming scale values to pixels
            if ( axis is XAxis || axis is X2Axis )
            {
                _minPix = pane.Chart._rect.Left;
                _maxPix = pane.Chart._rect.Right;
            }
            else
            {
                _minPix = pane.Chart._rect.Top;
                _maxPix = pane.Chart._rect.Bottom;
            }

            _minLinTemp = Linearize( _min );
            _maxLinTemp = Linearize( _max );
        }
示例#10
0
 /// <summary>
 /// Create a new clone of the current item, with a new owner assignment
 /// </summary>
 /// <param name="owner">The new <see cref="Axis" /> instance that will be
 /// the owner of the new Scale</param>
 /// <returns>A new <see cref="Scale" /> clone.</returns>
 public abstract Scale Clone( Axis owner );
示例#11
0
        /// <summary>
        /// Draw all the <see cref="JapaneseCandleStick"/>'s to the specified <see cref="Graphics"/>
        /// device as a candlestick at each defined point.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="curve">A <see cref="JapaneseCandleStickItem"/> object representing the
        /// <see cref="JapaneseCandleStick"/>'s to be drawn.</param>
        /// <param name="baseAxis">The <see cref="Axis"/> class instance that defines the base (independent)
        /// axis for the <see cref="JapaneseCandleStick"/></param>
        /// <param name="valueAxis">The <see cref="Axis"/> class instance that defines the value (dependent)
        /// axis for the <see cref="JapaneseCandleStick"/></param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public void Draw( Graphics g, GraphPane pane, JapaneseCandleStickItem curve,
							Axis baseAxis, Axis valueAxis, float scaleFactor )
        {
            //ValueHandler valueHandler = new ValueHandler( pane, false );

            float pixBase, pixHigh, pixLow, pixOpen, pixClose;

            if ( curve.Points != null )
            {
                //float halfSize = _size * scaleFactor;
                float halfSize = GetBarWidth( pane, baseAxis, scaleFactor );

                Color tColor = _color;
                Color tFallingColor = _fallingColor;
                float tPenWidth = _width;
                Fill tRisingFill = _risingFill;
                Fill tFallingFill = _fallingFill;
                Border tRisingBorder = _risingBorder;
                Border tFallingBorder = _fallingBorder;
                if ( curve.IsSelected )
                {
                    tColor = Selection.Border.Color;
                    tFallingColor = Selection.Border.Color;
                    tPenWidth = Selection.Border.Width;
                    tRisingFill = Selection.Fill;
                    tFallingFill = Selection.Fill;
                    tRisingBorder = Selection.Border;
                    tFallingBorder = Selection.Border;

                }

                using ( Pen risingPen = new Pen(  tColor, tPenWidth ) )
                using ( Pen fallingPen = new Pen( tFallingColor, tPenWidth ) )
                {
                    // Loop over each defined point
                    for ( int i = 0; i < curve.Points.Count; i++ )
                    {
                        PointPair pt = curve.Points[i];
                        double date = pt.X;
                        double high = pt.Y;
                        double low = pt.Z;
                        double open = PointPair.Missing;
                        double close = PointPair.Missing;
                        if ( pt is StockPt )
                        {
                            open = ( pt as StockPt ).Open;
                            close = ( pt as StockPt ).Close;
                        }

                        // Any value set to double max is invalid and should be skipped
                        // This is used for calculated values that are out of range, divide
                        //   by zero, etc.
                        // Also, any value <= zero on a log scale is invalid

                        if ( !curve.Points[i].IsInvalid3D &&
                                ( date > 0 || !baseAxis._scale.IsLog ) &&
                                ( ( high > 0 && low > 0 ) || !valueAxis._scale.IsLog ) )
                        {
                            pixBase = (int) ( baseAxis.Scale.Transform( curve.IsOverrideOrdinal, i, date ) + 0.5 );
                            //pixBase = baseAxis.Scale.Transform( curve.IsOverrideOrdinal, i, date );
                            pixHigh = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, high );
                            pixLow = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, low );
                            if ( PointPair.IsValueInvalid( open ) )
                                pixOpen = Single.MaxValue;
                            else
                                pixOpen = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, open );

                            if ( PointPair.IsValueInvalid( close ) )
                                pixClose = Single.MaxValue;
                            else
                                pixClose = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, close );

                            if ( !curve.IsSelected && this._gradientFill.IsGradientValueType )
                            {
                                using ( Pen tPen = GetPen( pane, scaleFactor, pt ) )
                                    Draw( g, pane, baseAxis is XAxis || baseAxis is X2Axis,
                                        pixBase, pixHigh, pixLow, pixOpen,
                                        pixClose, halfSize, scaleFactor,
                                        ( tPen ),
                                        ( close > open ? tRisingFill : tFallingFill ),
                                        ( close > open ? tRisingBorder : tFallingBorder ), pt );
                            }
                            else
                                Draw( g, pane, baseAxis is XAxis || baseAxis is X2Axis,
                                    pixBase, pixHigh, pixLow, pixOpen,
                                    pixClose, halfSize, scaleFactor,
                                    ( close > open ? risingPen : fallingPen ),
                                    ( close > open ? tRisingFill : tFallingFill ),
                                    ( close > open ? tRisingBorder : tFallingBorder ), pt );
                        }
                    }
                }
            }
        }
示例#12
0
        /// <summary>
        /// Determine the minimum increment between individual points to be used for
        /// calculating a bar size that fits without overlapping
        /// </summary>
        /// <param name="list">The <see cref="IPointList" /> list of points for the bar
        /// of interest</param>
        /// <param name="baseAxis">The base axis for the bar</param>
        /// <returns>The minimum increment between bars along the base axis</returns>
        internal static double GetMinStepSize( IPointList list, Axis baseAxis )
        {
            double minStep = Double.MaxValue;

            if ( list.Count <= 0 || baseAxis._scale.IsAnyOrdinal )
                return 1.0;

            PointPair lastPt = list[0];
            for ( int i = 1; i < list.Count; i++ )
            {
                PointPair pt = list[i];
                if ( !pt.IsInvalid || !lastPt.IsInvalid )
                {
                    double step;
                    if ( baseAxis is XAxis || baseAxis is X2Axis )
                        step = pt.X - lastPt.X;
                    else
                        step = pt.Y - lastPt.Y;

                    if ( step > 0 && step < minStep )
                        minStep = step;
                }

                lastPt = pt;
            }

            double range = baseAxis.Scale._maxLinearized - baseAxis.Scale._minLinearized;
            if ( range <= 0 )
                minStep = 1.0;
            else if ( minStep <= 0 || minStep < 0.001 * range || minStep > range )
                minStep = 0.1 * range;

            return minStep;
        }
示例#13
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)
 {
 }
示例#14
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public ExponentScale( Axis owner )
     : base(owner)
 {
 }
示例#15
0
        /// <summary>
        /// Setup some temporary transform values in preparation for rendering the <see cref="Axis"/>.
        /// </summary>
        /// <remarks>
        /// This method is typically called by the parent <see cref="GraphPane"/>
        /// object as part of the <see cref="GraphPane.Draw"/> method.  It is also
        /// called by <see cref="GraphPane.GeneralTransform(double,double,CoordType)"/> and
        /// <see cref="GraphPane.ReverseTransform( PointF, out double, out double )"/>
        /// methods to setup for coordinate transformations.
        /// </remarks>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="axis">
        /// The parent <see cref="Axis" /> for this <see cref="Scale" />
        /// </param>
        public override void SetupScaleData( GraphPane pane, Axis axis )
        {
            base.SetupScaleData( pane, axis );

            if (  _exponent > 0 )
            {
                _minLinTemp = Linearize( _min );
                _maxLinTemp = Linearize( _max );
            }
            else if ( _exponent < 0 )
            {
                _minLinTemp = Linearize( _max );
                _maxLinTemp = Linearize( _min );
            }
        }
示例#16
0
 /// <summary>
 /// Create a new clone of the current item, with a new owner assignment
 /// </summary>
 /// <param name="owner">The new <see cref="Axis" /> instance that will be
 /// the owner of the new Scale</param>
 /// <returns>A new <see cref="Scale" /> clone.</returns>
 public override Scale Clone( Axis owner )
 {
     return new DateAsOrdinalScale( this, owner );
 }
示例#17
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public DateAsOrdinalScale( Axis owner )
     : base(owner)
 {
 }
示例#18
0
        /// <summary>
        /// Basic constructor -- requires that the <see cref="Scale" /> object be intialized with
        /// a pre-existing owner <see cref="Axis" />.
        /// </summary>
        /// <param name="ownerAxis">The <see cref="Axis" /> object that is the owner of this
        /// <see cref="Scale" /> instance.</param>
        public Scale( Axis ownerAxis )
        {
            _ownerAxis = ownerAxis;

            _min = 0.0;
            _max = 1.0;
            _majorStep = 0.1;
            _minorStep = 0.1;
            _exponent = 1.0;
            _mag = 0;
            _baseTic = PointPair.Missing;

            _minGrace = Default.MinGrace;
            _maxGrace = Default.MaxGrace;

            _minAuto = true;
            _maxAuto = true;
            _majorStepAuto = true;
            _minorStepAuto = true;
            _magAuto = true;
            _formatAuto = true;

            _isReverse = Default.IsReverse;
            _isUseTenPower = true;
            _isPreventLabelOverlap = true;
            _isVisible = true;
            _isSkipFirstLabel = false;
            _isSkipLastLabel = false;
            _isSkipCrossLabel = false;

            _majorUnit = DateUnit.Day;
            _minorUnit = DateUnit.Day;

            _format = null;
            _textLabels = null;

            _isLabelsInside = Default.IsLabelsInside;
            _align = Default.Align;
            _alignH = Default.AlignH;

            _fontSpec = new FontSpec(
                Default.FontFamily, Default.FontSize,
                Default.FontColor, Default.FontBold,
                Default.FontUnderline, Default.FontItalic,
                Default.FillColor, Default.FillBrush,
                Default.FillType );

            _fontSpec.Border.IsVisible = false;
            _labelGap = Default.LabelGap;
        }
示例#19
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public DateScale( Axis owner )
     : base(owner)
 {
 }
示例#20
0
        /// <summary>
        /// Define suitable default ranges for an axis in the event that
        /// no data were available
        /// </summary>
        /// <param name="pane">The <see cref="GraphPane"/> of interest</param>
        /// <param name="axis">The <see cref="Axis"/> for which to set the range</param>
        internal void SetRange( GraphPane pane, Axis axis )
        {
            if ( _rangeMin >= Double.MaxValue || _rangeMax <= Double.MinValue )
            {
                // If this is a Y axis, and the main Y axis is valid, use it for defaults
                if ( axis != pane.XAxis && axis != pane.X2Axis &&
                    pane.YAxis.Scale._rangeMin < double.MaxValue && pane.YAxis.Scale._rangeMax > double.MinValue )
                {
                    _rangeMin = pane.YAxis.Scale._rangeMin;
                    _rangeMax = pane.YAxis.Scale._rangeMax;
                }
                // Otherwise, if this is a Y axis, and the main Y2 axis is valid, use it for defaults
                else if ( axis != pane.XAxis && axis != pane.X2Axis &&
                    pane.Y2Axis.Scale._rangeMin < double.MaxValue && pane.Y2Axis.Scale._rangeMax > double.MinValue )
                {
                    _rangeMin = pane.Y2Axis.Scale._rangeMin;
                    _rangeMax = pane.Y2Axis.Scale._rangeMax;
                }
                // Otherwise, just use 0 and 1
                else
                {
                    _rangeMin = 0;
                    _rangeMax = 1;
                }

            }
        }
示例#21
0
 private void ForceNumTics( Axis axis, int numTics )
 {
     if ( axis._scale.MaxAuto )
     {
         int nTics = axis._scale.CalcNumTics();
         if ( nTics < numTics )
             axis._scale._maxLinearized += axis._scale._majorStep * ( numTics - nTics );
     }
 }
示例#22
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;
        }
示例#23
0
 /// <summary>
 /// Create a new clone of the current item, with a new owner assignment
 /// </summary>
 /// <param name="owner">The new <see cref="Axis" /> instance that will be
 /// the owner of the new Scale</param>
 /// <returns>A new <see cref="Scale" /> clone.</returns>
 public override Scale Clone( Axis owner )
 {
     return new TextScale( this, owner );
 }
示例#24
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public OrdinalScale( Axis owner )
     : base(owner)
 {
 }
示例#25
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)
 {
 }
示例#26
0
        /// <summary>
        /// Setup some temporary transform values in preparation for rendering the <see cref="Axis"/>.
        /// </summary>
        /// <remarks>
        /// This method is typically called by the parent <see cref="GraphPane"/>
        /// object as part of the <see cref="GraphPane.Draw"/> method.  It is also
        /// called by <see cref="GraphPane.GeneralTransform(double,double,CoordType)"/> and
        /// <see cref="GraphPane.ReverseTransform( PointF, out double, out double )"/>
        /// methods to setup for coordinate transformations.
        /// </remarks>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="axis">
        /// The parent <see cref="Axis" /> for this <see cref="Scale" />
        /// </param>
        public override void SetupScaleData( GraphPane pane, Axis axis )
        {
            base.SetupScaleData( pane, axis );

            _minLinTemp = Linearize( _min );
            _maxLinTemp = Linearize( _max );
        }
示例#27
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public LinearScale( Axis owner )
     : base(owner)
 {
 }
示例#28
0
 /// <summary>
 /// Default constructor that defines the owner <see cref="Axis" />
 /// (containing object) for this new object.
 /// </summary>
 /// <param name="owner">The owner, or containing object, of this instance</param>
 public LogScale( Axis owner )
     : base(owner)
 {
 }
示例#29
0
        /// <summary>
        /// Draw all the <see cref="ErrorBar"/>'s to the specified <see cref="Graphics"/>
        /// device as a an error bar at each defined point.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="curve">A <see cref="CurveItem"/> object representing the
        /// <see cref="Bar"/>'s to be drawn.</param>
        /// <param name="baseAxis">The <see cref="Axis"/> class instance that defines the base (independent)
        /// axis for the <see cref="Bar"/></param>
        /// <param name="valueAxis">The <see cref="Axis"/> class instance that defines the value (dependent)
        /// axis for the <see cref="Bar"/></param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        public void Draw( Graphics g, GraphPane pane, ErrorBarItem curve,
							Axis baseAxis, Axis valueAxis, float scaleFactor )
        {
            ValueHandler valueHandler = new ValueHandler( pane, false );

            float	pixBase, pixValue, pixLowValue;
            double	scaleBase, scaleValue, scaleLowValue;

            if ( curve.Points != null && this.IsVisible )
            {
                using ( Pen pen = !curve.IsSelected ? new Pen( _color, _penWidth ) :
                        new Pen( Selection.Border.Color, Selection.Border.Width ) )
                {
                    // Loop over each defined point
                    for ( int i = 0; i < curve.Points.Count; i++ )
                    {
                        valueHandler.GetValues( curve, i, out scaleBase,
                                    out scaleLowValue, out scaleValue );

                        // Any value set to double max is invalid and should be skipped
                        // This is used for calculated values that are out of range, divide
                        //   by zero, etc.
                        // Also, any value <= zero on a log scale is invalid

                        if ( !curve.Points[i].IsInvalid3D &&
                                ( scaleBase > 0 || !baseAxis._scale.IsLog ) &&
                                ( ( scaleValue > 0 && scaleLowValue > 0 ) || !valueAxis._scale.IsLog ) )
                        {
                            pixBase = baseAxis.Scale.Transform( curve.IsOverrideOrdinal, i, scaleBase );
                            pixValue = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, scaleValue );
                            pixLowValue = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, i, scaleLowValue );

                            //if ( this.fill.IsGradientValueType )
                            //	brush = fill.MakeBrush( _rect, _points[i] );

                            this.Draw( g, pane, baseAxis is XAxis || baseAxis is X2Axis, pixBase, pixValue,
                                            pixLowValue, scaleFactor, pen, curve.IsSelected,
                                            curve.Points[i] );
                        }
                    }
                }
            }
        }
示例#30
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)
 {
 }