Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinearAsOrdinalScale"/> class. 
 /// 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 LinearAsOrdinalScale(Axis owner)
     : base(owner)
 {
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateScale"/> class. 
 /// 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)
 {
 }
Example #3
0
 /// <summary>
 /// The force num tics.
 /// </summary>
 /// <param name="axis">
 /// The axis.
 /// </param>
 /// <param name="numTics">
 /// The num tics.
 /// </param>
 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);
         }
     }
 }
Example #4
0
        /// <summary>
        /// Draw the specified single bar (an individual "point") of this series to the specified
        /// <see cref="Graphics"/> device.  This method is not as efficient as
        /// <see cref="DrawBars"/>, which draws the bars for all points.  It is intended to be used only for <see cref="BarType.SortedOverlay"/>, which
        /// requires special handling of each bar.
        /// </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="pos">
        /// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.) in the cluster of bars.
        /// </param>
        /// <param name="index">
        /// The zero-based index number for the single bar to be drawn.
        /// </param>
        /// <param name="barWidth">
        /// The width of each bar, in pixels.
        /// </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 DrawSingleBar(
            Graphics g, 
            GraphPane pane, 
            CurveItem curve, 
            Axis baseAxis, 
            Axis valueAxis, 
            int pos, 
            int index, 
            float barWidth, 
            float scaleFactor)
        {
            // Make sure that a bar value exists for the current curve and current ordinal position
            if (index >= curve.Points.Count)
            {
                return;
            }

            // For Overlay and Stack bars, the position is always zero since the bars are on top
            // of eachother
            if (pane._barSettings.Type == BarType.Overlay || pane._barSettings.Type == BarType.Stack || pane._barSettings.Type == BarType.PercentStack)
            {
                pos = 0;
            }

            // Draw the specified bar
            this.DrawSingleBar(g, pane, curve, index, pos, baseAxis, valueAxis, barWidth, scaleFactor);
        }
Example #5
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 DateScale(this, owner);
 }
        /*
        /// <summary>
        /// Use the MouseCaptureChanged as an indicator for the start and end of a scrolling operation
        /// </summary>
        private void ScrollBarMouseCaptureChanged( object sender, EventArgs e )
        {
            return;

            ScrollBar scrollBar = sender as ScrollBar;
            if ( scrollBar != null )
            {
                // If this is the start of a new scroll, then Capture will be true
                if ( scrollBar.Capture )
                {
                    // save the original zoomstate
                    //_zoomState = new ZoomState( this.GraphPane, ZoomState.StateType.Scroll );
                    ZoomStateSave( this.GraphPane, ZoomState.StateType.Scroll );
                }
                else
                {
                    // push the prior saved zoomstate, since the scale ranges have already been changed on
                    // the fly during the scrolling operation
                    if ( _zoomState != null && _zoomState.IsChanged( this.GraphPane ) )
                    {
                        //this.GraphPane.ZoomStack.Push( _zoomState );
                        ZoomStatePush( this.GraphPane );

                        // Provide Callback to notify the user of pan events
                        if ( this.ScrollDoneEvent != null )
                            this.ScrollDoneEvent( this, scrollBar, _zoomState,
                                        new ZoomState( this.GraphPane, ZoomState.StateType.Scroll ) );

                        _zoomState = null;
                    }
                }
            }
        }
        */
        /// <summary>
        /// The handle scroll.
        /// </summary>
        /// <param name="axis">
        /// The axis.
        /// </param>
        /// <param name="newValue">
        /// The new value.
        /// </param>
        /// <param name="scrollMin">
        /// The scroll min.
        /// </param>
        /// <param name="scrollMax">
        /// The scroll max.
        /// </param>
        /// <param name="largeChange">
        /// The large change.
        /// </param>
        /// <param name="reverse">
        /// The reverse.
        /// </param>
        private void HandleScroll(Axis axis, int newValue, double scrollMin, double scrollMax, int largeChange, bool reverse)
        {
            if (axis != null)
            {
                if (scrollMin > axis._scale._min)
                {
                    scrollMin = axis._scale._min;
                }

                if (scrollMax < axis._scale._max)
                {
                    scrollMax = axis._scale._max;
                }

                int span = _ScrollControlSpan - largeChange;
                if (span <= 0)
                {
                    return;
                }

                if (reverse)
                {
                    newValue = span - newValue;
                }

                Scale scale = axis._scale;

                double delta = scale._maxLinearized - scale._minLinearized;
                double scrollMin2 = scale.Linearize(scrollMax) - delta;
                scrollMin = scale.Linearize(scrollMin);

                // scrollMax = scale.Linearize( scrollMax );
                double val = scrollMin + newValue / (double)span * (scrollMin2 - scrollMin);
                scale._minLinearized = val;
                scale._maxLinearized = val + delta;

                /*
                                if ( axis.Scale.IsLog )
                                {
                                    double ratio = axis._scale._max / axis._scale._min;
                                    double scrollMin2 = scrollMax / ratio;

                                    double val = scrollMin * Math.Exp( (double)newValue / (double)span *
                                                ( Math.Logger( scrollMin2 ) - Math.Logger( scrollMin ) ) );
                                    axis._scale._min = val;
                                    axis._scale._max = val * ratio;
                                }
                                else
                                {
                                    double delta = axis._scale._max - axis._scale._min;
                                    double scrollMin2 = scrollMax - delta;

                                    double val = scrollMin + (double)newValue / (double)span *
                                                ( scrollMin2 - scrollMin );
                                    axis._scale._min = val;
                                    axis._scale._max = val + delta;
                                }
                */
                this.Invalidate();
            }
        }
 /// <summary>
 /// The synchronize.
 /// </summary>
 /// <param name="source">
 /// The source.
 /// </param>
 /// <param name="dest">
 /// The dest.
 /// </param>
 private void Synchronize(Axis source, Axis dest)
 {
     dest._scale._min = source._scale._min;
     dest._scale._max = source._scale._max;
     dest._scale._majorStep = source._scale._majorStep;
     dest._scale._minorStep = source._scale._minorStep;
     dest._scale._minAuto = source._scale._minAuto;
     dest._scale._maxAuto = source._scale._maxAuto;
     dest._scale._majorStepAuto = source._scale._majorStepAuto;
     dest._scale._minorStepAuto = source._scale._minorStepAuto;
 }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scale"/> class. 
        /// 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)
        {
            this._ownerAxis = ownerAxis;

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

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

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

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

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

            this._format = null;
            this._textLabels = null;

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

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

            this._fontSpec.Border.IsVisible = false;
            this._labelGap = Default.LabelGap;
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scale"/> class. 
        /// 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)
        {
            this._ownerAxis = owner;

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

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

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

            this._mag = rhs._mag;

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

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

            this._format = rhs._format;

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

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

            this._labelGap = rhs._labelGap;

            if (rhs._textLabels != null)
            {
                this._textLabels = (string[])rhs._textLabels.Clone();
            }
            else
            {
                this._textLabels = null;
            }
        }
Example #10
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)
            {
                this._minPix = pane.Chart._rect.Left;
                this._maxPix = pane.Chart._rect.Right;
            }
            else
            {
                this._minPix = pane.Chart._rect.Top;
                this._maxPix = pane.Chart._rect.Bottom;
            }

            this._minLinTemp = this.Linearize(this._min);
            this._maxLinTemp = this.Linearize(this._max);
        }
Example #11
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 (this._rangeMin >= double.MaxValue || this._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)
                {
                    this._rangeMin = pane.YAxis.Scale._rangeMin;
                    this._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)
                {
                    this._rangeMin = pane.Y2Axis.Scale._rangeMin;
                    this._rangeMax = pane.Y2Axis.Scale._rangeMax;
                }

                // Otherwise, just use 0 and 1
                else
                {
                    this._rangeMin = 0;
                    this._rangeMax = 1;
                }
            }

            /*
                if ( yMinVal >= Double.MaxValue || yMaxVal <= Double.MinValue )
                {
                    if ( y2MinVal < Double.MaxValue && y2MaxVal > Double.MinValue )
                    {
                        yMinVal = y2MinVal;
                        yMaxVal = y2MaxVal;
                    }
                    else
                    {
                        yMinVal = 0;
                        yMaxVal = 0.01;
                    }
                }

                if ( y2MinVal >= Double.MaxValue || y2MaxVal <= Double.MinValue )
                {
                    if ( yMinVal < Double.MaxValue && yMaxVal > Double.MinValue )
                    {
                        y2MinVal = yMinVal;
                        y2MaxVal = yMaxVal;
                    }
                    else
                    {
                        y2MinVal = 0;
                        y2MaxVal = 1;
                    }
                }
                */
        }
Example #12
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);
Example #13
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 = this.GetBarWidth(pane, baseAxis, scaleFactor);

                Color tColor = this._color;
                Color tFallingColor = this._fallingColor;
                float tPenWidth = this._width;
                Fill tRisingFill = this._risingFill;
                Fill tFallingFill = this._fallingFill;
                Border tRisingBorder = this._risingBorder;
                Border tFallingBorder = this._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 = PointPairBase.Missing;
                        double close = PointPairBase.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 (PointPairBase.IsValueInvalid(open))
                            {
                                pixOpen = float.MaxValue;
                            }
                            else
                            {
                                pixOpen = valueAxis.Scale.Transform(curve.IsOverrideOrdinal, i, open);
                            }

                            if (PointPairBase.IsValueInvalid(close))
                            {
                                pixClose = float.MaxValue;
                            }
                            else
                            {
                                pixClose = valueAxis.Scale.Transform(curve.IsOverrideOrdinal, i, close);
                            }

                            if (!curve.IsSelected && this._gradientFill.IsGradientValueType)
                            {
                                using (Pen tPen = this.GetPen(pane, scaleFactor, pt))
                                    this.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
                            {
                                this.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);
                            }
                        }
                    }
                }
            }
        }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinearAsOrdinalScale"/> class. 
 /// 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)
 {
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrdinalScale"/> class. 
 /// 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)
 {
 }
Example #16
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(this._color, this._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]);
                        }
                    }
                }
            }
        }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrdinalScale"/> class. 
 /// 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)
 {
 }
Example #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateAsOrdinalScale"/> class. 
 /// 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)
 {
 }
        /// <summary>
        /// The set scroll.
        /// </summary>
        /// <param name="scrollBar">
        /// The scroll bar.
        /// </param>
        /// <param name="axis">
        /// The axis.
        /// </param>
        /// <param name="scrollMin">
        /// The scroll min.
        /// </param>
        /// <param name="scrollMax">
        /// The scroll max.
        /// </param>
        private void SetScroll(ScrollBar scrollBar, Axis axis, double scrollMin, double scrollMax)
        {
            if (scrollBar != null && axis != null)
            {
                scrollBar.Minimum = 0;
                scrollBar.Maximum = _ScrollControlSpan - 1;

                if (scrollMin > axis._scale._min)
                {
                    scrollMin = axis._scale._min;
                }

                if (scrollMax < axis._scale._max)
                {
                    scrollMax = axis._scale._max;
                }

                int val = 0;

                Scale scale = axis._scale;
                double minLinearized = scale._minLinearized;
                double maxLinearized = scale._maxLinearized;
                scrollMin = scale.Linearize(scrollMin);
                scrollMax = scale.Linearize(scrollMax);

                double scrollMin2 = scrollMax - (maxLinearized - minLinearized);

                /*
                if ( axis.Scale.IsLog )
                    scrollMin2 = scrollMax / ( axis._scale._max / axis._scale._min );
                else
                    scrollMin2 = scrollMax - ( axis._scale._max - axis._scale._min );
                */
                if (scrollMin >= scrollMin2)
                {
                    // scrollBar.Visible = false;
                    scrollBar.Enabled = false;
                    scrollBar.Value = 0;
                }
                else
                {
                    double ratio = (maxLinearized - minLinearized) / (scrollMax - scrollMin);

                    /*
                    if ( axis.Scale.IsLog )
                        ratio = ( Math.Logger( axis._scale._max ) - Math.Logger( axis._scale._min ) ) /
                                    ( Math.Logger( scrollMax ) - Math.Logger( scrollMin ) );
                    else
                        ratio = ( axis._scale._max - axis._scale._min ) / ( scrollMax - scrollMin );
                    */
                    int largeChange = (int)(ratio * _ScrollControlSpan + 0.5);
                    if (largeChange < 1)
                    {
                        largeChange = 1;
                    }

                    scrollBar.LargeChange = largeChange;

                    int smallChange = largeChange / _ScrollSmallRatio;
                    if (smallChange < 1)
                    {
                        smallChange = 1;
                    }

                    scrollBar.SmallChange = smallChange;

                    int span = _ScrollControlSpan - largeChange;

                    val = (int)((minLinearized - scrollMin) / (scrollMin2 - scrollMin) * span + 0.5);

                    /*
                    if ( axis.Scale.IsLog )
                        val = (int)( ( Math.Logger( axis._scale._min ) - Math.Logger( scrollMin ) ) /
                                ( Math.Logger( scrollMin2 ) - Math.Logger( scrollMin ) ) * span + 0.5 );
                    else
                        val = (int)( ( axis._scale._min - scrollMin ) / ( scrollMin2 - scrollMin ) *
                                span + 0.5 );
                    */
                    if (val < 0)
                    {
                        val = 0;
                    }
                    else if (val > span)
                    {
                        val = span;
                    }

                    // if ( ( axis is XAxis && axis.IsReverse ) || ( ( ! axis is XAxis ) && ! axis.IsReverse ) )
                    if ((axis is XAxis) == axis.Scale.IsReverse)
                    {
                        val = span - val;
                    }

                    if (val < scrollBar.Minimum)
                    {
                        val = scrollBar.Minimum;
                    }

                    if (val > scrollBar.Maximum)
                    {
                        val = scrollBar.Maximum;
                    }

                    scrollBar.Value = val;
                    scrollBar.Enabled = true;

                    // scrollBar.Visible = true;
                }
            }
        }
Example #20
0
        /// <summary>
        /// Make a string label that corresponds to a user scale value.
        /// </summary>
        /// <param name="axis">
        /// The axis from which to obtain the scale value.  This determines if it's a date value, linear, log, etc.
        /// </param>
        /// <param name="val">
        /// The value to be made into a label
        /// </param>
        /// <param name="iPt">
        /// The ordinal position of the value
        /// </param>
        /// <param name="isOverrideOrdinal">
        /// true to override the ordinal settings of the axis, and prefer the actual value instead.
        /// </param>
        /// <returns>
        /// The string label.
        /// </returns>
        protected string MakeValueLabel(Axis axis, double val, int iPt, bool isOverrideOrdinal)
        {
            if (axis != null)
            {
                if (axis.Scale.IsDate || axis.Scale.Type == AxisType.DateAsOrdinal)
                {
                    return XDate.ToString(val, this._pointDateFormat);
                }

                if (axis._scale.IsText && axis._scale._textLabels != null)
                {
                    int i = iPt;
                    if (isOverrideOrdinal)
                    {
                        i = (int)(val - 0.5);
                    }

                    if (i >= 0 && i < axis._scale._textLabels.Length)
                    {
                        return axis._scale._textLabels[i];
                    }

                    return (i + 1).ToString();
                }

                if (axis.Scale.IsAnyOrdinal && axis.Scale.Type != AxisType.LinearAsOrdinal && !isOverrideOrdinal)
                {
                    return iPt.ToString(this._pointValueFormat);
                }

                return val.ToString(this._pointValueFormat);
            }

            return string.Empty;
        }
Example #21
0
        /// <summary>
        /// Draw the this <see cref="Bar"/> to the specified <see cref="Graphics"/>
        /// device as a bar at each defined point. This method is normally only called by the <see cref="BarItem.Draw"/> method of the
        /// <see cref="BarItem"/> object
        /// </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="barWidth">
        /// The width of each bar, in pixels.
        /// </param>
        /// <param name="pos">
        /// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.) in the cluster of bars.
        /// </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 DrawBars(Graphics g, GraphPane pane, CurveItem curve, Axis baseAxis, Axis valueAxis, float barWidth, int pos, float scaleFactor)
        {
            // For non-cluster bar types, the position is always zero since the bars are on top
            // of eachother
            BarType barType = pane._barSettings.Type;
            if (barType == BarType.Overlay || barType == BarType.Stack || barType == BarType.PercentStack || barType == BarType.SortedOverlay)
            {
                pos = 0;
            }

            // Loop over each defined point and draw the corresponding bar
            for (int i = 0; i < curve.Points.Count; i++)
            {
                this.DrawSingleBar(g, pane, curve, i, pos, baseAxis, valueAxis, barWidth, scaleFactor);
            }
        }
Example #22
0
        /// <summary>
        /// Handle a panning operation for the specified <see cref="Axis"/>.
        /// </summary>
        /// <param name="axis">
        /// The <see cref="Axis"/> to be panned
        /// </param>
        /// <param name="startVal">
        /// The value where the pan started.  The scale range will be shifted by the difference between <see paramref="startVal"/> and
        /// <see paramref="endVal"/>.
        /// </param>
        /// <param name="endVal">
        /// The value where the pan ended.  The scale range will be shifted by the difference between <see paramref="startVal"/> and
        /// <see paramref="endVal"/>.
        /// </param>
        protected void PanScale(Axis axis, double startVal, double endVal)
        {
            if (axis != null)
            {
                Scale scale = axis._scale;
                double delta = scale.Linearize(startVal) - scale.Linearize(endVal);

                scale._minLinearized += delta;
                scale._maxLinearized += delta;

                scale._minAuto = false;
                scale._maxAuto = false;

                /*
                                if ( axis.Type == AxisType.Logger )
                                {
                                    axis._scale._min *= startVal / endVal;
                                    axis._scale._max *= startVal / endVal;
                                }
                                else
                                {
                                    axis._scale._min += startVal - endVal;
                                    axis._scale._max += startVal - endVal;
                                }
                */
            }
        }
Example #23
0
        /// <summary>
        /// Protected internal routine that draws the specified single bar (an individual "point") of this series to the specified <see cref="Graphics"/>
        /// device.
        /// </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="index">
        /// The zero-based index number for the single bar to be drawn.
        /// </param>
        /// <param name="pos">
        /// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.) in the cluster of bars.
        /// </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="barWidth">
        /// The width of each bar, in pixels.
        /// </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>
        protected virtual void DrawSingleBar(
            Graphics g, 
            GraphPane pane, 
            CurveItem curve, 
            int index, 
            int pos, 
            Axis baseAxis, 
            Axis valueAxis, 
            float barWidth, 
            float scaleFactor)
        {
            // pixBase = pixel value for the bar center on the base axis
            // pixHiVal = pixel value for the bar top on the value axis
            // pixLowVal = pixel value for the bar bottom on the value axis
            float pixBase, pixHiVal, pixLowVal;

            float clusterWidth = pane.BarSettings.GetClusterWidth();

            // float barWidth = curve.GetBarWidth( pane );
            float clusterGap = pane._barSettings.MinClusterGap * barWidth;
            float barGap = barWidth * pane._barSettings.MinBarGap;

            // curBase = the scale value on the base axis of the current bar
            // curHiVal = the scale value on the value axis of the current bar
            // curLowVal = the scale value of the bottom of the bar
            double curBase, curLowVal, curHiVal;
            ValueHandler valueHandler = new ValueHandler(pane, false);
            valueHandler.GetValues(curve, index, out curBase, out curLowVal, out curHiVal);

            // 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[index].IsInvalid)
            {
                // calculate a pixel value for the top of the bar on value axis
                pixLowVal = valueAxis.Scale.Transform(curve.IsOverrideOrdinal, index, curLowVal);
                pixHiVal = valueAxis.Scale.Transform(curve.IsOverrideOrdinal, index, curHiVal);

                // calculate a pixel value for the center of the bar on the base axis
                pixBase = baseAxis.Scale.Transform(curve.IsOverrideOrdinal, index, curBase);

                // Calculate the pixel location for the side of the bar (on the base axis)
                float pixSide = pixBase - clusterWidth / 2.0F + clusterGap / 2.0F + pos * (barWidth + barGap);

                // Draw the bar
                if (pane._barSettings.Base == BarBase.X)
                {
                    this.Draw(g, pane, pixSide, pixSide + barWidth, pixLowVal, pixHiVal, scaleFactor, true, curve.IsSelected, curve.Points[index]);
                }
                else
                {
                    this.Draw(g, pane, pixLowVal, pixHiVal, pixSide, pixSide + barWidth, scaleFactor, true, curve.IsSelected, curve.Points[index]);
                }
            }
        }
Example #24
0
        /// <summary>
        /// Zoom the specified axis by the specified amount, with the center of the zoom at the (optionally) specified point.
        /// </summary>
        /// <remarks>
        /// This method is used for MouseWheel zoom operations
        /// </remarks>
        /// <param name="axis">
        /// The <see cref="Axis"/> to be zoomed.
        /// </param>
        /// <param name="zoomFraction">
        /// The zoom fraction, less than 1.0 to zoom in, greater than 1.0 to zoom out.  That is, a value of 0.9 will zoom in such that the scale length is 90% of
        /// what it previously was.
        /// </param>
        /// <param name="centerVal">
        /// The location for the center of the zoom.  This is only used if
        /// <see paramref="IsZoomOnMouseCenter"/> is true.
        /// </param>
        /// <param name="isZoomOnCenter">
        /// true if the zoom is to be centered at the
        /// <see paramref="centerVal"/> screen position, false for the zoom to be centered within the <see cref="Chart.Rect"/>.
        /// </param>
        protected void ZoomScale(Axis axis, double zoomFraction, double centerVal, bool isZoomOnCenter)
        {
            if (axis != null && zoomFraction > 0.0001 && zoomFraction < 1000.0)
            {
                Scale scale = axis._scale;

                /*
                                if ( axis.Scale.IsLog )
                                {
                                    double ratio = Math.Sqrt( axis._scale._max / axis._scale._min * zoomFraction );

                                    if ( !isZoomOnCenter )
                                        centerVal = Math.Sqrt( axis._scale._max * axis._scale._min );

                                    axis._scale._min = centerVal / ratio;
                                    axis._scale._max = centerVal * ratio;
                                }
                                else
                                {
                */
                double minLin = axis._scale._minLinearized;
                double maxLin = axis._scale._maxLinearized;
                double range = (maxLin - minLin) * zoomFraction / 2.0;

                if (!isZoomOnCenter)
                {
                    centerVal = (maxLin + minLin) / 2.0;
                }

                axis._scale._minLinearized = centerVal - range;
                axis._scale._maxLinearized = centerVal + range;

                // 				}
                axis._scale._minAuto = false;
                axis._scale._maxAuto = false;
            }
        }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateScale"/> class. 
 /// 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)
 {
 }
Example #26
0
        /*
        /// <summary>
        /// Protected internal routine that draws the specified single bar (an individual "point")
        /// of this series to the specified <see cref="Graphics"/> device.
        /// </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="index">
        /// The zero-based index number for the single bar to be drawn.
        /// </param>
        /// <param name="pos">
        /// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.)
        /// in the cluster of bars.
        /// </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="barWidth">
        /// The width of each bar, in pixels.
        /// </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>
        override protected void DrawSingleBar( Graphics g, GraphPane pane,
                            CurveItem curve,
                            int index, int pos, Axis baseAxis, Axis valueAxis,
                            float barWidth, float scaleFactor )
        {
            //float	scaledSize = GetBarWidth( pane, baseAxis, scaleFactor );

            // pixBase = pixel value for the bar center on the base axis
            // pixValue = pixel value for the bar top on the value axis
            // pixLow = pixel value for the bar bottom on the value axis
            float pixBase, pixHiVal, pixLowVal;

            // curBase = the scale value on the base axis of the current bar
            // curValue = the scale value on the value axis of the current bar

            double curBase, curLowVal, curHiVal;
            ValueHandler valueHandler = new ValueHandler( pane, false );
            valueHandler.GetValues( curve, index, out curBase,
                    out curLowVal, out curHiVal );

            barWidth = GetBarWidth( pane, baseAxis, scaleFactor );

            // curLow = the scale value on the value axis for the bottom of the current bar
            // Get a "low" value for the bottom of the bar and verify validity

            if (	curLowVal == PointPair.Missing ||
                    System.Double.IsNaN( curLowVal ) ||
                    System.Double.IsInfinity( curLowVal ) )
                curLowVal = 0;

            // 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[index].IsInvalid )
            {
                // calculate a pixel value for the top of the bar on value axis
                pixHiVal = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, index, curHiVal );
                // calculate a pixel value for the center of the bar on the base axis
                pixBase = baseAxis.Scale.Transform( curve.IsOverrideOrdinal, index, curBase );

                pixLowVal = valueAxis.Scale.Transform( curve.IsOverrideOrdinal, index, curLowVal );

                // Calculate the pixel location for the side of the bar (on the base axis)
                float pixSide = pixBase - barWidth / 2.0F;

                // Calculate the pixel location for the side of the bar (on the base axis)
                float pixSide = pixBase - clusterWidth / 2.0F + clusterGap / 2.0F +
                                pos * ( barWidth + barGap );

                // Draw the bar
                if ( baseAxis is XAxis || baseAxis is X2Axis )
                    this.Draw( g, pane, pixSide, pixSide + barWidth, pixLowVal,
                                pixHiVal, scaleFactor, true, curve.IsSelected,
                                curve.Points[index] );
                else
                    this.Draw( g, pane, pixLowVal, pixHiVal, pixSide, pixSide + barWidth,
                                scaleFactor, true, curve.IsSelected,
                                curve.Points[index] );
           }
           }
        */
        /// <summary>
        /// Returns the width of the bar, in pixels, based on the settings for
        /// <see cref="Size"/> and <see cref="IsAutoSize"/>.
        /// </summary>
        /// <param name="pane">
        /// The parent <see cref="GraphPane"/> object.
        /// </param>
        /// <param name="baseAxis">
        /// The <see cref="Axis"/> object that represents the bar base (independent axis).
        /// </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>
        /// <returns>
        /// The width of each bar, in pixel units
        /// </returns>
        public float GetBarWidth(GraphPane pane, Axis baseAxis, float scaleFactor)
        {
            float width;

            if (this._isAutoSize)
            {
                width = baseAxis._scale.GetClusterWidth(this._userScaleSize) / (1.0F + pane._barSettings.MinClusterGap);
            }
            else
            {
                width = this._size * scaleFactor;
            }

            // use integral size
            return (int)(width + 0.5f);
        }
Example #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Axis"/> class. 
        /// The Copy Constructor.
        /// </summary>
        /// <param name="rhs">
        /// The Axis object from which to copy
        /// </param>
        public Axis(Axis rhs)
        {
            this._scale = rhs._scale.Clone(this);

            this._cross = rhs._cross;

            this._crossAuto = rhs._crossAuto;

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

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

            this._isVisible = rhs.IsVisible;

            this._isAxisSegmentVisible = rhs._isAxisSegmentVisible;

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

            this._axisGap = rhs._axisGap;

            this._minSpace = rhs.MinSpace;

            this._color = rhs.Color;
        }
Example #28
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 OrdinalScale(this, owner);
 }
Example #29
0
        /// <summary>
        /// The set space.
        /// </summary>
        /// <param name="axis">
        /// The axis.
        /// </param>
        /// <param name="clientSize">
        /// The client size.
        /// </param>
        /// <param name="spaceNorm">
        /// The space norm.
        /// </param>
        /// <param name="spaceAlt">
        /// The space alt.
        /// </param>
        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;
            }
        }
Example #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinearScale"/> class. 
 /// 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)
 {
 }