Bold BI®Unlock stunning dashboards with Bold BI®: 35+ widgets, 150+ data sources, AI agent & more. Try it for free!
chart.PrimaryAxis.LabelStyle.LabelFormat = "HH:MM";
|
SfChart chart = new SfChart(this);
. . .
chart.ZoomDelta += Chart_ZoomDelta;
private void Chart_ZoomDelta(object sender, SfChart.ZoomDeltaEventArgs e)
{
var axis = (sender as SfChart).PrimaryAxis;
axis.LabelStyle.LabelFormat = GetSpecificFormatedLabel((axis as DateTimeAxis).ActualIntervalType);
}
private string GetSpecificFormatedLabel(DateTimeIntervalType actualIntervalType)
{
if (actualIntervalType == DateTimeIntervalType.Days)
{
return "MMM-dd";
}
else if (actualIntervalType == DateTimeIntervalType.Months)
{
return "MMM-yyyy";
}
else if (actualIntervalType == DateTimeIntervalType.Years)
{
return "yyyy";
}
else if (actualIntervalType == DateTimeIntervalType.Hours)
{
return "hh:mm";
}
else if (actualIntervalType == DateTimeIntervalType.Minutes)
{
return "hh:mm:ss";
}
else if (actualIntervalType == DateTimeIntervalType.Seconds)
{
return "hh:mm:ss";
}
else if (actualIntervalType == DateTimeIntervalType.Milliseconds)
{
return "ss.SSS";
}
return "dd/MMM/yyyy";
}
|