diff --git a/samples/charts/category-chart/selection-matcher/App.razor b/samples/charts/category-chart/selection-matcher/App.razor index 4613ca9b08..a8737f8c08 100644 --- a/samples/charts/category-chart/selection-matcher/App.razor +++ b/samples/charts/category-chart/selection-matcher/App.razor @@ -61,7 +61,8 @@ _timer = new System.Threading.Timer((_) => { addSelection(); - }, null, 100, 0); + }, null, 1000, 0); + _timer = null; } private void addSelection() @@ -71,20 +72,21 @@ IgbChartSelection selection = new IgbChartSelection(); selection.Item = EnergyRenewableConsumption[1]; IgbSeriesMatcher matcher = new IgbSeriesMatcher(); - matcher.MemberPath = "Solar"; + matcher.MemberPath = "Hydro"; matcher.MemberPathType = "ValueMemberPath"; selection.Matcher = matcher; chart.SelectedSeriesItems.Add(selection); - selection = new IgbChartSelection(); - selection.Item = EnergyRenewableConsumption[1]; + IgbChartSelection selection2 = new IgbChartSelection(); + selection2 = new IgbChartSelection(); + selection2.Item = EnergyRenewableConsumption[2]; matcher = new IgbSeriesMatcher(); - matcher.MemberPath = "Hydro"; + matcher.MemberPath = "Wind"; matcher.MemberPathType = "ValueMemberPath"; - selection.Matcher = matcher; + selection2.Matcher = matcher; - chart.SelectedSeriesItems.Add(selection); + chart.SelectedSeriesItems.Add(selection2); } private EnergyRenewableConsumption _energyRenewableConsumption = null; diff --git a/samples/charts/dashboard-tile/gauge-dashboard/App.razor b/samples/charts/dashboard-tile/gauge-dashboard/App.razor index 29fcf78c5c..7549736969 100644 --- a/samples/charts/dashboard-tile/gauge-dashboard/App.razor +++ b/samples/charts/dashboard-tile/gauge-dashboard/App.razor @@ -1,13 +1,12 @@ @using IgniteUI.Blazor.Controls -@using IgniteUI.Blazor.Controls; -@using System;
+ @ref="dashboard" + DataSource="DashboardGaugeDataSource">
@@ -19,16 +18,21 @@ { var dashboard = this.dashboard; - if (firstRender) { - this.DashboardTileGaugeOnInit(); - } } private IgbDashboardTile dashboard; - public void DashboardTileGaugeOnInit() + private DashboardGaugeDataSource _dashboardGaugeDataSource = null; + public DashboardGaugeDataSource DashboardGaugeDataSource { - this.dashboard.DataSource = 40; + get + { + if (_dashboardGaugeDataSource == null) + { + _dashboardGaugeDataSource = new DashboardGaugeDataSource(); + } + return _dashboardGaugeDataSource; + } } } \ No newline at end of file diff --git a/samples/charts/dashboard-tile/gauge-dashboard/DashboardGaugeDataSource.cs b/samples/charts/dashboard-tile/gauge-dashboard/DashboardGaugeDataSource.cs new file mode 100644 index 0000000000..8c06f72de4 --- /dev/null +++ b/samples/charts/dashboard-tile/gauge-dashboard/DashboardGaugeDataSource.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +public class DashboardGaugeDataSourceItem +{ + public double Value { get; set; } +} + +public class DashboardGaugeDataSource + : List +{ + public DashboardGaugeDataSource() + { + this.Add(new DashboardGaugeDataSourceItem() + { + Value = 40 + }); + } +} diff --git a/samples/charts/data-chart/selection-matcher/App.razor b/samples/charts/data-chart/selection-matcher/App.razor new file mode 100644 index 0000000000..e9a87bd816 --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/App.razor @@ -0,0 +1,175 @@ +@using IgniteUI.Blazor.Controls +@using IgniteUI.Blazor.Controls; +@using System; + +
+
+ Renewable Energy Consumption +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +@code { + + private Action BindElements { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + var legend = this.legend; + var chart = this.chart; + var yAxis = this.yAxis; + var xAxis = this.xAxis; + var stacked100BarSeries = this.stacked100BarSeries; + var s1 = this.s1; + var s2 = this.s2; + var s3 = this.s3; + var s4 = this.s4; + var dataToolTipLayer = this.dataToolTipLayer; + + this.BindElements = () => { + chart.Legend = this.legend; + }; + this.BindElements(); + + if (firstRender) { + this.SelectionMatcherOnViewInit(); + } + } + + private IgbLegend legend; + private IgbDataChart chart; + private IgbCategoryYAxis yAxis; + private IgbNumericXAxis xAxis; + private IgbStacked100BarSeries stacked100BarSeries; + private IgbStackedFragmentSeries s1; + private IgbStackedFragmentSeries s2; + private IgbStackedFragmentSeries s3; + private IgbStackedFragmentSeries s4; + private IgbDataToolTipLayer dataToolTipLayer; + + private System.Threading.Timer _timer; + + private void SelectionMatcherOnViewInit() + { + _timer = new System.Threading.Timer((_) => + { + addSelection(); + }, null, 1000, 0); + _timer = null; + } + + private void addSelection() + { + var chart = this.chart; + + IgbChartSelection selection = new IgbChartSelection(); + selection.Item = EnergyRenewableConsumption[1]; + IgbSeriesMatcher matcher = new IgbSeriesMatcher(); + matcher.MemberPath = "Hydro"; + matcher.MemberPathType = "ValueMemberPath"; + selection.Matcher = matcher; + + chart.SelectedSeriesItems.Add(selection); + + IgbChartSelection selection2 = new IgbChartSelection(); + selection2 = new IgbChartSelection(); + selection2.Item = EnergyRenewableConsumption[2]; + matcher = new IgbSeriesMatcher(); + matcher.MemberPath = "Wind"; + matcher.MemberPathType = "ValueMemberPath"; + selection2.Matcher = matcher; + + chart.SelectedSeriesItems.Add(selection2); + } + + private EnergyRenewableConsumption _energyRenewableConsumption = null; + public EnergyRenewableConsumption EnergyRenewableConsumption + { + get + { + if (_energyRenewableConsumption == null) + { + _energyRenewableConsumption = new EnergyRenewableConsumption(); + } + return _energyRenewableConsumption; + } + } + +} \ No newline at end of file diff --git a/samples/charts/data-chart/selection-matcher/BlazorClientApp.csproj b/samples/charts/data-chart/selection-matcher/BlazorClientApp.csproj new file mode 100644 index 0000000000..72fd9f896f --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/BlazorClientApp.csproj @@ -0,0 +1,21 @@ + + + + net9.0 + 3.0 + Infragistics.Samples + Infragistics.Samples + + + + 1701;1702,IDE0028,BL0005,0219,CS1998 + + + + + + + + + + diff --git a/samples/charts/data-chart/selection-matcher/BlazorClientApp.sln b/samples/charts/data-chart/selection-matcher/BlazorClientApp.sln new file mode 100644 index 0000000000..1e2eda208a --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/BlazorClientApp.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorClientApp", "BlazorClientApp.csproj", "{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FC52AAC8-4488-40AE-9621-75F6BA744B18} + EndGlobalSection +EndGlobal diff --git a/samples/charts/data-chart/selection-matcher/EnergyRenewableConsumption.cs b/samples/charts/data-chart/selection-matcher/EnergyRenewableConsumption.cs new file mode 100644 index 0000000000..66745c1cc9 --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/EnergyRenewableConsumption.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +public class EnergyRenewableConsumptionItem +{ + public string Location { get; set; } + public double Year { get; set; } + public double Hydro { get; set; } + public double Solar { get; set; } + public double Wind { get; set; } + public double Other { get; set; } +} + +public class EnergyRenewableConsumption + : List +{ + public EnergyRenewableConsumption() + { + this.Add(new EnergyRenewableConsumptionItem() + { + Location = @"China", + Year = 2019, + Hydro = 1269.5, + Solar = 223, + Wind = 405.2, + Other = 102.8 + }); + this.Add(new EnergyRenewableConsumptionItem() + { + Location = @"Europe", + Year = 2019, + Hydro = 632.54, + Solar = 154, + Wind = 461.3, + Other = 220.3 + }); + this.Add(new EnergyRenewableConsumptionItem() + { + Location = @"USA", + Year = 2019, + Hydro = 271.16, + Solar = 108, + Wind = 303.4, + Other = 78.34 + }); + this.Add(new EnergyRenewableConsumptionItem() + { + Location = @"Brazil", + Year = 2019, + Hydro = 399.3, + Solar = 5.5, + Wind = 55.83, + Other = 56.25 + }); + this.Add(new EnergyRenewableConsumptionItem() + { + Location = @"Canada", + Year = 2019, + Hydro = 381.98, + Solar = 4.3, + Wind = 34.17, + Other = 10.81 + }); + } +} diff --git a/samples/charts/data-chart/selection-matcher/Program.cs b/samples/charts/data-chart/selection-matcher/Program.cs new file mode 100644 index 0000000000..ac736ce798 --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/Program.cs @@ -0,0 +1,35 @@ +using System; +using System.Net.Http; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Text; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using IgniteUI.Blazor.Controls; // for registering Ignite UI modules + +namespace Infragistics.Samples +{ + public class Program + { + public static async Task Main(string[] args) + { + var builder = WebAssemblyHostBuilder.CreateDefault(args); + builder.RootComponents.Add("app"); + builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); + // registering Ignite UI modules + builder.Services.AddIgniteUIBlazor( + typeof(IgbLegendModule), + typeof(IgbDataChartCoreModule), + typeof(IgbDataChartCategoryModule), + typeof(IgbDataChartCategoryCoreModule), + typeof(IgbDataChartInteractivityModule), + typeof(IgbDataChartAnnotationModule), + typeof(IgbDataChartStackedModule), + typeof(IgbStackedFragmentSeriesModule) + ); + await builder.Build().RunAsync(); + } + } +} diff --git a/samples/charts/data-chart/selection-matcher/Properties/launchSettings.json b/samples/charts/data-chart/selection-matcher/Properties/launchSettings.json new file mode 100644 index 0000000000..18bd6fb5bc --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:4200", + "sslPort": 44385 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "BlazorSamples": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:4200" + } + } +} \ No newline at end of file diff --git a/samples/charts/data-chart/selection-matcher/_Imports.razor b/samples/charts/data-chart/selection-matcher/_Imports.razor new file mode 100644 index 0000000000..d27d337cb1 --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/_Imports.razor @@ -0,0 +1,9 @@ +// these namespaces are global to the app +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.WebAssembly.Http +@using Microsoft.JSInterop +@using Infragistics.Samples diff --git a/samples/charts/data-chart/selection-matcher/wwwroot/index.css b/samples/charts/data-chart/selection-matcher/wwwroot/index.css new file mode 100644 index 0000000000..50ca13caa6 --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/wwwroot/index.css @@ -0,0 +1,4 @@ +/* +CSS styles are loaded from the shared CSS file located at: +https://static.infragistics.com/xplatform/css/samples/ +*/ diff --git a/samples/charts/data-chart/selection-matcher/wwwroot/index.html b/samples/charts/data-chart/selection-matcher/wwwroot/index.html new file mode 100644 index 0000000000..8833030d8e --- /dev/null +++ b/samples/charts/data-chart/selection-matcher/wwwroot/index.html @@ -0,0 +1,30 @@ + + + + + + + + + + Samples | IgniteUI for Blazor | Infragistics + + + + + + + + + +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + + + +