Skip to content

Commit fb6afd8

Browse files
Merge pull request #5 from mouli18/EJ2-000-github-samples
config(EJ2-000): commit for pivot samples
2 parents 36cf922 + 816f647 commit fb6afd8

File tree

5 files changed

+149
-257
lines changed

5 files changed

+149
-257
lines changed

ej2-blazor-samples/Pages/PivotView/PivotTable/AdvanceFiltering.razor

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,37 @@ To achieve this in code-behind, use the <code>filterSettings</code> object in th
6464

6565
<div class="control-section">
6666
<div class="content-wrapper">
67-
<EjsPivotView ID="pivotview" Width="100%" Height="300" DataSource="@PivotDataSource" ShowFieldList=true ShowGroupingBar=true>
67+
<EjsPivotView ID="pivotview" Width="100%" Height="340" ShowFieldList=true ShowGroupingBar=true>
68+
<PivotViewDataSource Data="@data" ExpandAll=false EnableSorting=true AllowLabelFilter=true AllowValueFilter=true>
69+
<PivotViewColumns>
70+
<PivotViewColumn Name="Year"></PivotViewColumn>
71+
<PivotViewColumn Name="Order_Source"></PivotViewColumn>
72+
</PivotViewColumns>
73+
<PivotViewRows>
74+
<PivotViewRow Name="Country"></PivotViewRow>
75+
<PivotViewRow Name="Products"></PivotViewRow>
76+
</PivotViewRows>
77+
<PivotViewValues>
78+
<PivotViewValue Name="In_Stock" Caption="In Stock"></PivotViewValue>
79+
<PivotViewValue Name="Sold" Caption="Units Sold"></PivotViewValue>
80+
<PivotViewValue Name="Amount" Caption="Sold Amount"></PivotViewValue>
81+
</PivotViewValues>
82+
<PivotViewFilters>
83+
<PivotViewFilter Name="Product_Categories" Caption="Product Categories"></PivotViewFilter>
84+
</PivotViewFilters>
85+
<PivotViewFormatSettings>
86+
<PivotViewFormatSetting Name="Amount" Format="C" UseGrouping=true></PivotViewFormatSetting>
87+
</PivotViewFormatSettings>
88+
<PivotViewDrilledMembers>
89+
<PivotViewDrilledMember Name="Country" Items="@(new string[] { "France" })"></PivotViewDrilledMember>
90+
</PivotViewDrilledMembers>
91+
<PivotViewFilterSettings>
92+
<PivotViewFilterSetting Name="Year" Type=Syncfusion.EJ2.RazorComponents.PivotView.FilterType.Label Condition=Operators.Equals Value1="FY 2017"></PivotViewFilterSetting>
93+
</PivotViewFilterSettings>
94+
</PivotViewDataSource>
6895
<PivotViewGridSettings ColumnWidth="140"></PivotViewGridSettings>
6996
</EjsPivotView>
97+
7098
</div>
7199
</div>
72100

@@ -77,66 +105,12 @@ To achieve this in code-behind, use the <code>filterSettings</code> object in th
77105
}
78106
</style>
79107

80-
@code{
108+
@functions{
81109

82110
EjsPivotView pivotView;
83111

84112
static PivotViewData pivotData = new PivotViewData();
85113

86-
static List<object> pivotRows { get; set; } = new List<object>
87-
{
88-
new { name = "Country" },
89-
new { name = "Products" }
90-
};
91-
92-
static List<object> pivotColumns { get; set; } = new List<object>
93-
{
94-
new { name = "Year" },
95-
new { name = "Order_Source", caption = "Order Source" }
96-
};
97-
98-
static List<object> pivotValues { get; set; } = new List<object>
99-
{
100-
new { name = "In_Stock", caption = "In Stock" },
101-
new { name = "Sold", caption = "Units Sold" },
102-
new { name = "Amount", caption = "Sold Amount" }
103-
};
104-
105-
static List<object> pivotFilters { get; set; } = new List<object>
106-
{
107-
new { name = "Product_Categories", caption = "Product Categories" }
108-
};
109-
110-
static List<object> pivotFilterSettings { get; set; } = new List<object>
111-
{
112-
new { name = "Year", type = "Label", condition = "DoesNotEquals", value1= "FY 2017", }
113-
};
114-
115-
static List<object> pivotFormatSettings { get; set; } = new List<object>
116-
{
117-
new { name = "Amount", format = "C0" }
118-
};
119-
120-
static List<string> drilledItems = new List<string> { "France" };
121-
122-
static List<object> pivotDrillMembers { get; set; } = new List<object>
123-
{
124-
new { name = "Country", items = drilledItems }
125-
};
126-
[Parameter]
127-
private object PivotDataSource { get; set; } = new
128-
{
129-
data = pivotData.GetPivot_Data(),
130-
expandAll = false,
131-
enableSorting = true,
132-
allowLabelFilter = true,
133-
allowValueFilter = true,
134-
rows = pivotRows,
135-
columns = pivotColumns,
136-
values = pivotValues,
137-
filters = pivotFilters,
138-
filterSettings = pivotFilterSettings,
139-
formatSettings = pivotFormatSettings,
140-
drilledMembers = pivotDrillMembers
141-
};
114+
private List<PivotViewData.Pivot_Data> data = pivotData.GetPivot_Data();
115+
142116
}

ej2-blazor-samples/Pages/PivotView/PivotTable/Chart.razor

Lines changed: 26 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,32 @@
5656

5757
<div class="control-section">
5858
<div class="content-wrapper">
59-
<EjsPivotView ID="pivotview" Width="100%" Height="300" DataSource="@PivotDataSource" ShowFieldList=true>
59+
<EjsPivotView ID="pivotView" Width="800" Height="340" ShowFieldList=true>
60+
<PivotViewDataSource Data="@data" ExpandAll=false EnableSorting=true>
61+
<PivotViewColumns>
62+
<PivotViewColumn Name="Year"></PivotViewColumn>
63+
<PivotViewColumn Name="Order_Source"></PivotViewColumn>
64+
</PivotViewColumns>
65+
<PivotViewRows>
66+
<PivotViewRow Name="Country"></PivotViewRow>
67+
<PivotViewRow Name="Products"></PivotViewRow>
68+
</PivotViewRows>
69+
<PivotViewValues>
70+
<PivotViewValue Name="Amount"></PivotViewValue>
71+
</PivotViewValues>
72+
<PivotViewFilters>
73+
<PivotViewFilter Name="Product_Categories"></PivotViewFilter>
74+
</PivotViewFilters>
75+
<PivotViewFormatSettings>
76+
<PivotViewFormatSetting Name="Amount" Format="C" UseGrouping=true></PivotViewFormatSetting>
77+
</PivotViewFormatSettings>
78+
</PivotViewDataSource>
6079
<PivotViewDisplayOption View=View.Chart></PivotViewDisplayOption>
61-
<PivotViewChartSettings Title="Sales Analysis" ChartSeries="@ChartSeries"></PivotViewChartSettings>
80+
<PivotViewChartSettings Title="Sales Analysis">
81+
<PivotViewPivotSeries Type=ChartSeriesType.Column></PivotViewPivotSeries>
82+
</PivotViewChartSettings>
6283
</EjsPivotView>
84+
6385
</div>
6486
</div>
6587

@@ -70,53 +92,12 @@
7092
}
7193
</style>
7294

73-
@code{
95+
@functions{
7496

7597
EjsPivotView pivotView;
7698

7799
static PivotViewData pivotData = new PivotViewData();
78100

79-
static List<object> pivotRows { get; set; } = new List<object>
80-
{
81-
new { name = "Country" },
82-
new { name = "Products" }
83-
};
84-
85-
static List<object> pivotColumns { get; set; } = new List<object>
86-
{
87-
new { name = "Year" },
88-
new { name = "Order_Source", caption = "Order Source" }
89-
};
90-
91-
static List<object> pivotValues { get; set; } = new List<object>
92-
{
93-
new { name = "Amount", caption = "Sold Amount" }
94-
};
95-
96-
static List<object> pivotFilters { get; set; } = new List<object>
97-
{
98-
new { name = "Product_Categories", caption = "Product Categories" }
99-
};
101+
private List<PivotViewData.Pivot_Data> data = pivotData.GetPivot_Data();
100102

101-
static List<object> pivotFormatSettings { get; set; } = new List<object>
102-
{
103-
new { name = "Amount", format = "C" }
104-
};
105-
[Parameter]
106-
private object PivotDataSource { get; set; } = new
107-
{
108-
data = pivotData.GetPivot_Data(),
109-
expandAll = false,
110-
enableSorting = true,
111-
rows = pivotRows,
112-
columns = pivotColumns,
113-
values = pivotValues,
114-
filters = pivotFilters,
115-
formatSettings = pivotFormatSettings
116-
};
117-
[Parameter]
118-
private object ChartSeries { get; set; } = new
119-
{
120-
type = "Column"
121-
};
122103
}

ej2-blazor-samples/Pages/PivotView/PivotTable/DefaultFunctionalities.razor

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,33 @@
2929

3030
<div class="control-section">
3131
<div class="content-wrapper">
32-
<EjsPivotView ID="pivotview" Width="100%" Height="300" DataSource="@PivotDataSource">
32+
<EjsPivotView ID="pivotview" Width="100%" Height="340">
33+
<PivotViewDataSource Data="@data" ExpandAll=false EnableSorting=true>
34+
<PivotViewColumns>
35+
<PivotViewColumn Name="Year"></PivotViewColumn>
36+
<PivotViewColumn Name="Quarter"></PivotViewColumn>
37+
</PivotViewColumns>
38+
<PivotViewRows>
39+
<PivotViewRow Name="Country"></PivotViewRow>
40+
<PivotViewRow Name="Products"></PivotViewRow>
41+
</PivotViewRows>
42+
<PivotViewValues>
43+
<PivotViewValue Name="Sold" Caption="Units Sold"></PivotViewValue>
44+
<PivotViewValue Name="Amount" Caption="Sold Amount"></PivotViewValue>
45+
</PivotViewValues>
46+
<PivotViewFilters>
47+
<PivotViewFilter Name="Product_Categories" Caption="Product Categories"></PivotViewFilter>
48+
</PivotViewFilters>
49+
<PivotViewFormatSettings>
50+
<PivotViewFormatSetting Name="Amount" Format="C" UseGrouping=true></PivotViewFormatSetting>
51+
</PivotViewFormatSettings>
52+
<PivotViewDrilledMembers>
53+
<PivotViewDrilledMember Name="Country" Items="@(new string[] { " France" })"></PivotViewDrilledMember>
54+
</PivotViewDrilledMembers>
55+
</PivotViewDataSource>
3356
<PivotViewGridSettings ColumnWidth="140"></PivotViewGridSettings>
3457
</EjsPivotView>
58+
3559
</div>
3660
</div>
3761

@@ -42,51 +66,13 @@
4266
}
4367
</style>
4468

45-
@code{
69+
@functions{
4670

47-
EjsPivotView pivotView;
71+
EjsPivotView pivotView;
4872

4973
static PivotViewData pivotData = new PivotViewData();
5074

51-
static List<object> pivotRows { get; set; } = new List<object>
52-
{
53-
new { name = "Country" },
54-
new { name = "Products" }
55-
};
56-
57-
static List<object> pivotColumns { get; set; } = new List<object>
58-
{
59-
new { name = "Year" },
60-
new { name = "Quarter" }
61-
};
62-
63-
static List<object> pivotValues { get; set; } = new List<object>
64-
{
65-
new { name = "Sold", caption = "Units Sold" },
66-
new { name = "Amount", caption = "Sold Amount" }
67-
};
68-
69-
static List<object> pivotFormatSettings { get; set; } = new List<object>
70-
{
71-
new { name = "Amount", format = "C0" }
72-
};
73-
74-
static List<string> drilledItems = new List<string> { "France" };
75+
private List<PivotViewData.Pivot_Data> data = pivotData.GetPivot_Data();
7576

76-
static List<object> pivotDrillMembers { get; set; } = new List<object>
77-
{
78-
new { name = "Country", items = drilledItems }
79-
};
80-
[Parameter]
81-
private object PivotDataSource { get; set; } = new
82-
{
83-
data = pivotData.GetDefaultData(),
84-
expandAll = false,
85-
enableSorting = true,
86-
rows = pivotRows,
87-
columns = pivotColumns,
88-
values = pivotValues,
89-
formatSettings = pivotFormatSettings,
90-
drilledMembers = pivotDrillMembers
91-
};
77+
9278
}

0 commit comments

Comments
 (0)