feat: add basic support for SVG generator.
Add heat map example.
This commit is contained in:
25
samples/HeatMap/Utils/UtilsExtensions.cs
Normal file
25
samples/HeatMap/Utils/UtilsExtensions.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace HotMap.Utils;
|
||||
|
||||
public static class UtilsExtensions
|
||||
{
|
||||
extension(DateOnly date)
|
||||
{
|
||||
public DateOnly GetMonday()
|
||||
{
|
||||
return date.DayOfWeek switch
|
||||
{
|
||||
DayOfWeek.Monday => date,
|
||||
DayOfWeek.Sunday => date.AddDays(-6),
|
||||
_ => date.AddDays(1 - (int)date.DayOfWeek)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
extension<T>(IEnumerable<T> enumerable)
|
||||
{
|
||||
public IEnumerable<(T, int)> WithIndex()
|
||||
{
|
||||
return enumerable.Select((v, i) => (v, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user