예제 #1
0
        /// <summary>
        /// Select a reasonable ordinal axis scale given a range of data values, with the expectation that
        /// dates will be displayed.
        /// </summary>
        /// <remarks>
        /// This method only applies to <see c_ref="AxisType.DateAsOrdinal"/> type axes, and it
        /// is called by the general <see c_ref="PickScale"/> method.  For this type,
        /// the first curve is the "master", which contains the dates to be applied.
        /// <para>On Exit:</para>
        /// <para><see c_ref="Scale.Min"/> is set to scale minimum (if <see c_ref="Scale.MinAuto"/> = true)</para>
        /// <para><see c_ref="Scale.Max"/> is set to scale maximum (if <see c_ref="Scale.MaxAuto"/> = true)</para>
        /// <para><see c_ref="Scale.MajorStep"/> is set to scale step size (if <see c_ref="Scale.MajorStepAuto"/> = true)</para>
        /// <para><see c_ref="Scale.MinorStep"/> is set to scale minor step size (if <see c_ref="Scale.MinorStepAuto"/> = true)</para>
        /// <para><see c_ref="Scale.Mag"/> is set to a magnitude multiplier according to the data</para>
        /// <para><see c_ref="Scale.Format"/> is set to the display format for the values (this controls the
        /// number of decimal places, whether there are thousands separators, currency types, etc.)</para>
        /// </remarks>
        /// <param name="pane">A reference to the <see c_ref="GraphPane"/> object
        /// associated with this <see c_ref="Axis"/></param>
        /// <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="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see c_ref="GraphPane"/> object using the
        /// <see c_ref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <seealso c_ref="PickScale"/>
        /// <seealso c_ref="AxisType.Ordinal"/>
        override public void PickScale(GraphPane pane, Graphics g, float scaleFactor)
        {
            // call the base class first
            base.PickScale(pane, g, scaleFactor);

/*			// First, get the date ranges from the first curve in the list
 *                      double xMin; // = Double.MaxValue;
 *                      double xMax; // = Double.MinValue;
 *                      double yMin; // = Double.MaxValue;
 *                      double yMax; // = Double.MinValue;
 *                      double range = 1;
 *
 *                      foreach ( CurveItem curve in pane.CurveList )
 *                      {
 *                              if ( ( _ownerAxis is Y2Axis && curve.IsY2Axis ) ||
 *                                              ( _ownerAxis is YAxis && !curve.IsY2Axis ) ||
 *                                              ( _ownerAxis is X2Axis && curve.IsX2Axis ) ||
 *                                              ( _ownerAxis is XAxis && !curve.IsX2Axis ) )
 *                              {
 *                                      curve.GetRange( out xMin, out xMax, out yMin, out yMax, false, pane.IsBoundedRanges, pane );
 *                                      if ( _ownerAxis is XAxis || _ownerAxis is X2Axis )
 *                                              range = xMax - xMin;
 *                                      else
 *                                              range = yMax - yMin;
 *                              }
 *                      }
 */
            // Set the DateFormat by calling CalcDateStepSize
            //			DateScale.CalcDateStepSize( range, Default.TargetXSteps, this );
            SetDateFormat(pane);

            // Now, set the axis range based on a ordinal scale
            base.PickScale(pane, g, scaleFactor);
            OrdinalScale.PickScale(pane, g, scaleFactor, this);
        }
예제 #2
0
        /// <summary>
        /// Select a reasonable ordinal axis scale given a range of data values, with the expectation that
        /// linear values will be displayed.
        /// </summary>
        /// <remarks>
        /// This method only applies to <see c_ref="AxisType.DateAsOrdinal"/> type axes, and it
        /// is called by the general <see c_ref="Scale.PickScale"/> method.  For this type,
        /// the first curve is the "master", which contains the dates to be applied.
        /// <para>On Exit:</para>
        /// <para><see c_ref="Scale.Min"/> is set to scale minimum (if <see c_ref="Scale.MinAuto"/> = true)</para>
        /// <para><see c_ref="Scale.Max"/> is set to scale maximum (if <see c_ref="Scale.MaxAuto"/> = true)</para>
        /// <para><see c_ref="Scale.MajorStep"/> is set to scale step size (if <see c_ref="Scale.MajorStepAuto"/> = true)</para>
        /// <para><see c_ref="Scale.MinorStep"/> is set to scale minor step size (if <see c_ref="Scale.MinorStepAuto"/> = true)</para>
        /// <para><see c_ref="Scale.Mag"/> is set to a magnitude multiplier according to the data</para>
        /// <para><see c_ref="Scale.Format"/> is set to the display format for the values (this controls the
        /// number of decimal places, whether there are thousands separators, currency types, etc.)</para>
        /// </remarks>
        /// <param name="pane">A reference to the <see c_ref="GraphPane"/> object
        /// associated with this <see c_ref="Axis"/></param>
        /// <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="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see c_ref="GraphPane"/> object using the
        /// <see c_ref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <seealso c_ref="PickScale"/>
        /// <seealso c_ref="AxisType.Ordinal"/>
        override public void PickScale(GraphPane pane, Graphics g, float scaleFactor)
        {
            // call the base class first
            base.PickScale(pane, g, scaleFactor);

            // First, get the date ranges from the first curve in the list
            double xMin;             // = Double.MaxValue;
            double xMax;             // = Double.MinValue;
            double yMin;             // = Double.MaxValue;
            double yMax;             // = Double.MinValue;
            double tMin = 0;
            double tMax = 1;

            foreach (CurveItem curve in pane.CurveList)
            {
                if ((_ownerAxis is Y2Axis && curve.IsY2Axis) ||
                    (_ownerAxis is YAxis && !curve.IsY2Axis) ||
                    (_ownerAxis is X2Axis && curve.IsX2Axis) ||
                    (_ownerAxis is XAxis && !curve.IsX2Axis))
                {
                    curve.GetRange(out xMin, out xMax, out yMin, out yMax, false, false, pane);
                    if (_ownerAxis is XAxis || _ownerAxis is X2Axis)
                    {
                        tMin = xMin;
                        tMax = xMax;
                    }
                    else
                    {
                        tMin = yMin;
                        tMax = yMax;
                    }
                }
            }

            double range = Math.Abs(tMax - tMin);

            // Now, set the axis range based on a ordinal scale
            base.PickScale(pane, g, scaleFactor);
            OrdinalScale.PickScale(pane, g, scaleFactor, this);

            SetScaleMag(tMin, tMax, range / Default.TargetXSteps);
        }