本文整理汇总了C#中ZedGraph.Axis类的典型用法代码示例。如果您正苦于以下问题:C# Axis类的具体用法?C# Axis怎么用?C# Axis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Axis类属于ZedGraph命名空间,在下文中一共展示了Axis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Synchronize
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;
}
示例2: ScaleState
/// <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;
}
示例3: ForceNumTics
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 );
}
}
示例4: DrawSingleBar
/// <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="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="GraphPane.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, double scaleFactor )
{
if ( index >= curve.Points.Count )
return;
//SetupBarStack( valueAxis, curve.Points.Count );
// For Overlay and Stack bars, the position is always zero since the bars are on top
// of eachother
if ( pane.BarType == BarType.Overlay || pane.BarType == BarType.Stack ||
pane.BarType == BarType.PercentStack )
pos = 0;
DrawSingleBar( g, pane, curve, index, pos, baseAxis, valueAxis,
scaleFactor );
}
示例5: Clone
/// <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 LinearAsOrdinalScale(this, owner);
}
示例6: LinearAsOrdinalScale
/// <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 LinearAsOrdinalScale(Axis owner)
: base(owner)
{
}
示例7: OrdinalScale
/// <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)
{
}
示例8: Axis
/// <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;
}
示例9: ZoomScale
/// <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;
}
}
示例10: PanScale
/// <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.Log )
{
axis._scale._min *= startVal / endVal;
axis._scale._max *= startVal / endVal;
}
else
{
axis._scale._min += startVal - endVal;
axis._scale._max += startVal - endVal;
}
*/
}
}
示例11: MakeValueLabel
/// <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, _pointDateFormat);
}
else 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];
else
return (i + 1).ToString();
}
else if (axis.Scale.IsAnyOrdinal && axis.Scale.Type != AxisType.LinearAsOrdinal
&& !isOverrideOrdinal) {
return iPt.ToString(_pointValueFormat);
}
else
return val.ToString(_pointValueFormat);
}
else
return string.Empty;
}
示例12: DrawSingleBar
/// <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
DrawSingleBar(g, pane, curve, index, pos, baseAxis, valueAxis, barWidth, scaleFactor);
}
示例13: Scale
/// <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;
}
示例14: SetRange
/// <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;
}
}
/*
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;
}
}
*/
}
示例15: TextScale
public TextScale(Axis owner)
: base(owner)
{
}