예제 #1
0
파일: PieItem.cs 프로젝트: 1907931256/jx
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see c_ref="PieItem"/> object from which to copy</param>
 public PieItem(PieItem rhs)
     : base(rhs)
 {
     _pieValue             = rhs._pieValue;
     _fill                 = rhs._fill.Clone();
     Border                = rhs._border.Clone();
     _displacement         = rhs._displacement;
     _labelDetail          = rhs._labelDetail.Clone();
     _labelType            = rhs._labelType;
     _valueDecimalDigits   = rhs._valueDecimalDigits;
     _percentDecimalDigits = rhs._percentDecimalDigits;
 }
예제 #2
0
파일: PieItem.cs 프로젝트: 1907931256/jx
        /// <summary>
        /// Build the string that will be displayed as the slice label as determined by
        /// <see c_ref="LabelType"/>.
        /// </summary>
        /// <param name="curve">reference to the <see c_ref="PieItem"/></param>
        private static void BuildLabelString(PieItem curve)
        {
            //set up label string formatting
            NumberFormatInfo labelFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            labelFormat.NumberDecimalDigits    = curve._valueDecimalDigits;
            labelFormat.PercentPositivePattern = 1;                                             //no space between number and % sign
            labelFormat.PercentDecimalDigits   = curve._percentDecimalDigits;

            switch (curve._labelType)
            {
            case PieLabelType.Value:
                curve._labelStr = curve._pieValue.ToString("F", labelFormat);
                break;

            case PieLabelType.Percent:
                curve._labelStr = (curve._sweepAngle / 360).ToString("P", labelFormat);
                break;

            case PieLabelType.Name_Value:
                curve._labelStr = curve._label._text + ": " + curve._pieValue.ToString("F", labelFormat);
                break;

            case PieLabelType.Name_Percent:
                curve._labelStr = curve._label._text + ": " + (curve._sweepAngle / 360).ToString("P", labelFormat);
                break;

            case PieLabelType.Name_Value_Percent:
                curve._labelStr = curve._label._text + ": " + curve._pieValue.ToString("F", labelFormat) +
                                  " (" + (curve._sweepAngle / 360).ToString("P", labelFormat) + ")";
                break;

            case PieLabelType.Name:
                curve._labelStr = curve._label._text;
                break;

            case PieLabelType.None:
            default:
                break;
            }
        }
예제 #3
0
파일: PieItem.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// Build the string that will be displayed as the slice label as determined by 
		/// <see c_ref="LabelType"/>.
		/// </summary>
		/// <param name="curve">reference to the <see c_ref="PieItem"/></param>
		private static void BuildLabelString( PieItem curve )
		{
			//set up label string formatting
			NumberFormatInfo labelFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

			labelFormat.NumberDecimalDigits = curve._valueDecimalDigits;
			labelFormat.PercentPositivePattern = 1;					//no space between number and % sign
			labelFormat.PercentDecimalDigits = curve._percentDecimalDigits;

			switch ( curve._labelType )
			{
				case PieLabelType.Value:
					curve._labelStr = curve._pieValue.ToString( "F", labelFormat );
					break;
				case PieLabelType.Percent:
					curve._labelStr = ( curve._sweepAngle / 360 ).ToString( "P", labelFormat );
					break;
				case PieLabelType.Name_Value:
					curve._labelStr = curve._label._text + ": " + curve._pieValue.ToString( "F", labelFormat );
					break;
				case PieLabelType.Name_Percent:
					curve._labelStr = curve._label._text + ": " + ( curve._sweepAngle / 360 ).ToString( "P", labelFormat );
					break;
				case PieLabelType.Name_Value_Percent:
					curve._labelStr = curve._label._text + ": " + curve._pieValue.ToString( "F", labelFormat ) +
						" (" + ( curve._sweepAngle / 360 ).ToString( "P", labelFormat ) + ")";
					break;
				case PieLabelType.Name:
					curve._labelStr = curve._label._text;
					break;
				case PieLabelType.None:
				default:
					break;
			}
		}
예제 #4
0
파일: PieItem.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// The Copy Constructor
		/// </summary>
		/// <param name="rhs">The <see c_ref="PieItem"/> object from which to copy</param>
		public PieItem( PieItem rhs )
			: base( rhs )
		{
			_pieValue = rhs._pieValue;
			_fill = rhs._fill.Clone();
			Border = rhs._border.Clone();
			_displacement = rhs._displacement;
			_labelDetail = rhs._labelDetail.Clone();
			_labelType = rhs._labelType;
			_valueDecimalDigits = rhs._valueDecimalDigits;
			_percentDecimalDigits = rhs._percentDecimalDigits;
		}
예제 #5
0
파일: GraphPane.cs 프로젝트: CareyGit/jx
		/// <summary>
		///Creates all the <see c_ref="PieItem"/>s for a single Pie Chart. 
		/// </summary>
		/// <param name="values">double array containing all <see c_ref="PieItem.Value"/>s
		/// for a single PieChart.
		/// </param>
		/// <param name="labels"> string array containing all <see c_ref="CurveItem.Label"/>s
		/// for a single PieChart.
		/// </param>
		/// <returns>an array containing references to all <see c_ref="PieItem"/>s comprising
		/// the Pie Chart.</returns>
		public PieItem[] AddPieSlices( double[] values, string[] labels )
		{
			PieItem[] slices = new PieItem[values.Length];
			for ( int x = 0; x < values.Length; x++ )
			{
				slices[x] = new PieItem( values[x], labels[x] );
				CurveList.Add( slices[x] );
			}
			return slices;
		}
예제 #6
0
파일: GraphPane.cs 프로젝트: CareyGit/jx
		/// <summary>
		/// Add a <see c_ref="PieItem"/> to the display, providing a gradient fill for the pie color.
		/// </summary>
		/// <param name="value">The value associated with this <see c_ref="PieItem"/> instance.</param>
		/// <param name="color1">The starting display color for the gradient <see c_ref="Fill"/> for this
		/// <see c_ref="PieItem"/> instance.</param>
		/// <param name="color2">The ending display color for the gradient <see c_ref="Fill"/> for this
		/// <see c_ref="PieItem"/> instance.</param>
		/// <param name="fillAngle">The angle for the gradient <see c_ref="Fill"/>.</param>
		/// <param name="displacement">The amount this <see c_ref="PieItem"/>  instance will be 
		/// displaced from the center point.</param>
		/// <param name="label">Text label for this <see c_ref="PieItem"/> instance.</param>
		public PieItem AddPieSlice( double value, Color color1, Color color2, float fillAngle,
						double displacement, string label )
		{
			PieItem slice = new PieItem( value, color1, color2, fillAngle, displacement, label );
			CurveList.Add( slice );
			return slice;
		}