Skip to content

Commit

Permalink
Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiusgreat committed May 21, 2024
1 parent 15ea474 commit 3198815
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
28 changes: 0 additions & 28 deletions Canvas.Core/Shapes/GroupShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,6 @@ namespace Canvas.Core.Shapes
{
public class GroupShape : Shape
{
/// <summary>
/// Get series
/// </summary>
/// <param name="view"></param>
/// <param name="coordinates"></param>
/// <returns></returns>
public override IDictionary<string, IList<double>> GetSeries(DataModel view, DataModel coordinates)
{
var group = this;
var groups = new Dictionary<string, IList<double>>();

if (group?.Groups?.Count <= 0)
{
return base.GetSeries(view, coordinates);
}

group.Groups.TryGetValue(Composer?.Name ?? string.Empty, out IShape series);

if (series?.Groups is null)
{
return null;
}

series.Groups.ForEach(o => groups[o.Key] = o.Value?.GetSeriesValues(view, coordinates));

return groups;
}

/// <summary>
/// Grouping implementation
/// </summary>
Expand Down
23 changes: 20 additions & 3 deletions Canvas.Core/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,27 @@ public virtual void CreateShape(int index, string name, IList<IShape> items)
/// <returns></returns>
public virtual IDictionary<string, IList<double>> GetSeries(DataModel view, DataModel coordinates)
{
return new Dictionary<string, IList<double>>
var group = this;
var groups = new Dictionary<string, IList<double>>();

if (group?.Groups?.Count <= 0)
{
[Composer.Name] = GetSeriesValues(view, coordinates)
};
return new Dictionary<string, IList<double>>
{
[Composer.Name] = GetSeriesValues(view, coordinates)
};
}

group.Groups.TryGetValue(Composer?.Name ?? string.Empty, out IShape series);

if (series?.Groups is null)
{
return null;
}

series.Groups.ForEach(o => groups[o.Key] = o.Value?.GetSeriesValues(view, coordinates));

return groups;
}

/// <summary>
Expand Down

0 comments on commit 3198815

Please sign in to comment.