private void Primary_LabelCreated(object sender, ChartAxisLabelEventArgs e) { DateTime baseDate = new DateTime(1899, 12, 30); var date = baseDate.AddDays(e.Position); if (date.Month != month) { ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle(); labelStyle.LabelFormat = "MMM-dd"; labelStyle.FontSize = 9; labelStyle.FontAttributes = FontAttributes.Bold; e.LabelStyle = labelStyle; month = date.Month; } else { ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle(); labelStyle.LabelFormat = "dd"; e.LabelStyle = labelStyle; if (Device.RuntimePlatform == Device.WPF) { labelStyle.FontSize = 12; } } }
private void NumericalAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { var yValue = Convert.ToDouble(e.LabelContent); if (yValue > 1000000000) { e.LabelContent = (yValue / 1000000000) + "B"; } else if (yValue <= 1000000000 && yValue > 1000000) { e.LabelContent = (yValue / 1000000) + "M"; } else if (yValue <= 1000000 && yValue >= 1000) { e.LabelContent = (yValue / 1000) + "K"; } }
private void Primary_LabelCreated(object sender, ChartAxisLabelEventArgs e) { DateTime baseDate = new DateTime(1899, 12, 30); var date = baseDate.AddDays(e.Position); if (date.Month != month) { ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle(); labelStyle.LabelFormat = "MMM-dd"; labelStyle.Font = Font.SystemFontOfSize(9, FontAttributes.Bold); e.LabelStyle = labelStyle; month = date.Month; } else { ChartAxisLabelStyle labelStyle = new ChartAxisLabelStyle(); labelStyle.LabelFormat = "dd"; e.LabelStyle = labelStyle; } }
private void PrimaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { DateTime dateTime; if (Device.OS == TargetPlatform.iOS) { dateTime = new DateTime(1970, 1, 1) + TimeSpan.FromMilliseconds(e.Position); } else if (Device.OS == TargetPlatform.Android) { dateTime = new DateTime(1970, 1, 1) + TimeSpan.FromMilliseconds(e.Position); } else { dateTime = new DateTime(1900, 1, 1) + TimeSpan.FromMilliseconds(e.Position); } if (primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Years) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year; } else if (primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Months || primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Days) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year; } else if (primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Hours) { if (dateTime.Hour != 0 && dateTime.Hour < 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + dateTime.Hour + "AM"; } else if (dateTime.Hour == 0) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + "12AM"; } else if (dateTime.Hour > 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour - 12) + "PM"; } else { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour) + "PM"; } } else if (primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Minutes) { if (dateTime.Hour != 0 && dateTime.Hour < 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + dateTime.Hour + ":" + dateTime.Minute + "AM"; } else if (dateTime.Hour == 0) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + "12AM" + ":" + dateTime.Minute; } else if (dateTime.Hour > 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour - 12) + ":" + dateTime.Minute + "PM"; } else { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour) + ":" + dateTime.Minute + "PM"; } } else if (primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Seconds || primaryAxis.GetActualIntervalType() == DateTimeIntervalType.Milliseconds) { if (dateTime.Hour != 0 && dateTime.Hour < 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + "AM"; } else if (dateTime.Hour == 0) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + "12" + ":" + dateTime.Minute + ":" + dateTime.Second + "AM"; } else if (dateTime.Hour > 12) { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour - 12) + ":" + dateTime.Minute + ":" + dateTime.Second + "PM"; } else { e.LabelContent = dateTime.Day + "/" + dateTime.Month + "/" + dateTime.Year + " " + (dateTime.Hour) + ":" + dateTime.Minute + ":" + dateTime.Second + "PM"; } } }
void PrimaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { DateTime date = DateTime.Parse(e.LabelContent); e.LabelContent = date.ToString("ddd"); }
void secondaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { double label1 = Convert.ToDouble(e.LabelContent); e.LabelContent = label1.ToString("#,##0, K", CultureInfo.InvariantCulture); }
void NumericalAxis_LabelCreated(System.Object sender, ChartAxisLabelEventArgs e) { e.LabelContent = e.LabelContent.TransformNumericString(); }
private void Axis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { var date = DateTime.ParseExact(e.LabelContent, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); e.LabelContent = date.ToString("MMM") + "\n" + date.ToString(" yy"); }
void DateTimeAxis_LabelCreated1(object sender, ChartAxisLabelEventArgs e) { }
public void PrimaryAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { DateTime date = DateTime.Parse(e.LabelContent); e.LabelContent = date.DayOfWeek.ToString().Substring(0, 2) + " \n" + date.ToString("dd MMM"); }
private void NumericalAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e) { e.LabelContent = e.LabelContent + "B"; }