Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes from igniteui-xplat-examples-output+PRs_2024.1.19.1 #609

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions samples/charts/category-chart/data-aggregations/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<div class="container vertical">
<div class="options vertical">
<IgbPropertyEditorPanel
Name="editor"
@ref="editor"

DescriptionType="CategoryChart"
IsHorizontal="true"
IsWrappingEnabled="true"
Name="propertyEditorPanel1"
@ref="propertyEditorPanel1">
IsWrappingEnabled="true">
<IgbPropertyEditorPropertyDescription
PropertyPath="InitialGroupsHandler"
Name="InitialGroups"
Expand All @@ -32,8 +32,6 @@
Label="Initial Summaries"
ValueType="PropertyEditorValueType.EnumValue"
ShouldOverrideDefaultEditor="true"
DropDownNames="@(new string[] { "Sum(Sales) as Sales", "Avg(Sales) as Sales", "Min(Sales) as Sales", "Max(Sales) as Sales", "Count(Sales) as Sales" })"
DropDownValues="@(new string[] { "Sum(Sales) as Sales", "Avg(Sales) as Sales", "Min(Sales) as Sales", "Max(Sales) as Sales", "Count(Sales) as Sales" })"
PrimitiveValue="@("Sum(Sales) as Sales")"
Changed="EditorChangeUpdateInitialSummaries">
</IgbPropertyEditorPropertyDescription>
Expand All @@ -45,8 +43,6 @@
Label="Sort Groups"
ValueType="PropertyEditorValueType.EnumValue"
ShouldOverrideDefaultEditor="true"
DropDownNames="@(new string[] { "Sales Desc", "Sales Asc" })"
DropDownValues="@(new string[] { "Sales Desc", "Sales Asc" })"
PrimitiveValue="@("Sales Desc")"
Changed="EditorChangeUpdateGroupSorts">
</IgbPropertyEditorPropertyDescription>
Expand Down Expand Up @@ -80,41 +76,64 @@

protected override async Task OnAfterRenderAsync(bool firstRender)
{
var propertyEditorPanel1 = this.propertyEditorPanel1;
var editor = this.editor;
var initialGroups = this.initialGroups;
var initialSummaries = this.initialSummaries;
var groupSorts = this.groupSorts;
var chart = this.chart;

this.BindElements = () => {
propertyEditorPanel1.Target = this.chart;
editor.Target = this.chart;
};
this.BindElements();

if (firstRender) {
this.PropertyEditorInitAggregationsOnViewInit();
}
}

private IgbPropertyEditorPanel propertyEditorPanel1;
private IgbPropertyEditorPanel editor;
private IgbPropertyEditorPropertyDescription initialGroups;
private IgbPropertyEditorPropertyDescription initialSummaries;
private IgbPropertyEditorPropertyDescription groupSorts;
private IgbCategoryChart chart;

public void PropertyEditorInitAggregationsOnViewInit()
{

this.editor.EnsureReady().ContinueWith(new Action<Task>((e) =>
{
var editor = this.editor;
var initialSummaries = editor.Properties.Where((p) => p.Label == "Initial Summaries").First;
initialSummaries.DropDownNames = ["Sum(Sales) as Sales", "Avg(Sales) as Sales", "Min(Sales) as Sales", "Max(Sales) as Sales", "Count(Sales) as Sales" ];
initialSummaries.DropDownValues = ["Sum(Sales) as Sales", "Avg(Sales) as Sales", "Min(Sales) as Sales", "Max(Sales) as Sales", "Count(Sales) as Sales"];

var groupSorts = editor.Properties.Where((p) => p.Label == "Sort Groups").First;
groupSorts.DropDownNames = ["Sales Desc", "Sales Asc"];
groupSorts.DropDownValues = ["Sales Desc", "Sales Asc"];
}));

}

public void EditorChangeUpdateInitialGroups(IgbPropertyEditorPropertyDescriptionChangedEventArgs args)
{
var chart = this.chart;
var intialGroupVal = args.NewValue.ToString();
chart.InitialGroups = null;
chart.InitialGroups = intialGroupVal;
}

public void EditorChangeUpdateInitialSummaries(IgbPropertyEditorPropertyDescriptionChangedEventArgs args)
{
var chart = this.chart;
var intialSummariesVal = args.NewValue.ToString();
chart.InitialSummaries = null;
chart.InitialSummaries = intialSummariesVal;
}

public void EditorChangeUpdateGroupSorts(IgbPropertyEditorPropertyDescriptionChangedEventArgs args)
{
var chart = this.chart;
var groupSortsVal = args.NewValue.ToString();
chart.GroupSorts = null;
chart.GroupSorts = groupSortsVal;
Expand Down
Loading