Web Components 도구 모음 구성 요소는 주로 차트 구성 요소와 함께 사용되는 UI 작업을 위한 동반 컨테이너입니다. 도구 모음은 IgcDataChartComponent 또는 IgcCategoryChartComponent 구성 요소에 연결될 때 속성 및 도구 항목의 사전 설정으로 동적으로 업데이트됩니다. 프로젝트에 대한 사용자 정의 도구를 만들어 최종 사용자가 변경 사항을 제공할 수 있으므로 무한한 양의 사용자 정의가 가능합니다.
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="legend-title">
Renewable Electricity Generated
</div><divclass="aboveContentSplit"><divclass="aboveContentLeftContainer"><igc-toolbarname="toolbar"id="toolbar"orientation="Horizontal"></igc-toolbar></div><divclass="aboveContentRightContainer"><igc-legendname="legend"id="legend"orientation="Horizontal"></igc-legend></div></div><divclass="container fill"><igc-category-chartname="chart"id="chart"chart-type="Line"is-horizontal-zoom-enabled="true"is-vertical-zoom-enabled="true"included-properties="year, europe, china, america"y-axis-title="TWh"y-axis-title-left-margin="10"y-axis-title-right-margin="5"y-axis-label-left-margin="0"y-axis-label-location="OutsideRight"is-transition-in-enabled="true"></igc-category-chart></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
다음 예제에서는 몇 가지 기능을 보여 줍니다. 먼저 도구를 그룹화할 수 있습니다. IgcToolActionSubPanelComponent 다음과 같은 내장 도구 숨기기를 포함합니다. 줌리셋 그리고 분석메뉴 메뉴 도구 작업. 이 예에서는 의 새 인스턴스가 있습니다. 줌리셋 도구 작업이 추가되어 줌메뉴를 사용하여 afterId 속성을 할당하고 축소. 또한 를 통해 강조 표시됩니다. isHighlighted 속성을 사용합니다. 이렇게 하면 새 재설정 도구가 맨 아래에 즉시 표시됩니다. 줌메뉴.
import { IgcToolbarModule } from'igniteui-webcomponents-layouts';
import { IgcDataChartToolbarModule, IgcDataChartCoreModule, IgcDataChartCategoryModule, IgcDataChartAnnotationModule, IgcDataChartInteractivityModule, IgcDataChartCategoryTrendLineModule } from'igniteui-webcomponents-charts';
import { IgcToolbarComponent, IgcToolActionIconMenuComponent, IgcToolActionGroupHeaderComponent, IgcToolActionSubPanelComponent, IgcToolActionCheckboxComponent, IgcToolActionLabelComponent } from'igniteui-webcomponents-layouts';
import { IgcDataChartComponent, IgcCategoryXAxisComponent, IgcNumericYAxisComponent, IgcLineSeriesComponent } from'igniteui-webcomponents-charts';
import { CountryRenewableElectricityItem, CountryRenewableElectricity } from'./CountryRenewableElectricity';
import { IgcToolCommandEventArgs } from'igniteui-webcomponents-layouts';
import { IgcSeriesComponent, IgcDataToolTipLayerComponent, IgcCrosshairLayerComponent, IgcFinalValueLayerComponent } from'igniteui-webcomponents-charts';
import { ModuleManager } from'igniteui-webcomponents-core';
import"./index.css";
ModuleManager.register(
IgcToolbarModule,
IgcDataChartToolbarModule,
IgcDataChartCoreModule,
IgcDataChartCategoryModule,
IgcDataChartAnnotationModule,
IgcDataChartInteractivityModule,
IgcDataChartCategoryTrendLineModule
);
exportclassSample{
private toolbar: IgcToolbarComponent
private menuForSubPanelTool: IgcToolActionIconMenuComponent
private subPanelGroup: IgcToolActionGroupHeaderComponent
private customSubPanelTools: IgcToolActionSubPanelComponent
private enableTooltipsLabel: IgcToolActionCheckboxComponent
private enableCrosshairsLabel: IgcToolActionCheckboxComponent
private enableFinalValuesLabel: IgcToolActionCheckboxComponent
private zoomResetLabel: IgcToolActionLabelComponent
private zoomResetHidden: IgcToolActionLabelComponent
private analyzeMenu: IgcToolActionIconMenuComponent
private copyMenu: IgcToolActionLabelComponent
private chart: IgcDataChartComponent
private xAxis: IgcCategoryXAxisComponent
private yAxis: IgcNumericYAxisComponent
private lineSeries1: IgcLineSeriesComponent
private lineSeries2: IgcLineSeriesComponent
private lineSeries3: IgcLineSeriesComponent
private _bind: () =>void;
constructor() {
var toolbar = this.toolbar = document.getElementById('toolbar') as IgcToolbarComponent;
this.toolbarToggleAnnotations = this.toolbarToggleAnnotations.bind(this);
var menuForSubPanelTool = this.menuForSubPanelTool = document.getElementById('MenuForSubPanelTool') as IgcToolActionIconMenuComponent;
var subPanelGroup = this.subPanelGroup = document.getElementById('SubPanelGroup') as IgcToolActionGroupHeaderComponent;
var customSubPanelTools = this.customSubPanelTools = document.getElementById('CustomSubPanelTools') as IgcToolActionSubPanelComponent;
var enableTooltipsLabel = this.enableTooltipsLabel = document.getElementById('EnableTooltipsLabel') as IgcToolActionCheckboxComponent;
var enableCrosshairsLabel = this.enableCrosshairsLabel = document.getElementById('EnableCrosshairsLabel') as IgcToolActionCheckboxComponent;
var enableFinalValuesLabel = this.enableFinalValuesLabel = document.getElementById('EnableFinalValuesLabel') as IgcToolActionCheckboxComponent;
var zoomResetLabel = this.zoomResetLabel = document.getElementById('zoomResetLabel') as IgcToolActionLabelComponent;
var zoomResetHidden = this.zoomResetHidden = document.getElementById('zoomResetHidden') as IgcToolActionLabelComponent;
var analyzeMenu = this.analyzeMenu = document.getElementById('AnalyzeMenu') as IgcToolActionIconMenuComponent;
var copyMenu = this.copyMenu = document.getElementById('CopyMenu') as IgcToolActionLabelComponent;
var chart = this.chart = document.getElementById('chart') as IgcDataChartComponent;
var xAxis = this.xAxis = document.getElementById('xAxis') as IgcCategoryXAxisComponent;
var yAxis = this.yAxis = document.getElementById('yAxis') as IgcNumericYAxisComponent;
var lineSeries1 = this.lineSeries1 = document.getElementById('lineSeries1') as IgcLineSeriesComponent;
var lineSeries2 = this.lineSeries2 = document.getElementById('LineSeries2') as IgcLineSeriesComponent;
var lineSeries3 = this.lineSeries3 = document.getElementById('LineSeries3') as IgcLineSeriesComponent;
this._bind = () => {
toolbar.target = this.chart;
toolbar.onCommand = this.toolbarToggleAnnotations;
xAxis.dataSource = this.countryRenewableElectricity;
lineSeries1.xAxis = this.xAxis;
lineSeries1.yAxis = this.yAxis;
lineSeries1.dataSource = this.countryRenewableElectricity;
lineSeries2.xAxis = this.xAxis;
lineSeries2.yAxis = this.yAxis;
lineSeries2.dataSource = this.countryRenewableElectricity;
lineSeries3.xAxis = this.xAxis;
lineSeries3.yAxis = this.yAxis;
lineSeries3.dataSource = this.countryRenewableElectricity;
}
this._bind();
}
private _countryRenewableElectricity: CountryRenewableElectricity = null;
publicgetcountryRenewableElectricity(): CountryRenewableElectricity {
if (this._countryRenewableElectricity == null)
{
this._countryRenewableElectricity = new CountryRenewableElectricity();
}
returnthis._countryRenewableElectricity;
}
public toolbarToggleAnnotations(sender: any, args: IgcToolCommandEventArgs): void {
var target = this.chart;
switch (args.command.commandId)
{
case"EnableTooltips":
var enable = args.command.argumentsList[0].value asboolean;
if (enable)
{
target.series.add(new IgcDataToolTipLayerComponent());
}
else
{
var toRemove = null;
for (var i = 0; i < target.actualSeries.length; i++) {
let s = target.actualSeries[i] as IgcSeriesComponent;
if (s instanceof IgcDataToolTipLayerComponent)
{
toRemove = s;
}
}
if (toRemove != null)
{
target.series.remove(toRemove);
}
}
break;
case"EnableCrosshairs":
var enable = args.command.argumentsList[0].value asboolean;
if (enable)
{
target.series.add(new IgcCrosshairLayerComponent());
}
else
{
var toRemove = null;
for (var i = 0; i < target.actualSeries.length; i++) {
let s = target.actualSeries[i] as IgcSeriesComponent;
if (s instanceof IgcCrosshairLayerComponent)
{
toRemove = s;
}
}
if (toRemove != null)
{
target.series.remove(toRemove);
}
}
break;
case"EnableFinalValues":
var enable = args.command.argumentsList[0].value asboolean;
if (enable)
{
target.series.add(new IgcFinalValueLayerComponent());
}
else
{
var toRemove = null;
for (var i = 0; i < target.actualSeries.length; i++) {
let s = target.actualSeries[i] as IgcSeriesComponent;
if (s instanceof IgcFinalValueLayerComponent)
{
toRemove = s;
}
}
if (toRemove != null)
{
target.series.remove(toRemove);
}
}
break;
}
}
}
new Sample();
ts
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="aboveContentSplit"><divclass="aboveContentLeftContainer"><igc-toolbarname="toolbar"id="toolbar"orientation="Horizontal"><igc-tool-action-icon-menuname="MenuForSubPanelTool"id="MenuForSubPanelTool"icon-collection-name="ChartToolbarIcons"icon-name="analyze"><igc-tool-action-group-headername="SubPanelGroup"id="SubPanelGroup"close-on-execute="true"title="Visualizations"subtitle="Layers"></igc-tool-action-group-header><igc-tool-action-sub-panelname="CustomSubPanelTools"id="CustomSubPanelTools"><igc-tool-action-checkboxname="EnableTooltipsLabel"id="EnableTooltipsLabel"title="Enable Tooltips"command-id="EnableTooltips"></igc-tool-action-checkbox><igc-tool-action-checkboxname="EnableCrosshairsLabel"id="EnableCrosshairsLabel"title="Enable Crosshairs"command-id="EnableCrosshairs"></igc-tool-action-checkbox><igc-tool-action-checkboxname="EnableFinalValuesLabel"id="EnableFinalValuesLabel"title="Enable Final Values"command-id="EnableFinalValues"></igc-tool-action-checkbox></igc-tool-action-sub-panel></igc-tool-action-icon-menu><igc-tool-action-labelname="zoomResetLabel"id="zoomResetLabel"title="Reset"after-id="ZoomOut"icon-name="reset"icon-collection-name="ChartToolbarIcons"command-id="ZoomReset"is-highlighted="true"></igc-tool-action-label><igc-tool-action-labelname="zoomResetHidden"id="zoomResetHidden"overlay-id="ZoomReset"visibility="Collapsed"></igc-tool-action-label><igc-tool-action-icon-menuname="AnalyzeMenu"id="AnalyzeMenu"overlay-id="AnalyzeMenu"visibility="Collapsed"></igc-tool-action-icon-menu><igc-tool-action-labelname="CopyMenu"id="CopyMenu"overlay-id="CopyMenu"visibility="Collapsed"></igc-tool-action-label></igc-toolbar></div><divclass="aboveContentRightContainer"><!-- insert aboveContentRight --><!-- end aboveContentRight --></div></div><divclass="container fill"><igc-data-chartcomputed-plot-area-margin-mode="Series"is-horizontal-zoom-enabled="true"is-vertical-zoom-enabled="true"name="chart"id="chart"><igc-category-x-axisname="xAxis"id="xAxis"label="year"></igc-category-x-axis><igc-numeric-y-axisname="yAxis"id="yAxis"title="TWh"label-location="OutsideRight"></igc-numeric-y-axis><igc-line-seriesname="lineSeries1"id="lineSeries1"title="Electricity"value-member-path="america"></igc-line-series><igc-line-seriesname="LineSeries2"id="LineSeries2"title="Electricity"value-member-path="europe"></igc-line-series><igc-line-seriesname="LineSeries3"id="LineSeries3"title="Electricity"value-member-path="china"></igc-line-series></igc-data-chart></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
도구를 수동으로 추가할 때 이 RenderIconFromText 방법을 사용하여 아이콘을 할당할 수 있습니다. 이 메서드에는 세 가지 매개 변수가 있습니다. 첫 번째는 도구에 정의된 아이콘 컬렉션 이름입니다. iconCollectionName 두 번째는 도구에 정의된 아이콘의 이름(예: iconName SVG 문자열 추가)입니다.
데이터 URL 아이콘
svg를 추가하는 것과 마찬가지로 URL RegisterIconFromDataURL에서 아이콘 이미지를 추가할 수도 있습니다. 메서드의 세 번째 매개 변수는 문자열 URL을 입력하는 데 사용됩니다.
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="aboveContent"><igc-toolbarname="toolbar"id="toolbar"orientation="Vertical"></igc-toolbar></div><divclass="container fill"><igc-data-chartis-horizontal-zoom-enabled="true"name="chart"id="chart"><igc-category-x-axisname="xAxis"id="xAxis"label="year"></igc-category-x-axis><igc-numeric-y-axisname="yAxis"id="yAxis"title="TWh"label-location="OutsideRight"></igc-numeric-y-axis><igc-line-seriesname="lineSeries1"id="lineSeries1"title="Electricity"value-member-path="america"></igc-line-series></igc-data-chart></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html
/* shared styles are loaded from: *//* https://static.infragistics.com/xplatform/css/samples */css
색상 편집기
Web Components 도구 모음에 사용자 정의 색상 편집기 도구를 추가할 수 있으며, 이 도구는 명령 이벤트와 함께 작동하여 애플리케이션에 사용자 정의 스타일을 적용할 수도 있습니다.
import { IgcToolbarModule, IgcToolActionComboModule, IgcToolActionColorEditorModule } from'igniteui-webcomponents-layouts';
import { IgcDataChartToolbarModule, IgcDataLegendModule, IgcNumberAbbreviatorModule, IgcDataChartCategoryModule, IgcDataChartCoreModule, IgcDataChartAnnotationModule, IgcDataChartInteractivityModule } from'igniteui-webcomponents-charts';
import { IgcToolbarComponent, IgcToolActionColorEditorComponent } from'igniteui-webcomponents-layouts';
import { IgcDataChartComponent, IgcCategoryXAxisComponent, IgcNumericYAxisComponent, IgcLineSeriesComponent } from'igniteui-webcomponents-charts';
import { CountryRenewableElectricityItem, CountryRenewableElectricity } from'./CountryRenewableElectricity';
import { IgcToolCommandEventArgs } from'igniteui-webcomponents-layouts';
import { IgcSeriesComponent } from'igniteui-webcomponents-charts';
import { ModuleManager } from'igniteui-webcomponents-core';
import"./index.css";
ModuleManager.register(
IgcToolbarModule,
IgcToolActionComboModule,
IgcToolActionColorEditorModule,
IgcDataChartToolbarModule,
IgcDataLegendModule,
IgcNumberAbbreviatorModule,
IgcDataChartCategoryModule,
IgcDataChartCoreModule,
IgcDataChartCategoryModule,
IgcDataChartAnnotationModule,
IgcDataChartInteractivityModule,
IgcDataChartAnnotationModule
);
exportclassSample{
private toolbar: IgcToolbarComponent
private colorEditorTool: IgcToolActionColorEditorComponent
private chart: IgcDataChartComponent
private xAxis: IgcCategoryXAxisComponent
private yAxis: IgcNumericYAxisComponent
private lineSeries1: IgcLineSeriesComponent
private _bind: () =>void;
constructor() {
var toolbar = this.toolbar = document.getElementById('toolbar') as IgcToolbarComponent;
this.colorEditorToggleSeriesBrush = this.colorEditorToggleSeriesBrush.bind(this);
var colorEditorTool = this.colorEditorTool = document.getElementById('colorEditorTool') as IgcToolActionColorEditorComponent;
var chart = this.chart = document.getElementById('chart') as IgcDataChartComponent;
var xAxis = this.xAxis = document.getElementById('xAxis') as IgcCategoryXAxisComponent;
var yAxis = this.yAxis = document.getElementById('yAxis') as IgcNumericYAxisComponent;
var lineSeries1 = this.lineSeries1 = document.getElementById('lineSeries1') as IgcLineSeriesComponent;
this._bind = () => {
toolbar.target = this.chart;
toolbar.onCommand = this.colorEditorToggleSeriesBrush;
xAxis.dataSource = this.countryRenewableElectricity;
lineSeries1.xAxis = this.xAxis;
lineSeries1.yAxis = this.yAxis;
lineSeries1.dataSource = this.countryRenewableElectricity;
}
this._bind();
}
private _countryRenewableElectricity: CountryRenewableElectricity = null;
publicgetcountryRenewableElectricity(): CountryRenewableElectricity {
if (this._countryRenewableElectricity == null)
{
this._countryRenewableElectricity = new CountryRenewableElectricity();
}
returnthis._countryRenewableElectricity;
}
public colorEditorToggleSeriesBrush(sender: any, args: IgcToolCommandEventArgs): void {
var target = this.chart;
var color = args.command.argumentsList[0].value;
switch (args.command.commandId)
{
case"ToggleSeriesBrush":
let series = target.contentSeries[0] as IgcSeriesComponent;
series.brush = color asany;
break;
}
}
}
new Sample();
ts
<!DOCTYPE html><html><head><title>Sample | Ignite UI | Web Components | infragistics</title><metacharset="UTF-8" /><linkrel="shortcut icon"href="https://static.infragistics.com/xplatform/images/browsers/wc.png" ><linkrel="stylesheet"href="https://fonts.googleapis.com/icon?family=Material+Icons" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Kanit&display=swap" /><linkrel="stylesheet"href="https://fonts.googleapis.com/css?family=Titillium Web" /><linkrel="stylesheet"href="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" /><linkrel="stylesheet"href="/src/index.css"type="text/css" /></head><body><divid="root"><divclass="container sample"><divclass="aboveContentSplit"><divclass="aboveContentLeftContainer"><igc-toolbarname="toolbar"id="toolbar"><igc-tool-action-color-editortitle="Series Brush"name="colorEditorTool"id="colorEditorTool"command-id="ToggleSeriesBrush"></igc-tool-action-color-editor></igc-toolbar></div><divclass="aboveContentRightContainer"><!-- insert aboveContentRight --><!-- end aboveContentRight --></div></div><divclass="container fill"><igc-data-chartis-horizontal-zoom-enabled="true"name="chart"id="chart"><igc-category-x-axisname="xAxis"id="xAxis"label="year"></igc-category-x-axis><igc-numeric-y-axisname="yAxis"id="yAxis"title="TWh"label-location="OutsideRight"></igc-numeric-y-axis><igc-line-seriesname="lineSeries1"id="lineSeries1"title="Electricity"value-member-path="america"marker-type="None"></igc-line-series></igc-data-chart></div></div></div><!-- This script is needed only for parcel and it will be excluded for webpack -->
<% if (false) { %><scriptsrc="src/index.ts"></script><% } %>
</body></html>html