Beispiel #1
0
		/// <summary>
		/// Copy constructor
		/// </summary>
		/// <param name="rhs">The source <see cref="Chart" /> to be copied.</param>
		public Chart( Chart rhs )
		{
			_border = rhs._border.Clone();
			_fill = rhs._fill.Clone();
			_rect = rhs._rect;
			_isRectAuto = rhs._isRectAuto;
		}
Beispiel #2
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The LineBase object from which to copy</param>
        public LineBase( LineBase rhs )
        {
            _width = rhs._width;
            _style = rhs._style;
            _customDashes = rhs._customDashes;
            _dashOn = rhs._dashOn;
            _dashOff = rhs._dashOff;

            _isVisible = rhs._isVisible;
            _color = rhs._color;

            _isAntiAlias = rhs._isAntiAlias;
            _gradientFill = new Fill( rhs._gradientFill );
        }
Beispiel #3
0
        /// <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 PieItem( SerializationInfo info, StreamingContext context )
            : base(info, 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( "schema2" );

            _displacement = info.GetDouble( "displacement" );
            _labelDetail = (TextObj)info.GetValue( "labelDetail", typeof( TextObj ) );
            _fill = (Fill)info.GetValue( "fill", typeof( Fill ) );
            _border = (Border)info.GetValue( "border", typeof( Border ) );
            _pieValue = info.GetDouble( "pieValue" );
            _labelType = (PieLabelType)info.GetValue( "labelType", typeof( PieLabelType ) );
            _intersectionPoint = (PointF)info.GetValue( "intersectionPoint", typeof( PointF ) );
            _boundingRectangle = (RectangleF)info.GetValue( "boundingRectangle", typeof( RectangleF ) );
            _pivotPoint = (PointF)info.GetValue( "pivotPoint", typeof( PointF ) );
            _endPoint = (PointF)info.GetValue( "endPoint", typeof( PointF ) );
            // _slicePath = (GraphicsPath)info.GetValue( "slicePath", typeof( GraphicsPath ) );
            _startAngle = (float)info.GetDouble( "startAngle" );
            _sweepAngle = (float)info.GetDouble( "sweepAngle" );
            _midAngle = (float)info.GetDouble( "midAngle" );
            _labelStr = info.GetString( "labelStr" );
            _valueDecimalDigits = info.GetInt32( "valueDecimalDigits" );
            _percentDecimalDigits = info.GetInt32( "percentDecimalDigits" );
        }
Beispiel #4
0
 /// <summary>
 /// Create a new <see cref="PieItem"/>.
 /// </summary>
 /// <param name="pieValue">The value associated with this <see cref="PieItem"/> instance.</param>
 /// <param name="color">The display color for this <see cref="PieItem"/> instance.</param>
 /// <param name="displacement">The amount this <see cref="PieItem"/>  instance will be 
 /// displaced from the center point.</param>
 /// <param name="label">Text label for this <see cref="PieItem"/> instance.</param>
 public PieItem( double pieValue, Color color, double displacement, string label )
     : base(label)
 {
     _pieValue = pieValue;
     _fill = new Fill( color.IsEmpty ? _rotator.NextColor : color );
     _displacement = displacement;
     _border = new Border( Default.BorderColor, Default.BorderWidth );
     _labelDetail = new TextObj();
     _labelDetail.FontSpec.Size = Default.FontSize;
     _labelType = Default.LabelType;
     _valueDecimalDigits = Default.ValueDecimalDigits;
     _percentDecimalDigits = Default.PercentDecimalDigits;
     _slicePath = null;
 }
Beispiel #5
0
        /// <summary>
        /// Create a fill brush using current properties.  This method will construct a brush based on the
        /// settings of <see cref="ZedGraph.Fill.Type"/>, <see cref="ZedGraph.Fill.Color"/>
        /// and <see cref="ZedGraph.Fill.Brush"/>.  If
        /// <see cref="ZedGraph.Fill.Type"/> is set to <see cref="ZedGraph.FillType.Brush"/> and
        /// <see cref="ZedGraph.Fill.Brush"/>
        /// is null, then a <see cref="LinearGradientBrush"/> will be created between the colors of
        /// <see cref="System.Drawing.Color.White"/> and <see cref="ZedGraph.Fill.Color"/>.
        /// </summary>
        /// <param name="rect">A rectangle that bounds the object to be filled.  This determines
        /// the start and end of the gradient fill.</param>
        /// <param name="dataValue">The data value to be used for a value-based
        /// color gradient.  This is only applicable for <see cref="FillType.GradientByX"/>,
        /// <see cref="FillType.GradientByY"/> or <see cref="FillType.GradientByZ"/>.</param>
        /// <returns>A <see cref="System.Drawing.Brush"/> class representing the fill brush</returns>
        public Brush MakeBrush( RectangleF rect, PointPair dataValue )
        {
            // get a brush
            if ( this.IsVisible && ( !_color.IsEmpty || _brush != null ) )
            {
                if ( rect.Height < 1.0F )
                    rect.Height = 1.0F;
                if ( rect.Width < 1.0F )
                    rect.Width = 1.0F;

                //Brush	brush;
                if ( _type == FillType.Brush )
                {
                    return ScaleBrush( rect, _brush, _isScaled );
                }
                else if ( IsGradientValueType )
                {
                    if ( dataValue != null )
                    {
                        if ( !_secondaryValueGradientColor.IsEmpty )
                        {
                            // Go ahead and create a new Fill so we can do all the scaling, etc.,
                            // that is associated with a gradient
                            Fill tmpFill = new Fill( _secondaryValueGradientColor,
                                    GetGradientColor( dataValue ), _angle );
                            return tmpFill.MakeBrush( rect );
                        }
                        else
                            return new SolidBrush( GetGradientColor( dataValue ) );
                    }
                    else if ( _rangeDefault != double.MaxValue )
                    {
                        if ( !_secondaryValueGradientColor.IsEmpty )
                        {
                            // Go ahead and create a new Fill so we can do all the scaling, etc.,
                            // that is associated with a gradient
                            Fill tmpFill = new Fill( _secondaryValueGradientColor,
                                    GetGradientColor( _rangeDefault ), _angle );
                            return tmpFill.MakeBrush( rect );
                        }
                        else
                            return new SolidBrush( GetGradientColor( _rangeDefault ) );
                    }
                    else
                        return ScaleBrush( rect, _brush, true );
                }
                else
                    return new SolidBrush( _color );
            }

            // Always return a suitable default
            return new SolidBrush( Color.White );
        }
Beispiel #6
0
		/// <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 PaneBase( 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" );

			_rect = (RectangleF) info.GetValue( "rect", typeof(RectangleF) );
			_legend = (Legend) info.GetValue( "legend", typeof(Legend) );
			_title = (GapLabel) info.GetValue( "title", typeof(GapLabel) );
			//this.isShowTitle = info.GetBoolean( "isShowTitle" );
			_isFontsScaled = info.GetBoolean( "isFontsScaled" );
			_isPenWidthScaled = info.GetBoolean( "isPenWidthScaled" );
			//this.fontSpec = (FontSpec) info.GetValue( "fontSpec" , typeof(FontSpec) );
			_titleGap = info.GetSingle( "titleGap" );
			_fill = (Fill) info.GetValue( "fill", typeof(Fill) );
			_border = (Border) info.GetValue( "border", typeof(Border) );
			_baseDimension = info.GetSingle( "baseDimension" );
			_margin = (Margin)info.GetValue( "margin", typeof( Margin ) );
			_graphObjList = (GraphObjList) info.GetValue( "graphObjList", typeof(GraphObjList) );

			_tag = info.GetValue( "tag", typeof(object) );

		}
Beispiel #7
0
		/// <summary>
		/// Default constructor for the <see cref="PaneBase"/> class.  Specifies the <see cref="Title"/> of
		/// the <see cref="PaneBase"/>, and the size of the <see cref="Rect"/>.
		/// </summary>
		public PaneBase( string title, RectangleF paneRect )
		{
			_rect = paneRect;

			_legend = new Legend();
				
			_baseDimension = Default.BaseDimension;
			_margin = new Margin();
			_titleGap = Default.TitleGap;

			_isFontsScaled = Default.IsFontsScaled;
			_isPenWidthScaled = Default.IsPenWidthScaled;
			_fill = new Fill( Default.FillColor );
			_border = new Border( Default.IsBorderVisible, Default.BorderColor,
				Default.BorderPenWidth );

			_title = new GapLabel( title, Default.FontFamily,
				Default.FontSize, Default.FontColor, Default.FontBold,
				Default.FontItalic, Default.FontUnderline );
			_title._fontSpec.Fill.IsVisible = false;
			_title._fontSpec.Border.IsVisible = false;

			_graphObjList = new GraphObjList();
			
			_tag = null;
		}
Beispiel #8
0
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The XAxis object from which to copy</param>
		public Legend( Legend rhs )
		{
			_rect = rhs.Rect;
			_position = rhs.Position;
			_isHStack = rhs.IsHStack;
			_isVisible = rhs.IsVisible;

			_location = rhs.Location;
			_border = rhs.Border.Clone();
			_fill = rhs.Fill.Clone();

			_fontSpec = rhs.FontSpec.Clone();

			_gap = rhs._gap;

			_isReverse = rhs._isReverse;

			_isShowLegendSymbols = rhs._isShowLegendSymbols;
		}
Beispiel #9
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 = GetBarWidth(pane, baseAxis, scaleFactor);

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

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

                                if (!curve.IsSelected && this._gradientFill.IsGradientValueType)
                                {
                                    using (Pen tPen = GetPen(pane, scaleFactor, pt))
                                        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
                                {
                                    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);
                                }
                            }
                        }
                    }
            }
        }
        /// <summary>
        /// Do all rendering associated with this <see cref="PieItem"/> item to the specified
        /// <see cref="Graphics"/> device.  This method is normally only
        /// called by the Draw method of the parent <see cref="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 cref="ZedGraph.GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="pos">Not used for rendering Pies</param>param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="ZedGraph.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 public void Draw(Graphics g, GraphPane pane, int pos, float scaleFactor)
        {
            if (pane.Chart._rect.Width <= 0 && pane.Chart._rect.Height <= 0)
            {
                //pane.PieRect = RectangleF.Empty;
                _slicePath = null;
            }
            else
            {
                //pane.PieRect = CalcPieRect( g, pane, scaleFactor, pane.ChartRect );
                CalcPieRect(g, pane, scaleFactor, pane.Chart._rect);

                _slicePath = new GraphicsPath();

                if (!_isVisible)
                {
                    return;
                }

                RectangleF tRect = _boundingRectangle;

                if (tRect.Width >= 1 && tRect.Height >= 1)
                {
                    SmoothingMode sMode = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.AntiAlias;

                    Fill   tFill   = _fill;
                    Border tBorder = _border;
                    if (this.IsSelected)
                    {
                        tFill   = Selection.Fill;
                        tBorder = Selection.Border;
                    }

                    using (Brush brush = tFill.MakeBrush(_boundingRectangle))
                    {
                        g.FillPie(brush, tRect.X, tRect.Y, tRect.Width, tRect.Height, this.StartAngle, this.SweepAngle);

                        //add GraphicsPath for hit testing
                        _slicePath.AddPie(tRect.X, tRect.Y, tRect.Width, tRect.Height,
                                          this.StartAngle, this.SweepAngle);

                        if (this.Border.IsVisible)
                        {
                            using (Pen borderPen = tBorder.GetPen(pane, scaleFactor))
                            {
                                g.DrawPie(borderPen, tRect.X, tRect.Y, tRect.Width, tRect.Height,
                                          this.StartAngle, this.SweepAngle);
                            }
                        }

                        if (_labelType != PieLabelType.None)
                        {
                            DrawLabel(g, pane, tRect, scaleFactor);
                        }
                    }

                    g.SmoothingMode = sMode;
                }
            }
        }
Beispiel #11
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Chart()
 {
     _isRectAuto = true;
     _border     = new Border(Default.IsBorderVisible, Default.BorderColor, Default.BorderPenWidth);
     _fill       = new Fill(Default.FillColor, Default.FillBrush, Default.FillType);
 }
Beispiel #12
0
 /// <overloads>Constructors for the <see cref="BoxObj"/> object</overloads>
 /// <summary>
 /// A constructor that allows the position, border color, and solid fill color
 /// of the <see cref="BoxObj"/> to be pre-specified.
 /// </summary>
 /// <param name="borderColor">An arbitrary <see cref="System.Drawing.Color"/> specification
 /// for the box border</param>
 /// <param name="fillColor">An arbitrary <see cref="System.Drawing.Color"/> specification
 /// for the box fill (will be a solid color fill)</param>
 /// <param name="x">The x location for this <see cref="BoxObj" />.  This will be in units determined by
 /// <see cref="ZedGraph.Location.CoordinateFrame" />.</param>
 /// <param name="y">The y location for this <see cref="BoxObj" />.  This will be in units determined by
 /// <see cref="ZedGraph.Location.CoordinateFrame" />.</param>
 /// <param name="width">The width of this <see cref="BoxObj" />.  This will be in units determined by
 /// <see cref="ZedGraph.Location.CoordinateFrame" />.</param>
 /// <param name="height">The height of this <see cref="BoxObj" />.  This will be in units determined by
 /// <see cref="ZedGraph.Location.CoordinateFrame" />.</param>
 public BoxObj(double x, double y, double width, double height, Color borderColor, Color fillColor)
     : base(x, y, width, height)
 {
     Border = new Border(borderColor, Default.PenWidth);
     Fill   = new Fill(fillColor);
 }
Beispiel #13
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The Bar object from which to copy</param>
 public Bar(Bar rhs)
 {
     _border = (Border)rhs.Border.Clone();
     _fill   = (Fill)rhs.Fill.Clone();
 }
Beispiel #14
0
		/// <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 BoxObj( SerializationInfo info, StreamingContext context ) : base( info, 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( "schema2" );

			_fill = (Fill) info.GetValue( "fill", typeof(Fill) );
			_border = (Border) info.GetValue( "border", typeof(Border) );
		}
Beispiel #15
0
 /// <summary>
 /// Constructor that sets the color property to the specified value, and sets
 /// the remaining <see cref="Line"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="color">The color to assign to this new Line object</param>
 public Line(Color color)
 {
     _width = Default.Width;
     _style = Default.Style;
     _dashOn = Default.DashOn;
     _dashOff = Default.DashOff;
     _isVisible = Default.IsVisible;
     _color = color.IsEmpty ? Default.Color : color;
     _stepType = Default.StepType;
     _isAntiAlias = Default.IsAntiAlias;
     _isSmooth = Default.IsSmooth;
     _smoothTension = Default.SmoothTension;
     _fill = new Fill(Default.FillColor, Default.FillBrush, Default.FillType);
 }
Beispiel #16
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The Bar object from which to copy</param>
 public Bar( Bar rhs )
 {
     this.border = (Border) rhs.Border.Clone();
      this.fill = (Fill) rhs.Fill.Clone();
 }
Beispiel #17
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The Line object from which to copy</param>
        public Line(Line rhs)
        {
            _width = rhs._width;
            _style = rhs._style;
            _dashOn = rhs._dashOn;
            _dashOff = rhs._dashOff;

            _isVisible = rhs._isVisible;
            _color = rhs._color;
            _stepType = rhs._stepType;
            _isAntiAlias = rhs._isAntiAlias;
            _isSmooth = rhs._isSmooth;
            _smoothTension = rhs._smoothTension;
            _fill = rhs._fill.Clone();
        }
Beispiel #18
0
 /// <summary>
 /// Default constructor that sets the
 /// <see cref="Color"/> as specified, and the remaining
 /// <see cref="Bar"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// The specified color is only applied to the
 /// <see cref="ZedGraph.Fill.Color"/>, and the <see cref="ZedGraph.LineBase.Color"/>
 /// will be defaulted.
 /// </summary>
 /// <param name="color">A <see cref="Color"/> value indicating
 /// the <see cref="ZedGraph.Fill.Color"/>
 /// of the Bar.
 /// </param>
 public Bar(Color color)
 {
     _border = new Border(Default.IsBorderVisible, Default.BorderColor, Default.BorderWidth);
     _fill   = new Fill(color.IsEmpty ? Default.FillColor : color,
                        Default.FillBrush, Default.FillType);
 }
Beispiel #19
0
        /// <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 Line(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");

            _width = info.GetSingle("width");
            _style = (DashStyle) info.GetValue("style", typeof (DashStyle));
            if (schema >= 11)
            {
                _dashOn = info.GetSingle("dashOn");
                _dashOff = info.GetSingle("dashOff");
            }
            _isVisible = info.GetBoolean("isVisible");
            _isAntiAlias = info.GetBoolean("isAntiAlias");
            _isSmooth = info.GetBoolean("isSmooth");
            _smoothTension = info.GetSingle("smoothTension");
            _color = (Color) info.GetValue("color", typeof (Color));
            _stepType = (StepType) info.GetValue("stepType", typeof (StepType));
            _fill = (Fill) info.GetValue("fill", typeof (Fill));
        }
Beispiel #20
0
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The <see cref="PaneBase"/> object from which to copy</param>
		public PaneBase( PaneBase rhs )
		{
			// copy over all the value types
			_isFontsScaled = rhs._isFontsScaled;
			_isPenWidthScaled = rhs._isPenWidthScaled;

			_titleGap = rhs._titleGap;
			_baseDimension = rhs._baseDimension;
			_margin = rhs._margin.Clone();
			_rect = rhs._rect;

			// Copy the reference types by cloning
			_fill = rhs._fill.Clone();
			_border = rhs._border.Clone();
			_title = rhs._title.Clone();

			_legend = rhs.Legend.Clone();
			_title = rhs._title.Clone();
			_graphObjList = rhs._graphObjList.Clone();
			
			if ( rhs._tag is ICloneable )
				_tag = ((ICloneable) rhs._tag).Clone();
			else
				_tag = rhs._tag;
		}
 /// <summary>
 /// Constructor that sets the color property to the specified value, and sets
 /// the remaining <see cref="Line"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="color">The color to assign to this new Line object</param>
 public Line( Color color )
 {
     _color = color.IsEmpty ? Default.Color : color;
     _stepType = Default.StepType;
     _isSmooth = Default.IsSmooth;
     _smoothTension = Default.SmoothTension;
     _fill = new Fill( Default.FillColor, Default.FillBrush, Default.FillType );
 }
Beispiel #22
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The Fill object from which to copy</param>
        public Fill( Fill rhs )
        {
            _color = rhs._color;
            _secondaryValueGradientColor = rhs._color;

            if ( rhs._brush != null )
                _brush = (Brush) rhs._brush.Clone();
            else
                _brush = null;
            _type = rhs._type;
            _alignH = rhs.AlignH;
            _alignV = rhs.AlignV;
            _isScaled = rhs.IsScaled;
            _rangeMin = rhs._rangeMin;
            _rangeMax = rhs._rangeMax;
            _rangeDefault = rhs._rangeDefault;
            _gradientBM = null;

            if ( rhs._colorList != null )
                _colorList = (Color[]) rhs._colorList.Clone();
            else
                _colorList = null;

            if ( rhs._positionList != null )
            {
                _positionList = (float[]) rhs._positionList.Clone();
            }
            else
                _positionList = null;

            if ( rhs._image != null )
                _image = (Image) rhs._image.Clone();
            else
                _image = null;

            _angle = rhs._angle;
            _wrapMode = rhs._wrapMode;
        }
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The Line object from which to copy</param>
 public Line( Line rhs )
 {
     _stepType = rhs._stepType;
     _isSmooth = rhs._isSmooth;
     _smoothTension = rhs._smoothTension;
     _fill = rhs._fill.Clone();
 }
Beispiel #24
0
 /// <summary>
 /// Create a new <see cref="PieItem"/>, providing a gradient fill for the pie color.
 /// </summary>
 /// <param name="pieValue">The value associated with this <see cref="PieItem"/> instance.</param>
 /// <param name="color1">The starting display color for the gradient <see cref="Fill"/> for this
 /// <see cref="PieItem"/> instance.</param>
 /// <param name="color2">The ending display color for the gradient <see cref="Fill"/> for this
 /// <see cref="PieItem"/> instance.</param>
 /// <param name="fillAngle">The angle for the gradient <see cref="Fill"/>.</param>
 /// <param name="displacement">The amount this <see cref="PieItem"/>  instance will be 
 /// displaced from the center point.</param>
 /// <param name="label">Text label for this <see cref="PieItem"/> instance.</param>
 public PieItem( double pieValue, Color color1, Color color2, float fillAngle,
     double displacement, string label)
     : this(pieValue, color1, displacement, label)
 {
     if ( !color1.IsEmpty && !color2.IsEmpty )
         _fill = new Fill( color1, color2, fillAngle );
 }
        /// <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 Line( SerializationInfo info, StreamingContext context )
            : base(info, 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" );

            _isSmooth = info.GetBoolean( "isSmooth" );
            _smoothTension = info.GetSingle( "smoothTension" );
            _stepType = (StepType)info.GetValue( "stepType", typeof( StepType ) );
            _fill = (Fill)info.GetValue( "fill", typeof( Fill ) );
        }
Beispiel #26
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="PieItem"/> object from which to copy</param>
 public PieItem( PieItem rhs )
     : base(rhs)
 {
     _pieValue = rhs._pieValue;
     _fill = rhs._fill.Clone();
     this.Border = rhs._border.Clone();
     _displacement = rhs._displacement;
     _labelDetail = rhs._labelDetail.Clone();
     _labelType = rhs._labelType;
     _valueDecimalDigits = rhs._valueDecimalDigits;
     _percentDecimalDigits = rhs._percentDecimalDigits;
 }
Beispiel #27
0
 /// <summary>
 /// Constructor that sets the color property to the specified value, and sets
 /// the remaining <see cref="Line"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="color">The color to assign to this new Line object</param>
 public Line( Color color )
 {
     this.width = Default.Width;
     this.style = Default.Style;
     this.isVisible = Default.IsVisible;
     this.color = color.IsEmpty ? Default.Color : color;
     this.stepType = Default.StepType;
     this.isSmooth = Default.IsSmooth;
     this.smoothTension = Default.SmoothTension;
     this.fill = new Fill( Default.FillColor, Default.FillBrush, Default.FillType );
 }
Beispiel #28
0
 /// <summary>
 /// Constructor that sets the color property to the specified value, and sets
 /// the remaining <see cref="LineBase"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <param name="color">The color to assign to this new Line object</param>
 public LineBase( Color color )
 {
     _width = Default.Width;
     _style = Default.Style;
     _customDashes = Default.CustomDashes;
     _dashOn = Default.DashOn;
     _dashOff = Default.DashOff;
     _isVisible = Default.IsVisible;
     _color = color.IsEmpty ? Default.Color : color;
     _isAntiAlias = Default.IsAntiAlias;
     _gradientFill = new Fill( Color.Red, Color.White );
     _gradientFill.Type = FillType.None;
 }
Beispiel #29
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The Line object from which to copy</param>
 public Line( Line rhs )
 {
     width = rhs.Width;
     style = rhs.Style;
     isVisible = rhs.IsVisible;
     color = rhs.Color;
     stepType = rhs.StepType;
     isSmooth = rhs.IsSmooth;
     smoothTension = rhs.SmoothTension;
     fill = (Fill) rhs.Fill.Clone();
 }
Beispiel #30
0
        /// <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 LineBase( 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( "schema0" );

            _width = info.GetSingle( "width" );
            _style = (DashStyle)info.GetValue( "style", typeof( DashStyle ) );
            _customDashes = (CustomDashStyle) info.GetValue("customDashes", typeof(CustomDashStyle));
            _dashOn = info.GetSingle( "dashOn" );
            _dashOff = info.GetSingle( "dashOff" );
            _isVisible = info.GetBoolean( "isVisible" );
            _isAntiAlias = info.GetBoolean( "isAntiAlias" );
            _color = (Color)info.GetValue( "color", typeof( Color ) );
            _gradientFill = (Fill)info.GetValue( "gradientFill", typeof( Fill ) );
        }
Beispiel #31
0
        /// <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 GasGaugeRegion(SerializationInfo info, StreamingContext context)
            : base(info, 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("schema2");

            _labelDetail = (TextObj) info.GetValue("labelDetail", typeof (TextObj));
            _fill = (Fill) info.GetValue("fill", typeof (Fill));
            _border = (Border) info.GetValue("border", typeof (Border));
            _color = (Color) info.GetValue("color", typeof (Color));
            _minValue = info.GetDouble("minValue");
            _maxValue = info.GetDouble("maxValue");
            _startAngle = (float) info.GetDouble("startAngle");
            _sweepAngle = (float) info.GetDouble("sweepAngle");
            _boundingRectangle = (RectangleF) info.GetValue("boundingRectangle", typeof (RectangleF));
            _slicePath = (GraphicsPath) info.GetValue("slicePath", typeof (GraphicsPath));
        }
Beispiel #32
0
 /// <summary>
 /// Default constructor that sets the 
 /// <see cref="Color"/> as specified, and the remaining
 /// <see cref="Bar"/> properties to default
 /// values as defined in the <see cref="Default"/> class.
 /// The specified color is only applied to the
 /// <see cref="ZedGraph.Fill.Color"/>, and the <see cref="ZedGraph.Border.Color"/>
 /// will be defaulted.
 /// </summary>
 /// <param name="color">A <see cref="Color"/> value indicating
 /// the <see cref="ZedGraph.Fill.Color"/>
 /// of the Bar.
 /// </param>
 public Bar( Color color )
 {
     this.border = new Border( Default.IsBorderVisible, Default.BorderColor, Default.BorderWidth );
      this.fill = new Fill( color.IsEmpty ? Default.FillColor : color,
           Default.FillBrush, Default.FillType );
 }
Beispiel #33
0
        /// <summary>
        /// Calculate the values needed to properly display this <see cref="GasGaugeRegion"/>.
        /// </summary>
        /// <param name="pane">
        /// A graphic device object to be drawn into. This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        public static void CalculateGasGuageParameters(GraphPane pane)
        {
            //loop thru slices and get total value and maxDisplacement
            double minVal = double.MaxValue;
            double maxVal = double.MinValue;
            foreach (CurveItem curve in pane.CurveList)
                if (curve is GasGaugeRegion) {
                    GasGaugeRegion ggr = (GasGaugeRegion) curve;
                    if (maxVal < ggr.MaxValue)
                        maxVal = ggr.MaxValue;

                    if (minVal > ggr.MinValue)
                        minVal = ggr.MinValue;
                }

            //Calculate start and sweep angles for each of the GasGaugeRegion based on teh min and max value
            foreach (CurveItem curve in pane.CurveList) {
                if (curve is GasGaugeRegion) {
                    GasGaugeRegion ggr = (GasGaugeRegion) curve;
                    float start = ((float) ggr.MinValue - (float) minVal)/((float) maxVal - (float) minVal)*180.0f;
                    float sweep = ((float) ggr.MaxValue - (float) minVal)/((float) maxVal - (float) minVal)*180.0f;
                    sweep = sweep - start;

                    Fill f = new Fill(Color.White, ggr.RegionColor, -(sweep/2f));
                    ggr.Fill = f;

                    ggr.StartAngle = start;
                    ggr.SweepAngle = sweep;
                }
            }
        }
Beispiel #34
0
		/// <summary>
		/// Default constructor that sets all <see cref="Legend"/> properties to default
		/// values as defined in the <see cref="Default"/> class.
		/// </summary>
		public Legend()
		{
			_position = Default.Position;
			_isHStack = Default.IsHStack;
			_isVisible = Default.IsVisible;
			this.Location = new Location( 0, 0, CoordType.PaneFraction );

			_fontSpec = new FontSpec( Default.FontFamily, Default.FontSize,
				Default.FontColor, Default.FontBold,
				Default.FontItalic, Default.FontUnderline,
				Default.FontFillColor, Default.FontFillBrush,
				Default.FontFillType );
			_fontSpec.Border.IsVisible = false;

			_border = new Border( Default.IsBorderVisible, Default.BorderColor, Default.BorderWidth );
			_fill = new Fill( Default.FillColor, Default.FillBrush, Default.FillType );

			_gap = Default.Gap;

			_isReverse = Default.IsReverse;

			_isShowLegendSymbols = Default.IsShowLegendSymbols;
		}
Beispiel #35
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The Bar object from which to copy</param>
 public Bar(Bar rhs)
 {
     _border = rhs.Border.Clone();
     _fill = rhs.Fill.Clone();
 }
Beispiel #36
0
		/// <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 Legend( 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" );

			_position = (LegendPos)info.GetValue( "position", typeof( LegendPos ) );
			_isHStack = info.GetBoolean( "isHStack" );
			_isVisible = info.GetBoolean( "isVisible" );
			_fill = (Fill)info.GetValue( "fill", typeof( Fill ) );
			_border = (Border)info.GetValue( "border", typeof( Border ) );
			_fontSpec = (FontSpec)info.GetValue( "fontSpec", typeof( FontSpec ) );
			_location = (Location)info.GetValue( "location", typeof( Location ) );

			_gap = info.GetSingle( "gap" );

			if ( schema >= 11 )
				_isReverse = info.GetBoolean( "isReverse" );

			if ( schema >= 12 )
				_isShowLegendSymbols = info.GetBoolean( "isShowLegendSymbols" );
		}
Beispiel #37
0
        /// <summary>
        /// Draw this <see cref="CurveItem"/> to the specified <see cref="Graphics"/>
        /// device as a symbol at each defined point.  The routine
        /// only draws the symbols; the lines are draw by the
        /// <see cref="Line.DrawCurve"/> method.  This method
        /// is normally only called by the Draw method of the
        /// <see cref="CurveItem"/> 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="LineItem"/> representing this
        /// curve.</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, LineItem curve, float scaleFactor)
        {
            float      tmpX, tmpY;
            double     curX, curY, lowVal;
            IPointList points = curve.Points;

            if (points != null && (_border.IsVisible || _fill.IsVisible))
            {
                SmoothingMode sModeSave = g.SmoothingMode;
                if (_isAntiAlias)
                {
                    g.SmoothingMode = SmoothingMode.HighQuality;
                }

                // For the sake of speed, go ahead and create a solid brush and a pen
                // If it's a gradient fill, it will be created on the fly for each symbol
                //SolidBrush	brush = new SolidBrush( this.fill.Color );

                using (Pen pen = _border.MakePen(pane.IsPenWidthScaled, scaleFactor))
                    using (GraphicsPath path = MakePath(g, scaleFactor))
                    {
                        RectangleF rect = path.GetBounds();

                        using (Brush brush = Fill.MakeBrush(rect))
                        {
                            var   valueHandler = new ValueHandler(pane, false);
                            Scale xScale       = pane.XAxis.Scale;
                            Scale yScale       = curve.GetYAxis(pane).Scale;

                            bool xIsLog = xScale.IsLog;
                            bool yIsLog = yScale.IsLog;

                            // Loop over each defined point
                            for (int i = 0; i < points.Count; i++)
                            {
                                // Get the user scale values for the current point
                                // use the valueHandler only for stacked types
                                if (pane.LineType == LineType.Stack)
                                {
                                    valueHandler.GetValues(curve, i, out curX, out lowVal, out curY);
                                }
                                // otherwise, just access the values directly.  Avoiding the valueHandler for
                                // non-stacked types is an optimization to minimize overhead in case there are
                                // a large number of points.
                                else
                                {
                                    curX = points[i].X;
                                    if (curve is StickItem)
                                    {
                                        curY = points[i].Z;
                                    }
                                    else
                                    {
                                        curY = points[i].Y;
                                    }
                                }

                                // 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 (curX != PointPair.Missing &&
                                    curY != PointPair.Missing &&
                                    !Double.IsNaN(curX) &&
                                    !Double.IsNaN(curY) &&
                                    !Double.IsInfinity(curX) &&
                                    !Double.IsInfinity(curY) &&
                                    (curX > 0 || !xIsLog) &&
                                    (!yIsLog || curY > 0.0))
                                {
                                    // Transform the user scale values to pixel locations
                                    tmpX = xScale.Transform(curve.IsOverrideOrdinal, i, curX);
                                    tmpY = yScale.Transform(curve.IsOverrideOrdinal, i, curY);

                                    // If the fill type for this symbol is a Gradient by value type,
                                    // the make a brush corresponding to the appropriate current value
                                    if (_fill.IsGradientValueType)
                                    {
                                        using (Brush tBrush = _fill.MakeBrush(rect, points[i]))
                                            DrawSymbol(g, tmpX, tmpY, path, pen, tBrush);
                                    }
                                    else
                                    {
                                        // Otherwise, the brush is already defined
                                        // Draw the symbol at the specified pixel location
                                        DrawSymbol(g, tmpX, tmpY, path, pen, brush);
                                    }
                                }
                            }
                        }
                    }

                g.SmoothingMode = sModeSave;
            }
        }