Пример #1
0
 private void chart1_FormatNumber(object sender, System.Windows.Forms.DataVisualization.Charting.FormatNumberEventArgs e)
 {
     if (e.ElementType == System.Windows.Forms.DataVisualization.Charting.ChartElementType.AxisLabels)
     {
         if (e.Format == "customY")
         {
             e.LocalizedValue = MainScanItem.LogItem.DoFracture(e.Value.ToString()) + " " + currency;
         }
     }
 }
Пример #2
0
 private void chart1_FormatNumber(object sender, FormatNumberEventArgs e)
 {
 }
Пример #3
0
 private void OnFormatNumberEvent(object sender, FormatNumberEventArgs e)
 {
     if (e.ElementType == ChartElementType.AxisLabels)
     {
         if (e.Format == "FormatBytes")
         {
             e.LocalizedValue = Util.FormatBytes2((long)e.Value);
         }
         else if (e.Format == "RelativeTime")
         {
             var position = (long)e.Value;
             var relativePos = position - m_axisX.Minimum - viewwidth;
             e.LocalizedValue = string.Format("{0}", relativePos);
         }
         else if (e.Format == "RelativeBytes")
         {
             var height = m_axisY.Maximum - m_axisY.Minimum;
             long position = (long)(e.Value);
             long relativePos = (long)(position - m_newestValue);
             var bytes = Util.FormatBytes(relativePos);
             if (relativePos == 0)
             {
                 e.LocalizedValue = Util.FormatBytes2(position);
             }
             else if (relativePos > 0)
             {
                 e.LocalizedValue = string.Format("+{0}", bytes);
             }
             else
             {
                 e.LocalizedValue = string.Format("-{0}", bytes);
             }
         }
     }
 }
Пример #4
0
		private static void chart_FormatNumber(object sender, FormatNumberEventArgs e)
		{
			if (e.ElementType == ChartElementType.AxisLabels && e.ValueType == ChartValueType.DateTime)
			{
				var value = DateTime.FromOADate(e.Value);

				if (value == value.Date)
				{
					e.LocalizedValue = value.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
				}
				else
				{
					if (value.Second != 0 || Math.Abs(value.Millisecond - 0.0) > 1e-12)
					{
						e.LocalizedValue = value.ToString(CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern);
					}
					else
					{
						e.LocalizedValue = value.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
					}
				}
			}
		}