The Blazor Toolbar component is a companion container for UI operations to be used primarily with our charting components. The toolbar will dynamically update with a preset of properties and tool items when linked to our IgbDataChart or IgbCategoryChart components. You'll be able to create custom tools for your project allowing end users to provide changes, offering an endless amount of customization.
Blazor Toolbar Example
EXAMPLE
MODULES
DATA
RAZOR
CSS
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 modulesnamespaceInfragistics.Samples
{
publicclassProgram
{
publicstaticasync Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbLegendModule),
typeof(IgbToolbarModule),
typeof(IgbCategoryChartModule),
typeof(IgbCategoryChartToolbarModule),
typeof(IgbCheckboxListModule)
);
await builder.Build().RunAsync();
}
}
}cs
using System;
using System.Collections.Generic;
publicclassCountryRenewableElectricityItem
{
publicstring Year { get; set; }
publicdouble Europe { get; set; }
publicdouble China { get; set; }
publicdouble America { get; set; }
}
publicclassCountryRenewableElectricity
: List<CountryRenewableElectricityItem>
{
publicCountryRenewableElectricity()
{
this.Add(new CountryRenewableElectricityItem() { Year = @"2009", Europe = 34, China = 21, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2010", Europe = 43, China = 26, America = 24 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2011", Europe = 66, China = 29, America = 28 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2012", Europe = 69, China = 32, America = 26 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2013", Europe = 58, China = 47, America = 38 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2014", Europe = 40, China = 46, America = 31 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2015", Europe = 78, China = 50, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2016", Europe = 13, China = 90, America = 52 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2017", Europe = 78, China = 132, America = 50 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2019", Europe = 80, China = 96, America = 38 });
}
}cs
You will also need to link an additional CSS file to apply the styling to the IgbToolbar component. The following needs to be placed in the wwwroot/index.html file in a Blazor Web Assembly project or the Pages/_Host.cshtml file in a Blazor Server project:
Each of these tools exposes an OnCommand event that is triggered by mouse click. Note, the IgbToolActionIconMenu is a wrapper for other tools that can also be wrapped inside a IgbToolActionIconMenu.
New and existing tools can be repositioned and marked hidden using the OverlayId, BeforeId and AfterId properties on the IgbToolAction object. ToolActions also expose a Visibility property.
The following example demonstrates a couple of features. First you can group tools together in the IgbToolActionSubPanel including hiding built in tools such as the ZoomReset and AnalyzeMenu menu tool actions. In this example a new instance of the ZoomReset tool action within the ZoomMenu by using the the AfterId property and assigning that to ZoomOut to be precise with it's placement. It is also highlighted via the IsHighlighted property on the tool.
EXAMPLE
MODULES
DATA
RAZOR
CSS
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 modulesnamespaceInfragistics.Samples
{
publicclassProgram
{
publicstaticasync Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbToolbarModule),
typeof(IgbDataChartToolbarModule),
typeof(IgbDataChartCoreModule),
typeof(IgbDataChartCategoryModule),
typeof(IgbDataChartAnnotationModule),
typeof(IgbDataChartInteractivityModule),
typeof(IgbDataChartCategoryTrendLineModule)
);
await builder.Build().RunAsync();
}
}
}cs
using System;
using System.Collections.Generic;
publicclassCountryRenewableElectricityItem
{
publicstring Year { get; set; }
publicdouble Europe { get; set; }
publicdouble China { get; set; }
publicdouble America { get; set; }
}
publicclassCountryRenewableElectricity
: List<CountryRenewableElectricityItem>
{
publicCountryRenewableElectricity()
{
this.Add(new CountryRenewableElectricityItem() { Year = @"2009", Europe = 34, China = 21, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2010", Europe = 43, China = 26, America = 24 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2011", Europe = 66, China = 29, America = 28 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2012", Europe = 69, China = 32, America = 26 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2013", Europe = 58, China = 47, America = 38 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2014", Europe = 40, China = 46, America = 31 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2015", Europe = 78, China = 50, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2016", Europe = 13, China = 90, America = 52 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2017", Europe = 78, China = 132, America = 50 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2019", Europe = 80, China = 96, America = 38 });
}
}cs
@using IgniteUI.Blazor.Controls@using System<style>/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/#aboveContentSplit {
display: flex;
flex-direction: row;
}
#aboveContentLeftContainer {
margin-left: 1.25rem;
display: flex;
flex-grow: 1;
justify-content: start;
align-items: end;
}
#aboveContentRightContainer {
margin-right: 1.25rem;
display: flex;
flex-grow: 1;
justify-content: end;
align-items: end;
}
</style><divclass="container vertical"><divid="aboveContentSplit"><divid="aboveContentLeftContainer"><IgbToolbarName="toolbar"
@ref="toolbar"Orientation="ToolbarOrientation.Horizontal"OnCommand="ToolbarToggleAnnotations"><IgbToolActionIconMenuName="MenuForSubPanelTool"
@ref="menuForSubPanelTool"IconCollectionName="ChartToolbarIcons"IconName="analyze"><IgbToolActionGroupHeaderName="SubPanelGroup"
@ref="subPanelGroup"CloseOnExecute="true"Title="Visualizations"Subtitle="Layers"></IgbToolActionGroupHeader><IgbToolActionSubPanelName="CustomSubPanelTools"
@ref="customSubPanelTools"><IgbToolActionCheckboxName="EnableTooltipsLabel"
@ref="enableTooltipsLabel"Title="Enable Tooltips"CommandId="EnableTooltips"></IgbToolActionCheckbox><IgbToolActionCheckboxName="EnableCrosshairsLabel"
@ref="enableCrosshairsLabel"Title="Enable Crosshairs"CommandId="EnableCrosshairs"></IgbToolActionCheckbox><IgbToolActionCheckboxName="EnableFinalValuesLabel"
@ref="enableFinalValuesLabel"Title="Enable Final Values"CommandId="EnableFinalValues"></IgbToolActionCheckbox></IgbToolActionSubPanel></IgbToolActionIconMenu><IgbToolActionLabelName="zoomResetLabel"
@ref="zoomResetLabel"Title="Reset"AfterId="ZoomOut"IconName="reset"IconCollectionName="ChartToolbarIcons"CommandId="ZoomReset"IsHighlighted="true"></IgbToolActionLabel><IgbToolActionLabelName="zoomResetHidden"
@ref="zoomResetHidden"OverlayId="ZoomReset"Visibility="Visibility.Collapsed"></IgbToolActionLabel><IgbToolActionIconMenuName="AnalyzeMenu"
@ref="analyzeMenu"OverlayId="AnalyzeMenu"Visibility="Visibility.Collapsed"></IgbToolActionIconMenu><IgbToolActionLabelName="CopyMenu"
@ref="copyMenu"OverlayId="CopyMenu"Visibility="Visibility.Collapsed"></IgbToolActionLabel></IgbToolbar></div><divid="aboveContentRightContainer"><!-- insert aboveContentRight --><!-- end aboveContentRight --></div></div><divclass="container vertical fill"><IgbDataChartComputedPlotAreaMarginMode="ComputedPlotAreaMarginMode.Series"IsHorizontalZoomEnabled="true"IsVerticalZoomEnabled="true"Name="chart"
@ref="chart"><IgbCategoryXAxisName="xAxis"
@ref="xAxis"DataSource="CountryRenewableElectricity"Label="Year"></IgbCategoryXAxis><IgbNumericYAxisName="yAxis"
@ref="yAxis"Title="TWh"LabelLocation="AxisLabelsLocation.OutsideRight"></IgbNumericYAxis><IgbLineSeriesName="lineSeries1"
@ref="lineSeries1"Title="Electricity"XAxisName="xAxis"YAxisName="yAxis"DataSource="CountryRenewableElectricity"ValueMemberPath="America"></IgbLineSeries><IgbLineSeriesName="LineSeries2"
@ref="lineSeries2"Title="Electricity"XAxisName="xAxis"YAxisName="yAxis"DataSource="CountryRenewableElectricity"ValueMemberPath="Europe"></IgbLineSeries><IgbLineSeriesName="LineSeries3"
@ref="lineSeries3"Title="Electricity"XAxisName="xAxis"YAxisName="yAxis"DataSource="CountryRenewableElectricity"ValueMemberPath="China"></IgbLineSeries></IgbDataChart></div></div>@code {private Action BindElements { get; set; }
protectedoverrideasync Task OnAfterRenderAsync(bool firstRender)
{
var toolbar = this.toolbar;
var menuForSubPanelTool = this.menuForSubPanelTool;
var subPanelGroup = this.subPanelGroup;
var customSubPanelTools = this.customSubPanelTools;
var enableTooltipsLabel = this.enableTooltipsLabel;
var enableCrosshairsLabel = this.enableCrosshairsLabel;
var enableFinalValuesLabel = this.enableFinalValuesLabel;
var zoomResetLabel = this.zoomResetLabel;
var zoomResetHidden = this.zoomResetHidden;
var analyzeMenu = this.analyzeMenu;
var copyMenu = this.copyMenu;
var chart = this.chart;
var xAxis = this.xAxis;
var yAxis = this.yAxis;
var lineSeries1 = this.lineSeries1;
var lineSeries2 = this.lineSeries2;
var lineSeries3 = this.lineSeries3;
this.BindElements = () => {
toolbar.Target = this.chart;
};
this.BindElements();
}
private IgbToolbar toolbar;
private IgbToolActionIconMenu menuForSubPanelTool;
private IgbToolActionGroupHeader subPanelGroup;
private IgbToolActionSubPanel customSubPanelTools;
private IgbToolActionCheckbox enableTooltipsLabel;
private IgbToolActionCheckbox enableCrosshairsLabel;
private IgbToolActionCheckbox enableFinalValuesLabel;
private IgbToolActionLabel zoomResetLabel;
private IgbToolActionLabel zoomResetHidden;
private IgbToolActionIconMenu analyzeMenu;
private IgbToolActionLabel copyMenu;
private IgbDataChart chart;
private IgbCategoryXAxis xAxis;
private IgbNumericYAxis yAxis;
private IgbLineSeries lineSeries1;
private IgbLineSeries lineSeries2;
private IgbLineSeries lineSeries3;
publicvoidToolbarToggleAnnotations(IgbToolCommandEventArgs args)
{
var target = this.chart;
switch (args.Command.CommandId)
{
case"EnableTooltips":
IgbSeries annotationSeries = null;
foreach (var s in target.Series)
{
if (s is IgbDataToolTipLayer)
{
annotationSeries = s;
}
}
if (annotationSeries == null) {
target.Series.Add(new IgbDataToolTipLayer());
} else {
target.Series.Remove(annotationSeries);
}
break;
case"EnableCrosshairs":
IgbSeries crosshairSeries = null;
foreach (var s in target.Series)
{
if (s is IgbCrosshairLayer)
{
crosshairSeries = s;
}
}
if (crosshairSeries == null)
{
target.Series.Add(new IgbCrosshairLayer());
}
else
{
target.Series.Remove(crosshairSeries);
}
break;
case"EnableFinalValues":
IgbSeries finalValuesSeries = null;
foreach (var s in target.Series)
{
if (s is IgbFinalValueLayer)
{
finalValuesSeries = s;
}
}
if (finalValuesSeries == null)
{
target.Series.Add(new IgbFinalValueLayer());
}
else
{
target.Series.Remove(finalValuesSeries);
}
break;
}
}
private CountryRenewableElectricity _countryRenewableElectricity = null;
public CountryRenewableElectricity CountryRenewableElectricity
{
get
{
if (_countryRenewableElectricity == null)
{
_countryRenewableElectricity = new CountryRenewableElectricity();
}
return _countryRenewableElectricity;
}
}
}razor
Several pre-existing IgbToolAction items and menus become available when the IgbDataChart is linked with the Toolbar. Here is a list of the built-in Blazor IgbDataChart Tool Actions and their associated OverlayId:
Zooming Actions
ZoomMenu: A IgbToolActionIconMenu that exposes three IgbToolActionLabel items to invoke the ZoomIn and ZoomOut methods on the chart for increasing/decreasing the chart's zoom level including ZoomReset, a IgbToolActionLabel that invokes the ResetZoom method on the chart to reset the zoom level to it's default position.
Trend Actions
AnalyzeMenu: A IgbToolActionIconMenu that contains several options for configuring different options of the chart.
AnalyzeHeader: A sub section header.
LinesMenu: A sub menu containing various tools for showing different dashed horizontal lines on the chart.
LinesHeader: A sub menu section header for the following three tools:
MaxValue: A IgbToolActionCheckbox that displays a dashed horizontal line along the yAxis at the maximum value of the series.
MinValue: A IgbToolActionCheckbox that displays a dashed horizontal line along the yAxis at the minimum value of the series.
Average: A IgbToolActionCheckbox that displays a dashed horizontal line along the yAxis at the average value of the series.
TrendsMenu: A sub menu containing tools for applying various trendlines to the IgbDataChart plot area.
TrendsHeader: A sub menu section header for the following three tools:
SeriesAvg: A IgbToolActionCheckbox that adds or removes a IgbValueLayer to the chart's series collection using the ValueLayerValueMode of type Average.
ValueLabelsMenu: A sub menu containing various tools for showing different annotations on the IgbDataChart's plot area.
ValueLabelsHeader: A sub menu section header for the following tools:
ShowGridlines: A IgbToolActionCheckbox that toggles extra gridlines by applying a MajorStroke to the X-Axis.
Save to Image Action
CopyAsImage: A IgbToolActionLabel that exposes an option to copy the chart to the clipboard.
CopyHeader: A sub section header.
SVG Icons
When adding tools manually, icons can be assigned using the RenderIconFromText method. There are three paramters to pass in this method. The first is the icon collection name defined on the tool eg. IconCollectionName. The second is the name of the icon defined on the tool eg. IconName, followed by adding the SVG string.
Data URL Icons
Similarly to adding svg, you can also add an Icon image from a URL via the RegisterIconFromDataURL. The method's third parameter would be used to enter a string URL.
The following snippet shows both methods of adding an Icon.
The following example demonstrates the vertical orientation of the Blazor Toolbar.
EXAMPLE
MODULES
DATA
RAZOR
CSS
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 modulesnamespaceInfragistics.Samples
{
publicclassProgram
{
publicstaticasync Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbToolbarModule),
typeof(IgbDataChartToolbarModule),
typeof(IgbDataChartCoreModule),
typeof(IgbDataChartCategoryModule),
typeof(IgbDataChartAnnotationModule),
typeof(IgbDataChartInteractivityModule),
typeof(IgbAnnotationLayerProxyModule),
typeof(IgbDataChartCategoryTrendLineModule)
);
await builder.Build().RunAsync();
}
}
}cs
using System;
using System.Collections.Generic;
publicclassCountryRenewableElectricityItem
{
publicstring Year { get; set; }
publicdouble Europe { get; set; }
publicdouble China { get; set; }
publicdouble America { get; set; }
}
publicclassCountryRenewableElectricity
: List<CountryRenewableElectricityItem>
{
publicCountryRenewableElectricity()
{
this.Add(new CountryRenewableElectricityItem() { Year = @"2009", Europe = 34, China = 21, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2010", Europe = 43, China = 26, America = 24 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2011", Europe = 66, China = 29, America = 28 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2012", Europe = 69, China = 32, America = 26 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2013", Europe = 58, China = 47, America = 38 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2014", Europe = 40, China = 46, America = 31 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2015", Europe = 78, China = 50, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2016", Europe = 13, China = 90, America = 52 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2017", Europe = 78, China = 132, America = 50 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2019", Europe = 80, China = 96, America = 38 });
}
}cs
/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/css
Color Editor
You can add a custom color editor tool to the the Blazor Toolbar, which will also work with the Command event to perform custom styling to your application.
The following example demonstrates styling the Blazor Data Chart series brush with the Color Editor tool.
EXAMPLE
MODULES
DATA
RAZOR
CSS
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 modulesnamespaceInfragistics.Samples
{
publicclassProgram
{
publicstaticasync Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbToolbarModule),
typeof(IgbToolActionComboModule),
typeof(IgbToolActionColorEditorModule),
typeof(IgbDataChartToolbarModule),
typeof(IgbDataLegendModule),
typeof(IgbNumberAbbreviatorModule),
typeof(IgbDataChartCategoryModule),
typeof(IgbDataChartCoreModule),
typeof(IgbDataChartCategoryModule),
typeof(IgbDataChartAnnotationModule),
typeof(IgbDataChartInteractivityModule),
typeof(IgbDataChartAnnotationModule)
);
await builder.Build().RunAsync();
}
}
}cs
using System;
using System.Collections.Generic;
publicclassCountryRenewableElectricityItem
{
publicstring Year { get; set; }
publicdouble Europe { get; set; }
publicdouble China { get; set; }
publicdouble America { get; set; }
}
publicclassCountryRenewableElectricity
: List<CountryRenewableElectricityItem>
{
publicCountryRenewableElectricity()
{
this.Add(new CountryRenewableElectricityItem() { Year = @"2009", Europe = 34, China = 21, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2010", Europe = 43, China = 26, America = 24 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2011", Europe = 66, China = 29, America = 28 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2012", Europe = 69, China = 32, America = 26 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2013", Europe = 58, China = 47, America = 38 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2014", Europe = 40, China = 46, America = 31 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2015", Europe = 78, China = 50, America = 19 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2016", Europe = 13, China = 90, America = 52 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2017", Europe = 78, China = 132, America = 50 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2018", Europe = 40, China = 134, America = 34 });
this.Add(new CountryRenewableElectricityItem() { Year = @"2019", Europe = 80, China = 96, America = 38 });
}
}cs
@using IgniteUI.Blazor.Controls@using System<style>/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/#aboveContentSplit {
display: flex;
flex-direction: row;
}
#aboveContentLeftContainer {
margin-left: 1.25rem;
display: flex;
flex-grow: 1;
justify-content: start;
align-items: end;
}
#aboveContentRightContainer {
margin-right: 1.25rem;
display: flex;
flex-grow: 1;
justify-content: end;
align-items: end;
}
</style><divclass="container vertical"><divid="aboveContentSplit"><divid="aboveContentLeftContainer"><IgbToolbarName="toolbar"
@ref="toolbar"OnCommand="ColorEditorToggleSeriesBrush"><IgbToolActionColorEditorTitle="Series Brush"Name="colorEditorTool"
@ref="colorEditorTool"CommandId="ToggleSeriesBrush"></IgbToolActionColorEditor></IgbToolbar></div><divid="aboveContentRightContainer"><!-- insert aboveContentRight --><!-- end aboveContentRight --></div></div><divclass="container vertical fill"><IgbDataChartIsHorizontalZoomEnabled="true"Name="chart"
@ref="chart"><IgbCategoryXAxisName="xAxis"
@ref="xAxis"DataSource="CountryRenewableElectricity"Label="Year"></IgbCategoryXAxis><IgbNumericYAxisName="yAxis"
@ref="yAxis"Title="TWh"LabelLocation="AxisLabelsLocation.OutsideRight"></IgbNumericYAxis><IgbLineSeriesName="lineSeries1"
@ref="lineSeries1"Title="Electricity"XAxisName="xAxis"YAxisName="yAxis"DataSource="CountryRenewableElectricity"ValueMemberPath="America"MarkerType="MarkerType.None"></IgbLineSeries></IgbDataChart></div></div>@code {private Action BindElements { get; set; }
protectedoverrideasync Task OnAfterRenderAsync(bool firstRender)
{
var toolbar = this.toolbar;
var colorEditorTool = this.colorEditorTool;
var chart = this.chart;
var xAxis = this.xAxis;
var yAxis = this.yAxis;
var lineSeries1 = this.lineSeries1;
this.BindElements = () => {
toolbar.Target = this.chart;
};
this.BindElements();
}
private IgbToolbar toolbar;
private IgbToolActionColorEditor colorEditorTool;
private IgbDataChart chart;
private IgbCategoryXAxis xAxis;
private IgbNumericYAxis yAxis;
private IgbLineSeries lineSeries1;
publicvoidColorEditorToggleSeriesBrush(IgbToolCommandEventArgs args)
{
var target = this.chart;
var color = args.Command.ArgumentsList[0].Value;
switch (args.Command.CommandId)
{
case"ToggleSeriesBrush":
IgbSeries series = target.ContentSeries[0];
series.Brush = color.ToString();
break;
}
}
private CountryRenewableElectricity _countryRenewableElectricity = null;
public CountryRenewableElectricity CountryRenewableElectricity
{
get
{
if (_countryRenewableElectricity == null)
{
_countryRenewableElectricity = new CountryRenewableElectricity();
}
return _countryRenewableElectricity;
}
}
}razor