first commit -push
This commit is contained in:
38
RobotNet.WebApp/Charts/Enums/EnumExtensions.cs
Normal file
38
RobotNet.WebApp/Charts/Enums/EnumExtensions.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace RobotNet.WebApp.Charts.Enums;
|
||||
|
||||
public static class EnumExtensions
|
||||
{
|
||||
|
||||
public static string? ToChartDatasetDataLabelAlignmentString(this DataLabelsAlignment alignment) =>
|
||||
alignment switch
|
||||
{
|
||||
DataLabelsAlignment.Start => "start",
|
||||
DataLabelsAlignment.Center or DataLabelsAlignment.None => "center", // default
|
||||
DataLabelsAlignment.End => "end",
|
||||
_ => null
|
||||
};
|
||||
|
||||
public static string? ToChartDatasetDataLabelAnchorString(this DataLabelsAnchoring anchor) =>
|
||||
anchor switch
|
||||
{
|
||||
DataLabelsAnchoring.Start => "start",
|
||||
DataLabelsAnchoring.Center or DataLabelsAnchoring.None => "center", // default
|
||||
DataLabelsAnchoring.End => "end",
|
||||
_ => null
|
||||
};
|
||||
|
||||
public static string ToCssString(this Unit unit) =>
|
||||
unit switch
|
||||
{
|
||||
Unit.Em => "em",
|
||||
Unit.Percentage => "%",
|
||||
Unit.Pt => "pt",
|
||||
Unit.Px => "px",
|
||||
Unit.Rem => "rem",
|
||||
Unit.Vh => "vh",
|
||||
Unit.VMax => "vmax",
|
||||
Unit.VMin => "vmin",
|
||||
Unit.Vw => "vw",
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user