1
- namespace BlazorBootstrap ;
1
+ using System ;
2
+
3
+ namespace BlazorBootstrap ;
2
4
3
5
public interface IChartOptions { }
4
6
@@ -274,6 +276,12 @@ public class ChartAxes
274
276
[ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
275
277
public string ? Type { get ; set ; }
276
278
279
+ /// <summary>
280
+ /// Gets or sets the time axis configuration
281
+ /// </summary>
282
+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
283
+ public ChartTimeAxisOptions ? Time { get ; set ; }
284
+
277
285
#endregion
278
286
}
279
287
@@ -649,3 +657,80 @@ public class ChartFont
649
657
650
658
#endregion
651
659
}
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