File tree Expand file tree Collapse file tree 4 files changed +94
-12
lines changed
docs/BlazorApexCharts.Docs/Components/ChartTypes/BarCharts Expand file tree Collapse file tree 4 files changed +94
-12
lines changed Original file line number Diff line number Diff line change 38
38
</Snippet >
39
39
</CodeSnippet >
40
40
41
+ <CodeSnippet Title =" Stacked Total Data Label" ClassName =@typeof(StackedTotalDataLabel).ToString() >
42
+ <Snippet >
43
+ <StackedTotalDataLabel />
44
+ </Snippet >
45
+ </CodeSnippet >
46
+
41
47
<CodeSnippet Title =" Numeric X Axis" ClassName =@typeof(NumericXAxis).ToString() >
42
48
<Snippet >
43
49
<NumericXAxis />
Original file line number Diff line number Diff line change
1
+ <DemoContainer >
2
+ <ApexChart TItem =" Order"
3
+ Title =" Order Net Value"
4
+ Options =options >
5
+
6
+ <ApexPointSeries TItem =" Order"
7
+ Items =" Orders"
8
+ Name =" Gross Value"
9
+ SeriesType =" SeriesType.Bar"
10
+ XValue =" @(e => e.Country)"
11
+ YAggregate =" @(e => e.Sum(e => e.GrossValue))"
12
+ OrderByDescending =" e=>e.Y"
13
+ ShowDataLabels />
14
+
15
+ <ApexPointSeries TItem =" Order"
16
+ Items =" Orders"
17
+ Name =" Net Value"
18
+ SeriesType =" SeriesType.Bar"
19
+ XValue =" @(e => e.Country)"
20
+ YAggregate =" @(e => e.Sum(e => e.NetValue))"
21
+ OrderByDescending =" e=>e.Y"
22
+ ShowDataLabels />
23
+ </ApexChart >
24
+ </DemoContainer >
25
+
26
+ @code {
27
+
28
+ private List <Order > Orders { get ; set ; } = SampleData .GetOrders ();
29
+ private ApexChartOptions <Order > options ;
30
+
31
+ protected override void OnInitialized ()
32
+ {
33
+ options = new ApexChartOptions <Order >
34
+ {
35
+ Chart = new Chart
36
+ {
37
+ Stacked = true ,
38
+ },
39
+ PlotOptions = new PlotOptions
40
+ {
41
+ Bar = new PlotOptionsBar
42
+ {
43
+ DataLabels = new PlotOptionsBarDataLabels
44
+ {
45
+ Total = new BarTotalDataLabels
46
+ {
47
+ Enabled = true ,
48
+ Style = new BarDataLabelsStyle
49
+ {
50
+ FontWeight = " 800"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ },
56
+ Colors = new List <string > { " #5cb85c" , " #d9534f" }
57
+ };
58
+ }
59
+ }
60
+
Original file line number Diff line number Diff line change @@ -899,6 +899,24 @@ public class PlotOptionsBarDataLabels
899
899
public double ? MaxItems { get ; set ; }
900
900
public Orientation ? Orientation { get ; set ; }
901
901
public string Position { get ; set ; }
902
+ public BarTotalDataLabels Total { get ; set ; }
903
+ }
904
+
905
+ public class BarTotalDataLabels
906
+ {
907
+ public bool Enabled { get ; set ; }
908
+ public string Formatter { get ; set ; }
909
+ public double ? OffsetX { get ; set ; }
910
+ public double ? OffsetY { get ; set ; }
911
+ public BarDataLabelsStyle Style { get ; set ; }
912
+ }
913
+
914
+ public class BarDataLabelsStyle
915
+ {
916
+ public string Color { get ; set ; }
917
+ public string FontSize { get ; set ; }
918
+ public string FontFamily { get ; set ; }
919
+ public object FontWeight { get ; set ; }
902
920
}
903
921
904
922
public class PlotOptionsBubble
You can’t perform that action at this time.
0 commit comments