Skip to content

Commit

Permalink
Minor chart serialization order tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero committed Jan 26, 2024
1 parent 738231b commit 999af70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Common/ChartJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
writer.WritePropertyName("Series");
writer.WriteStartObject();
// we sort the series in ascending count so that they are chart nicely, has value for stacked area series so they're continuous
foreach (var kvp in chart.Series.OrderBy(x => x.Value.Values.Count))
foreach (var kvp in chart.Series.OrderBy(x => x.Value.Values.Count).ThenBy(x => x.Value.Values.Select(x => (x as ChartPoint)?.Y ?? 0).Sum()))
{
writer.WritePropertyName(kvp.Key);
serializer.Serialize(writer, kvp.Value);
Expand Down

0 comments on commit 999af70

Please sign in to comment.