Skip to content

Commit e23e11f

Browse files
authored
Merge pull request #568 from apexcharts/add-clustered-legend-options
Add clustered legend options
2 parents 069ed67 + 14d5dda commit e23e11f

File tree

2 files changed

+58
-34
lines changed

2 files changed

+58
-34
lines changed

docs/BlazorApexCharts.Docs/Components/ChartTypes/BarCharts/GroupStacked.razor

+35-34
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
<DemoContainer>
22
<ApexChart TItem="Order"
3-
Title="Order Net Value"
4-
Options=options>
3+
Title="Order Net Value"
4+
Options=options Debug="true">
55

66
<ApexPointSeries TItem="Order"
7-
Items="Orders"
8-
Name="Gross Value Budget"
9-
Group="Budget"
10-
SeriesType="SeriesType.Bar"
11-
XValue="@(e => e.Country)"
12-
YAggregate="@(e => e.Sum(e => e.GrossValue) - 10000)"
13-
OrderByDescending="e=>e.Y"
14-
ShowDataLabels />
7+
Items="Orders"
8+
Name="Gross Value Budget"
9+
Group="Budget"
10+
SeriesType="SeriesType.Bar"
11+
XValue="@(e => e.Country)"
12+
YAggregate="@(e => e.Sum(e => e.GrossValue) - 10000)"
13+
OrderByDescending="e=>e.Y"
14+
ShowDataLabels />
1515

1616
<ApexPointSeries TItem="Order"
17-
Items="Orders"
18-
Name="Gross Value"
19-
Group="Actual"
20-
SeriesType="SeriesType.Bar"
21-
XValue="@(e => e.Country)"
22-
YAggregate="@(e => e.Sum(e => e.GrossValue))"
23-
OrderByDescending="e=>e.Y"
24-
ShowDataLabels />
17+
Items="Orders"
18+
Name="Gross Value"
19+
Group="Actual"
20+
SeriesType="SeriesType.Bar"
21+
XValue="@(e => e.Country)"
22+
YAggregate="@(e => e.Sum(e => e.GrossValue))"
23+
OrderByDescending="e=>e.Y"
24+
ShowDataLabels />
2525

2626

2727

2828
<ApexPointSeries TItem="Order"
29-
Items="Orders"
30-
Name="Net Value Budget"
31-
Group="Budget"
32-
SeriesType="SeriesType.Bar"
33-
XValue="@(e => e.Country)"
34-
YAggregate="@(e => e.Sum(e => e.NetValue))"
35-
OrderByDescending="e=>e.Y"
36-
ShowDataLabels />
29+
Items="Orders"
30+
Name="Net Value Budget"
31+
Group="Budget"
32+
SeriesType="SeriesType.Bar"
33+
XValue="@(e => e.Country)"
34+
YAggregate="@(e => e.Sum(e => e.NetValue))"
35+
OrderByDescending="e=>e.Y"
36+
ShowDataLabels />
3737

3838
<ApexPointSeries TItem="Order"
39-
Items="Orders"
40-
Name="Net Value"
41-
Group="Actual"
42-
SeriesType="SeriesType.Bar"
43-
XValue="@(e => e.Country)"
44-
YAggregate="@(e => e.Sum(e => e.NetValue))"
45-
OrderByDescending="e=>e.Y"
46-
ShowDataLabels />
39+
Items="Orders"
40+
Name="Net Value"
41+
Group="Actual"
42+
SeriesType="SeriesType.Bar"
43+
XValue="@(e => e.Country)"
44+
YAggregate="@(e => e.Sum(e => e.NetValue))"
45+
OrderByDescending="e=>e.Y"
46+
ShowDataLabels />
4747
</ApexChart>
4848
</DemoContainer>
4949
@code {
@@ -66,6 +66,7 @@
6666
Horizontal = true
6767
}
6868
},
69+
Legend = new Legend { ClusterGroupedSeriesOrientation = ClusterGroupedSeriesOrientation.Horizontal },
6970
Colors = new List<string> { "#80c7fd", "#008FFB", "#80f1cb", "#00E396" },
7071
Xaxis = new XAxis { Categories = new List<string> { "Category1", "Category2", "Category3", "Category4" } }
7172
};

src/Blazor-ApexCharts/Models/ApexChartOptions.cs

+23
Original file line numberDiff line numberDiff line change
@@ -2321,8 +2321,22 @@ public class Legend
23212321
/// Allows you to overwrite the default legend items with this customized set of labels. Please note that the click/hover events of the legend will stop working if you provide these custom legend labels.
23222322
/// </summary>
23232323
public List<string> CustomLegendItems { get; set; }
2324+
2325+
/// <summary>
2326+
/// Indicates if the Legends should grouped by Cluster
2327+
/// Default is true in Apexcharts.js
2328+
/// </summary>
2329+
public bool? ClusterGroupedSeries { get; set; }
2330+
2331+
/// <summary>
2332+
/// Orientation for the Clustered Grouped Series
2333+
/// </summary>
2334+
public ClusterGroupedSeriesOrientation? ClusterGroupedSeriesOrientation { get; set; }
2335+
23242336
}
23252337

2338+
2339+
23262340
/// <summary>
23272341
/// Undocumented, this class exists in the TypeScript definition
23282342
/// </summary>
@@ -5521,6 +5535,15 @@ public enum ShapeEnum
55215535
Rect
55225536
};
55235537

5538+
/// <summary>
5539+
/// Orientation options for the Clustered Grouped Series
5540+
/// </summary>
5541+
public enum ClusterGroupedSeriesOrientation
5542+
{
5543+
Horizontal,
5544+
Vertical
5545+
};
5546+
55245547
/// <summary>
55255548
/// A list of alignment options for vertical placement
55265549
/// </summary>

0 commit comments

Comments
 (0)