1- namespace BlazorBootstrap ;
1+ using System ;
2+
3+ namespace BlazorBootstrap ;
24
35public interface IChartOptions { }
46
@@ -274,6 +276,12 @@ public class ChartAxes
274276 [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
275277 public string ? Type { get ; set ; }
276278
279+ /// <summary>
280+ /// Gets or sets the time axis configuration
281+ /// </summary>
282+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
283+ public ChartTimeAxisOptions ? Time { get ; set ; }
284+
277285 #endregion
278286}
279287
@@ -649,3 +657,80 @@ public class ChartFont
649657
650658 #endregion
651659}
660+
661+ public enum ChartTimeUnit
662+ {
663+ Millisecond ,
664+ Second ,
665+ Minute ,
666+ Hour ,
667+ Day ,
668+ Week ,
669+ Month ,
670+ Quarter ,
671+ Year
672+ }
673+
674+ /// <summary>
675+ /// <see href="https://www.chartjs.org/docs/latest/axes/cartesian/time.html" />
676+ /// </summary>
677+ public class ChartTimeAxisOptions
678+ {
679+ #region Properties, Indexers
680+
681+ /// <summary>
682+ /// Sets how different time units are displayed.
683+ /// <summary>
684+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
685+ public object ? DisplayFormats { get ; set ; }
686+
687+ /// <summary>
688+ /// If boolean and true and the unit is set to 'week', then the first day of the week will be Monday. Otherwise, it will be Sunday. If number, the index of the first day of the week (0 - Sunday, 6 - Saturday)
689+ /// <summary>
690+ [ JsonIgnore ]
691+ public DayOfWeek ? IsoWeekday { get ; set ; }
692+
693+ [ JsonInclude ]
694+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
695+ private int ? isoWeekDay => ( int ? ) IsoWeekday ;
696+
697+ /// <summary>
698+ /// If defined, dates will be rounded to the start of this unit. See Units below for the allowed units.
699+ /// <summary>
700+ [ JsonIgnore ]
701+ public ChartTimeUnit ? Round { get ; set ; }
702+
703+
704+ [ JsonInclude ]
705+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
706+ private string round => Round ? . ToString ( ) . ToLower ( ) ;
707+
708+ /// <summary>
709+ /// The format string to use for the tooltip.
710+ /// <summary>
711+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
712+ public string ? TooltipFormat { get ; set ; }
713+
714+ /// <summary>
715+ /// If defined, will force the unit to be a certain type. See Units section below for details.
716+ /// <summary>
717+ [ JsonIgnore ]
718+ public ChartTimeUnit ? Unit { get ; set ; }
719+
720+ [ JsonInclude ]
721+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
722+ private string unit => Unit ? . ToString ( ) . ToLower ( ) ;
723+
724+ /// <summary>
725+ /// The minimum display format to be used for a time unit.
726+ /// <summary>
727+ [ JsonIgnore ]
728+ public ChartTimeUnit ? MinUnit { get ; set ; }
729+
730+
731+ [ JsonInclude ]
732+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
733+ private string minUnit => MinUnit ? . ToString ( ) . ToLower ( ) ;
734+
735+ #endregion
736+ }
0 commit comments