本文整理汇总了C#中UIGraphLib.GraphPane类的典型用法代码示例。如果您正苦于以下问题:C# GraphPane类的具体用法?C# GraphPane怎么用?C# GraphPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphPane类属于UIGraphLib命名空间,在下文中一共展示了GraphPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValueHandler
/// <summary>
/// Basic constructor that saves a reference to the parent
/// <see c_ref="GraphPane"/> object.
/// </summary>
/// <param name="pane">The parent <see c_ref="GraphPane"/> object.</param>
/// <param name="initialize">A <see c_ref="bool"/> flag to indicate whether or
/// not the drawing variables should be initialized. Initialization is not
/// required if this is part of a ZedGraph internal draw operation (i.e., its in
/// the middle of a call to <see c_ref="GraphPane.Draw"/>). Otherwise, you should
/// initialize to make sure the drawing variables are configured. true to do
/// an initialization, false otherwise.</param>
public ValueHandler( GraphPane pane, bool initialize )
{
_pane = pane;
if ( initialize )
{
// just create a dummy image, which results in a full draw operation
using ( Image image = pane.GetImage() )
{
}
}
}
示例2: ApplyToAllPanes
private void ApplyToAllPanes( GraphPane primaryPane )
{
foreach ( GraphPane pane in _masterPane._paneList )
{
if ( pane != primaryPane )
{
if ( _isSynchronizeXAxes )
Synchronize( primaryPane.XAxis, pane.XAxis );
if ( _isSynchronizeYAxes )
Synchronize( primaryPane.YAxis, pane.YAxis );
}
}
}
示例3: ZoomStateRestore
/// <summary>
/// Restore the states of the GraphPanes to a previously saved condition (via
/// <see c_ref="ZoomStateSave" />. This is essentially an "undo" for live
/// pan and scroll actions. Restores a single
/// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized
/// (see <see c_ref="IsSynchronizeXAxes" /> and <see c_ref="IsSynchronizeYAxes" />),
/// or save a list of states for all GraphPanes if the panes are synchronized.
/// </summary>
/// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations
/// are taking place</param>
private void ZoomStateRestore( GraphPane primaryPane )
{
if ( _isSynchronizeXAxes || _isSynchronizeYAxes )
{
for ( int i = 0; i < _masterPane._paneList.Count; i++ )
{
if ( i < _zoomStateStack.Count )
_zoomStateStack[i].ApplyState( _masterPane._paneList[i] );
}
}
else if ( _zoomState != null )
_zoomState.ApplyState( primaryPane );
ZoomStateClear();
}
示例4: DrawSingleBar
/// <summary>
/// Protected internal routine that draws the specified single bar (an individual "point")
/// of this series to the specified <see c_ref="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 c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="curve">A <see c_ref="CurveItem"/> object representing the
/// <see c_ref="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 c_ref="Axis"/> class instance that defines the base (independent)
/// axis for the <see c_ref="Bar"/></param>
/// <param name="valueAxis">The <see c_ref="Axis"/> class instance that defines the value (dependent)
/// axis for the <see c_ref="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 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>
virtual protected 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 )
Draw( g, pane, pixSide, pixSide + barWidth, pixLowVal,
pixHiVal, scaleFactor, true, curve.IsSelected,
curve.Points[index] );
else
Draw( g, pane, pixLowVal, pixHiVal, pixSide, pixSide + barWidth,
scaleFactor, true, curve.IsSelected,
curve.Points[index] );
}
}
示例5: ZoomStateSave
/// <summary>
/// Save the current states of the GraphPanes to a separate collection. Save a single
/// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized
/// (see <see c_ref="IsSynchronizeXAxes" /> and <see c_ref="IsSynchronizeYAxes" />),
/// or save a list of states for all GraphPanes if the panes are synchronized.
/// </summary>
/// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations
/// are taking place</param>
/// <param name="type">The <see c_ref="ZoomState.StateType" /> that describes the
/// current operation</param>
/// <returns>The <see c_ref="ZoomState" /> that corresponds to the
/// <see paramref="primaryPane" />.
/// </returns>
private ZoomState ZoomStateSave( GraphPane primaryPane, ZoomState.StateType type )
{
ZoomStateClear();
if ( _isSynchronizeXAxes || _isSynchronizeYAxes )
{
foreach ( GraphPane pane in _masterPane._paneList )
{
ZoomState state = new ZoomState( pane, type );
if ( pane == primaryPane )
_zoomState = state;
_zoomStateStack.Add( state );
}
}
else
_zoomState = new ZoomState( primaryPane, type );
return _zoomState;
}
示例6: MakeLabel
/// <summary>
/// Make a value label for an <see c_ref="AxisType.Date" /> <see c_ref="Axis" />.
/// </summary>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="index">
/// The zero-based, ordinal index of the label to be generated. For example, a value of 2 would
/// cause the third value label on the axis to be generated.
/// </param>
/// <param name="dVal">
/// The numeric value associated with the label. This value is ignored for log (<see c_ref="Scale.IsLog"/>)
/// and text (<see c_ref="Scale.IsText"/>) type axes.
/// </param>
/// <returns>The resulting value label as a <see c_ref="string" /></returns>
override internal string MakeLabel( GraphPane pane, int index, double dVal )
{
if ( _format == null )
_format = Default.Format;
return XDate.ToString( dVal, _format );
}
示例7: MakeLabel
/// <summary>
/// Make a value label for an <see c_ref="AxisType.LinearAsOrdinal" /> <see c_ref="Axis" />.
/// </summary>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="index">
/// The zero-based, ordinal index of the label to be generated. For example, a value of 2 would
/// cause the third value label on the axis to be generated.
/// </param>
/// <param name="dVal">
/// The numeric value associated with the label. This value is ignored for log (<see c_ref="Scale.IsLog"/>)
/// and text (<see c_ref="Scale.IsText"/>) type axes.
/// </param>
/// <returns>The resulting value label as a <see c_ref="string" /></returns>
override internal string MakeLabel( GraphPane pane, int index, double dVal )
{
if ( _format == null )
_format = Default.Format;
double val;
int tmpIndex = (int) dVal - 1;
if ( pane.CurveList.Count > 0 && pane.CurveList[0].Points.Count > tmpIndex )
{
val = pane.CurveList[0].Points[tmpIndex].X;
double scaleMult = Math.Pow( 10.0, _mag );
return ( val / scaleMult ).ToString( _format );
}
return string.Empty;
}
示例8: IsPrimary
/// <summary>
/// Determines if this <see c_ref="Axis" /> object is a "primary" one.
/// </summary>
/// <remarks>
/// The primary axes are the <see c_ref="XAxis" /> (always), the first
/// <see c_ref="YAxis" /> in the <see c_ref="GraphPane.YAxisList" />
/// (<see c_ref="CurveItem.YAxisIndex" /> = 0), and the first
/// <see c_ref="Y2Axis" /> in the <see c_ref="GraphPane.Y2AxisList" />
/// (<see c_ref="CurveItem.YAxisIndex" /> = 0). Note that
/// <see c_ref="GraphPane.YAxis" /> and <see c_ref="GraphPane.Y2Axis" />
/// always reference the primary axes.
/// </remarks>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <returns>true for a primary <see c_ref="Axis" /> (for the <see c_ref="XAxis" />,
/// this is always true), false otherwise</returns>
override internal bool IsPrimary( GraphPane pane )
{
return this == pane.XAxis;
}
示例9: IsCrossed
/*
override internal bool IsCrossed( GraphPane pane )
{
return !this.crossAuto && this.cross > pane.YAxis.Min && this.cross < pane.YAxis.Max;
}
*/
/// <summary>
/// Gets the "Cross" axis that corresponds to this axis.
/// </summary>
/// <remarks>
/// The cross axis is the axis which determines the of this Axis when the
/// <see c_ref="Axis.Cross" >Axis.Cross</see> property is used. The
/// cross axis for any <see c_ref="XAxis" /> or <see c_ref="X2Axis" />
/// is always the primary <see c_ref="YAxis" />, and
/// the cross axis for any <see c_ref="YAxis" /> or <see c_ref="Y2Axis" /> is
/// always the primary <see c_ref="XAxis" />.
/// </remarks>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
override public Axis GetCrossAxis( GraphPane pane )
{
return pane.YAxis;
}
示例10: CreateBarLabels
/// <summary>
/// Create a <see c_ref="TextObj" /> for each bar in the <see c_ref="GraphPane" />.
/// </summary>
/// <remarks>
/// This method will go through the bars, create a label that corresponds to the bar value,
/// and place it on the graph depending on user preferences. This works for horizontal or
/// vertical bars in clusters or stacks, but only for <see c_ref="BarItem" /> types. This method
/// does not apply to <see c_ref="ErrorBarItem" /> or <see c_ref="HiLowBarItem" /> objects.
/// Call this method only after calling <see c_ref="GraphPane.AxisChange()" />.
/// </remarks>
/// <param name="pane">The GraphPane in which to place the text labels.</param>
/// <param name="isBarCenter">true to center the labels inside the bars, false to
/// place the labels just above the top of the bar.</param>
/// <param name="valueFormat">The double.ToString string format to use for creating
/// the labels.
/// </param>
public static void CreateBarLabels( GraphPane pane, bool isBarCenter, string valueFormat )
{
CreateBarLabels( pane, isBarCenter, valueFormat, TextObj.Default.FontFamily,
TextObj.Default.FontSize, TextObj.Default.FontColor, TextObj.Default.FontBold,
TextObj.Default.FontItalic, TextObj.Default.FontUnderline );
}
示例11: Draw
/// <summary>
/// Do all rendering associated with this <see c_ref="BarItem"/> to the specified
/// <see c_ref="Graphics"/> device. This method is normally only
/// called by the Draw method of the parent <see c_ref="ZedGraph.CurveList"/>
/// collection 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 c_ref="ZedGraph.GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="pos">The ordinal position of the current <see c_ref="Bar"/>
/// curve.</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="ZedGraph.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>
override public void Draw( Graphics g, GraphPane pane, int pos,
float scaleFactor )
{
// Pass the drawing onto the bar class
if ( _isVisible )
_bar.DrawBars( g, pane, this, BaseAxis( pane ), ValueAxis( pane ),
GetBarWidth( pane ), pos, scaleFactor );
}
示例12: DrawLegendKey
/// <summary>
/// Draw a legend key entry for this <see c_ref="BarItem"/> at the specified location
/// </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 c_ref="ZedGraph.GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="rect">The <see c_ref="RectangleF"/> struct that specifies the
/// location for the legend key</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="ZedGraph.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>
override public void DrawLegendKey( Graphics g, GraphPane pane, RectangleF rect, float scaleFactor )
{
_bar.Draw( g, pane, rect, scaleFactor, true, false, null );
}
示例13: MakeLabel
/// <summary>
/// Make a value label for an <see c_ref="AxisType.Log" /> <see c_ref="Axis" />.
/// </summary>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="index">
/// The zero-based, ordinal index of the label to be generated. For example, a value of 2 would
/// cause the third value label on the axis to be generated.
/// </param>
/// <param name="dVal">
/// The numeric value associated with the label. This value is ignored for log (<see c_ref="Scale.IsLog"/>)
/// and text (<see c_ref="Scale.IsText"/>) type axes.
/// </param>
/// <returns>The resulting value label as a <see c_ref="string" /></returns>
override internal string MakeLabel( GraphPane pane, int index, double dVal )
{
if ( _format == null )
_format = Default.Format;
if ( _isUseTenPower )
return string.Format( "{0:F0}", dVal );
return Math.Pow( 10.0, dVal ).ToString( _format );
}
示例14: PickScale
/// <summary>
/// Select a reasonable base 10 logarithmic axis scale given a range of data values.
/// </summary>
/// <remarks>
/// This method only applies to <see c_ref="AxisType.Log"/> type axes, and it
/// is called by the general <see c_ref="PickScale"/> method. The scale range is chosen
/// based always on powers of 10 (full log cycles). This
/// method honors the <see c_ref="Scale.MinAuto"/>, <see c_ref="Scale.MaxAuto"/>,
/// and <see c_ref="Scale.MajorStepAuto"/> autorange settings.
/// In the event that any of the autorange settings are false, the
/// corresponding <see c_ref="Scale.Min"/>, <see c_ref="Scale.Max"/>, or <see c_ref="Scale.MajorStep"/>
/// setting is explicitly honored, and the remaining autorange settings (if any) will
/// be calculated to accomodate the non-autoranged values. For log axes, the MinorStep
/// value is not used.
/// <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.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.Log"/>
override public void PickScale( GraphPane pane, Graphics g, float scaleFactor )
{
// call the base class first
base.PickScale( pane, g, scaleFactor );
// Majorstep is always 1 for log scales
if ( _majorStepAuto )
_majorStep = 1.0;
_mag = 0; // Never use a magnitude shift for log scales
//this.numDec = 0; // The number of decimal places to display is not used
// Check for bad data range
if ( _min <= 0.0 && _max <= 0.0 )
{
_min = 1.0;
_max = 10.0;
}
else if ( _min <= 0.0 )
{
_min = _max / 10.0;
}
else if ( _max <= 0.0 )
{
_max = _min * 10.0;
}
// Test for trivial condition of range = 0 and pick a suitable default
if ( _max - _min < 1.0e-20 )
{
if ( _maxAuto )
_max = _max * 2.0;
if ( _minAuto )
_min = _min / 2.0;
}
// Get the nearest power of 10 (no partial log cycles allowed)
if ( _minAuto )
_min = Math.Pow( 10.0,
Math.Floor( Math.Log10( _min ) ) );
if ( _maxAuto )
_max = Math.Pow( 10.0,
Math.Ceiling( Math.Log10( _max ) ) );
}
示例15: SetupScaleData
/// <summary>
/// Setup some temporary transform values in preparation for rendering the <see c_ref="Axis"/>.
/// </summary>
/// <remarks>
/// This method is typically called by the parent <see c_ref="GraphPane"/>
/// object as part of the <see c_ref="GraphPane.Draw"/> method. It is also
/// called by <see c_ref="GraphPane.GeneralTransform(double,double,CoordType)"/> and
/// <see c_ref="GraphPane.ReverseTransform( PointF, out double, out double )"/>
/// methods to setup for coordinate transformations.
/// </remarks>
/// <param name="pane">
/// A reference to the <see c_ref="GraphPane"/> object that is the parent or
/// owner of this object.
/// </param>
/// <param name="axis">
/// The parent <see c_ref="Axis" /> for this <see c_ref="Scale" />
/// </param>
override public void SetupScaleData( GraphPane pane, Axis axis )
{
base.SetupScaleData( pane, axis );
_minLinTemp = Linearize( _min );
_maxLinTemp = Linearize( _max );
}