/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Axis( SerializationInfo info, StreamingContext context ) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32( "schema" ); _cross = info.GetDouble( "cross" ); _crossAuto = info.GetBoolean( "crossAuto" ); _majorTic = (MajorTic)info.GetValue( "MajorTic", typeof( MajorTic ) ); _minorTic = (MinorTic)info.GetValue( "MinorTic", typeof( MinorTic ) ); _majorGrid = (MajorGrid)info.GetValue( "majorGrid", typeof( MajorGrid ) ); _minorGrid = (MinorGrid)info.GetValue( "minorGrid", typeof( MinorGrid ) ); _isVisible = info.GetBoolean( "isVisible" ); _title = (AxisLabel) info.GetValue( "title", typeof( AxisLabel ) ); _minSpace = info.GetSingle( "minSpace" ); _color = (Color)info.GetValue( "color", typeof( Color ) ); _isAxisSegmentVisible = info.GetBoolean( "isAxisSegmentVisible" ); _axisGap = info.GetSingle( "axisGap" ); _scale = (Scale)info.GetValue( "scale", typeof( Scale ) ); _scale._ownerAxis = this; }
/// <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; }
/// <summary> /// Default constructor for <see cref="Axis"/> that sets all axis properties /// to default values as defined in the <see cref="Default"/> class. /// </summary> public Axis() { _scale = new LinearScale( this ); _cross = 0.0; _crossAuto = true; _majorTic = new MajorTic(); _minorTic = new MinorTic(); _majorGrid = new MajorGrid(); _minorGrid = new MinorGrid(); _axisGap = Default.AxisGap; _minSpace = Default.MinSpace; _isVisible = true; _isAxisSegmentVisible = Default.IsAxisSegmentVisible; _title = new AxisLabel( "", Default.TitleFontFamily, Default.TitleFontSize, Default.TitleFontColor, Default.TitleFontBold, Default.TitleFontUnderline, Default.TitleFontItalic ); _title.FontSpec.Fill = new Fill( Default.TitleFillColor, Default.TitleFillBrush, Default.TitleFillType ); _title.FontSpec.Border.IsVisible = false; _color = Default.Color; }
/// <summary> /// Copy constructor /// </summary> /// <param name="rhs">The source <see cref="MajorGrid" /> to be copied.</param> public MajorGrid( MajorGrid rhs ) : base(rhs) { _isZeroLine = rhs._isZeroLine; }
/// <summary> /// Copy constructor /// </summary> /// <param name="rhs">The source <see cref="MajorGrid" /> to be copied.</param> public MajorGrid(MajorGrid rhs) : base(rhs) { _isZeroLine = rhs._isZeroLine; }
internal void Draw(Graphics g, GraphPane pane, float scaleFactor, float shiftPos, bool drawGrid) { float rightPix, topPix; if (_ownerAxis is XAxis) { rightPix = pane.Chart._rect.Width; topPix = -pane.Chart._rect.Height; } else { rightPix = pane.Chart._rect.Height; topPix = -pane.Chart._rect.Width; } // sanity check if (_min >= _max) { return; } MajorGrid majorGrid = _ownerAxis._majorGrid; MajorTic majorTic = _ownerAxis._majorTic; MinorTic tic = _ownerAxis._minorTic; MinorGrid grid = _ownerAxis._minorGrid; if (!drawGrid) { Pen pen = new Pen(_ownerAxis.Color, pane.ScaledPenWidth(majorTic._penWidth, scaleFactor)); // redraw the axis border if (_ownerAxis.IsAxisSegmentVisible) { g.DrawLine(pen, 0.0F, shiftPos, rightPix, shiftPos); } // Draw a zero-value line if needed if (majorGrid._isZeroLine && _min < 0.0 && _max > 0.0) { float zeroPix = LocalTransform(0.0); g.DrawLine(pen, zeroPix, 0.0F, zeroPix, topPix); } _ownerAxis.DrawTitle(g, pane, 0, scaleFactor); } // draw the time scales that fit best bool[] drawThese = DrawWhich((_maxLinTemp - _minLinTemp)); // Note: the Draw*Labels routines draw tics or grids too if (drawThese[(int)DateUnit.Hour]) { DrawHourMinuteLabels(g, pane, tic, grid, drawGrid, topPix, rightPix, shiftPos, scaleFactor); shiftPos += _fontSpec.GetHeight(scaleFactor) * 1.1F; tic = majorTic; grid = majorGrid; } if (drawThese[(int)DateUnit.Day]) { DrawDayLabels(g, pane, tic, grid, drawGrid, topPix, rightPix, shiftPos, scaleFactor, !drawThese[(int)DateUnit.Month]); shiftPos += _fontSpec.GetHeight(scaleFactor) * 1.1F; tic = majorTic; grid = majorGrid; } if (drawThese[(int)DateUnit.Month]) { DrawMonthLabels(g, pane, tic, grid, drawGrid, topPix, rightPix, shiftPos, scaleFactor, !drawThese[(int)DateUnit.Year]); shiftPos += _fontSpec.GetHeight(scaleFactor) * 1.1F; } if (drawThese[(int)DateUnit.Year]) { DrawYearLabels(g, pane, majorTic, majorGrid, drawGrid, topPix, rightPix, shiftPos, scaleFactor); shiftPos += _fontSpec.GetHeight(scaleFactor) * 1.1F; } }