Skip to content

Commit dffcbe0

Browse files
committed
Add groupValues
1 parent 437db4f commit dffcbe0

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

docs/BlazorApexCharts.Docs/Components/Features/Data/ChartData.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
<DocExamples Title="Chart Data">
44

5+
<CodeSnippet Title="Group Values" ClassName=@typeof(GroupValues).ToString()>
6+
<Snippet>
7+
<GroupValues />
8+
</Snippet>
9+
</CodeSnippet>
10+
@*
511
<CodeSnippet Title="Data Async" ClassName=@typeof(DataAsync).ToString()>
612
<Snippet>
713
<DataAsync />
@@ -13,5 +19,5 @@
1319
<NoData />
1420
</Snippet>
1521
</CodeSnippet>
16-
22+
*@
1723
</DocExamples>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<DemoContainer>
2+
<ApexChart TItem="Order"
3+
Title="Order Gross Value"
4+
GroupValues="new ApexCharts.GroupValues { MaxValuesCount = 4}">
5+
6+
<ApexPointSeries TItem="Order"
7+
Items="Orders"
8+
Name="Gross Value"
9+
SeriesType="SeriesType.Pie"
10+
XValue="@(e => e.Country)"
11+
YAggregate="@(e => e.Sum(e => e.GrossValue))"
12+
OrderByDescending="e=>e.Y" />
13+
</ApexChart>
14+
</DemoContainer>
15+
16+
@code {
17+
private List<Order> Orders { get; set; } = SampleData.GetOrders();
18+
}

src/Blazor-ApexCharts/ApexChart.razor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public partial class ApexChart<TItem> : IDisposable where TItem : class
3636

3737
[Parameter] public EventCallback OnRendered { get; set; }
3838
[Parameter] public Func<decimal, string> FormatYAxisLabel { get; set; }
39+
[Parameter] public GroupValues GroupValues { get; set; }
3940

4041
private ChartSerializer chartSerializer = new();
4142
public List<IApexSeries<TItem>> Series => apexSeries;

src/Blazor-ApexCharts/Models/DataPoints/ListPoint.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using System.Collections.Generic;
52
using System.Text.Json.Serialization;
6-
using System.Threading.Tasks;
73

84
namespace ApexCharts
95
{
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace ApexCharts
8+
{
9+
public class GroupValues
10+
{
11+
/// <summary>
12+
/// Indicates the max value of values to show, including the grouped values.
13+
/// </summary>
14+
public int? MaxValuesCount { get; set; }
15+
16+
/// <summary>
17+
/// The precentage value that indicate if a value should be grouped.
18+
/// </summary>
19+
public decimal? PercentageThreshold { get; set; }
20+
21+
public string Name { get; set; } = "Other";
22+
public bool Show { get; set; } = true;
23+
}
24+
25+
26+
27+
}

0 commit comments

Comments
 (0)