Skip to content

Commit

Permalink
fix(NaN): rename old None to NaN.
Browse files Browse the repository at this point in the history
  • Loading branch information
MingboPeng committed Apr 22, 2024
1 parent 8d5aff8 commit 5e890a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/LadybugDisplaySchema/ManualAdded/Model/LegendParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ public bool IsEmbedded()
return false;
}

public LegendParameters SetNoneColor(Color color)
public LegendParameters SetNaNColor(Color color)
{
return this.AddUserData("_noneColor", color);
}
public bool HasNoneColor(out Color noneColor)
public bool HasNaNColor(out Color noneColor)
{
return HasNoneColor(this.GetUserData(), out noneColor);
return HasNaNColor(this.GetUserData(), out noneColor);
}

public static bool HasNoneColor(Dictionary<string, object> ud, out Color noneColor)
public static bool HasNaNColor(Dictionary<string, object> ud, out Color noneColor)
{
noneColor = null;
if (ud.TryGetValue("_noneColor", out var color))
Expand All @@ -222,9 +222,9 @@ public static bool HasNoneColor(Dictionary<string, object> ud, out Color noneCol
}
return false;
}
internal Color GetNoneColorWithDefault()
internal Color GetNaNColorWithDefault()
{
if (this.HasNoneColor(out var c))
if (this.HasNaNColor(out var c))
return c;
var colorStart = this.ColorsWithDefault.First();
return new Color(
Expand Down Expand Up @@ -258,7 +258,7 @@ public static List<double> GenColorDomains(int count)
return d;
}

private static bool IsNone(double value, Dictionary<double,string> ordinalDictionary)
private static bool IsNaN(double value, Dictionary<double,string> ordinalDictionary)
{
// check if there is none color for legend
if (double.IsNaN(value))
Expand Down Expand Up @@ -292,7 +292,7 @@ public List<Color> CalColor(IEnumerable<double> values)

var colorDomins = this.ColorDomains(colors.Count);
Color noneColor = null;
var hasNoneColor = this.HasNoneColor(out noneColor);
var hasNoneColor = this.HasNaNColor(out noneColor);

return CalColor(values, ordinalDictionary, min, max, colorDomins, colors, noneColor);
}
Expand All @@ -312,7 +312,7 @@ public static Color CalColor(double value, Dictionary<double, string> ordinalDic


// check if there is none color for legend
if (IsNone(value, ordinalDictionary))
if (IsNaN(value, ordinalDictionary))
return noneColor;

var colorStart = colors.First();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public VisualizationData(List<string> results, LegendParameters legend, bool cat
// set none color to legend
if (hasNone)
{
newLegend = newLegend.SetNoneColor(newLegend.GetNoneColorWithDefault());
newLegend = newLegend.SetNaNColor(newLegend.GetNaNColorWithDefault());
}

this.LegendParameters = newLegend;
Expand Down

0 comments on commit 5e890a6

Please sign in to comment.