Web Components 차트 오버레이
이 Web Components IgcDataChartComponent
사용하면 를 사용하여 정의하는 단일 숫자 값에 수평선 또는 수직선을 배치할 수 있습니다 IgcValueOverlayComponent
. 이렇게 하면 특정 계열의 평균 또는 중앙값과 같은 데이터를 시각화하는 데 도움이 될 수 있습니다.
Web Components 값 오버레이 예제
다음 예에서는 몇 개의 수평 값 오버레이가 표시된 기둥 차트 보여줍니다.
import { IgcDataChartCoreModule } from 'igniteui-webcomponents-charts' ;
import { IgcDataChartCategoryCoreModule } from 'igniteui-webcomponents-charts' ;
import { IgcDataChartCategoryModule } from 'igniteui-webcomponents-charts' ;
import { IgcDataChartInteractivityModule } from 'igniteui-webcomponents-charts' ;
import { IgcColumnSeriesModule } from 'igniteui-webcomponents-charts' ;
import { IgcValueOverlayModule } from 'igniteui-webcomponents-charts' ;
import { IgcDataChartComponent } from 'igniteui-webcomponents-charts' ;
import { ModuleManager } from 'igniteui-webcomponents-core' ;
ModuleManager.register(
IgcDataChartCoreModule,
IgcDataChartCategoryCoreModule,
IgcDataChartCategoryModule,
IgcDataChartInteractivityModule,
IgcColumnSeriesModule,
IgcValueOverlayModule
);
export class DataChartSeriesValueOverlay {
private chart: IgcDataChartComponent;
constructor ( ) {
this .chart = document .getElementById('chart' ) as IgcDataChartComponent;
this .chart.dataSource = this .getData();
}
getData(): any [] {
const data = [
{ 'Label' : 1 , 'Value' : 1.0 },
{ 'Label' : 2 , 'Value' : 2.0 },
{ 'Label' : 3 , 'Value' : 6.0 },
{ 'Label' : 4 , 'Value' : 8.0 },
{ 'Label' : 5 , 'Value' : 2.0 },
{ 'Label' : 6 , 'Value' : 6.0 },
{ 'Label' : 7 , 'Value' : 4.0 },
{ 'Label' : 8 , 'Value' : 2.0 },
{ 'Label' : 9 , 'Value' : 1.0 },
];
return data;
}
}
new DataChartSeriesValueOverlay();
ts コピー <!DOCTYPE html >
<html >
<head >
<title > DataChartSeriesValueOverlay</title >
<meta charset ="UTF-8" />
<link rel ="shortcut icon" href ="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel ="stylesheet" href ="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel ="stylesheet" href ="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel ="stylesheet" href ="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel ="stylesheet" href ="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" type ="text/css" />
</head >
<body >
<div id ="root" >
<div class ="container sample" >
<div class ="container" style ="height: 100%" >
<igc-data-chart id ="chart" width ="100%" height ="100%"
is-horizontal-zoom-enabled ="true"
is-vertical-zoom-enabled ="true" >
<igc-category-x-axis name ="xAxis" label ="Label" >
</igc-category-x-axis >
<igc-numeric-y-axis name ="yAxis" minimum-value ="0" maximum-value ="10" >
</igc-numeric-y-axis >
<igc-column-series name ="series1" x-axis-name ="xAxis" y-axis-name ="yAxis" value-member-path ="Value" >
</igc-column-series >
<igc-value-overlay name ="overlay1" axis-name ="yAxis" value ="2.0" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay2" axis-name ="yAxis" value ="3.6" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay3" axis-name ="yAxis" value ="5.8" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay4" axis-name ="yAxis" value ="1.0" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay5" axis-name ="yAxis" value ="8.0" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay6" axis-name ="yAxis" value ="7.0" thickness ="5" >
</igc-value-overlay >
<igc-value-overlay name ="overlay7" axis-name ="yAxis" value ="5.0" thickness ="5" >
</igc-value-overlay >
</igc-data-chart >
</div >
</div >
</div >
<% if (false) { %><script src ="src/index.ts" > </script > <% } %>
</body >
</html >
html コピー
이 샘플이 마음에 드시나요? 당사의 완전한 Ignite UI for Web Components 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.
Web Components Value Overlay 속성
데이터 바인딩에 ItemsSource
사용하는 다른 계열 유형과 달리 값 오버레이는 ValueMemberPath
속성을 사용하여 단일 숫자 값을 바인딩합니다. 또한 값 오버레이를 사용하려면 사용할 단일 axis
정의해야 합니다. X축을 사용하면 값 오버레이가 수직선이 되고, Y축을 사용하면 수평선이 됩니다.
숫자 X 또는 Y 축을 사용하는 경우 ValueMemberPath
속성은 값 오버레이를 그릴 축의 실제 숫자 값을 반영해야 합니다. 범주 X 또는 Y 축을 사용하는 경우 ValueMemberPath
값 오버레이를 표시할 범주의 인덱스를 반영해야 합니다.
숫자 각도 축과 함께 값 오버레이를 사용하면 차트 중앙에서 선으로 나타나고 숫자 반경 축을 사용하면 원으로 나타납니다.
IgcValueOverlayComponent
모양 속성은 IgcSeriesComponent
에서 상속되므로 brush
및 thickness
을 사용할 수 있으며 다른 유형의 시리즈와 동일한 방식으로 작동합니다.
IgcValueOverlayComponent
에 축 주석을 표시하여 소유 축에 오버레이 값을 표시할 수도 있습니다. 이를 표시하려면 isAxisAnnotationEnabled
속성을 true로 설정하면 됩니다.
Web Components 가치 계층
또한 Web Components 차트 구성 요소는 값 라인을 사용하여 최소값, 최대값 및 평균값과 같은 데이터의 다양한 초점을 호출하는 기능을 제공합니다.
IgcCategoryChartComponent
및 IgcFinancialChartComponent
구성 요소에 IgcValueLayerComponent
적용하려면 차트에서 valueLines
속성을 설정하면 됩니다. 이 속성은 ValueLayerValueMode
열거형 컬렉션을 사용합니다. 차트의 valueLines
컬렉션에 여러 ValueLayerValueMode
열거를 추가하여 동일한 차트에서 여러 값 계층을 혼합하고 일치시킬 수 있습니다.
IgcDataChartComponent
에서는 차트의 IgcSeriesComponent
컬렉션에 IgcValueLayerComponent
추가한 다음 ValueMode
속성을 ValueLayerValueMode
열거 중 하나로 설정하여 이 작업을 수행합니다. 각 열거형과 그 의미는 다음과 같습니다.
IgcValueLayerComponent
요소를 사용할 때 특정 계열이 고려되지 않도록 하려면 레이어에서 targetSeries
속성을 설정하면 됩니다. 이렇게 하면 레이어가 정의한 계열을 대상으로 지정하게 됩니다. 단일 IgcDataChartComponent
내에 원하는 만큼 많은 IgcValueLayerComponent
요소를 가질 수 있습니다.
다음 샘플은 IgcCategoryChartComponent
에서 다양한 valueLines
의 사용법을 보여줍니다.
export class CountryRenewableElectricityItem {
public constructor (init: Partial<CountryRenewableElectricityItem> ) {
Object .assign(this , init);
}
public year: string ;
public europe: number ;
public china: number ;
public america: number ;
}
export class CountryRenewableElectricity extends Array <CountryRenewableElectricityItem > {
public constructor (items: Array <CountryRenewableElectricityItem> | number = -1 ) {
if (Array .isArray(items)) {
super (...items);
} else {
const newItems = [
new CountryRenewableElectricityItem(
{
year : `2009` ,
europe : 34 ,
china : 21 ,
america : 19
}),
new CountryRenewableElectricityItem(
{
year : `2010` ,
europe : 43 ,
china : 26 ,
america : 24
}),
new CountryRenewableElectricityItem(
{
year : `2011` ,
europe : 66 ,
china : 29 ,
america : 28
}),
new CountryRenewableElectricityItem(
{
year : `2012` ,
europe : 69 ,
china : 32 ,
america : 26
}),
new CountryRenewableElectricityItem(
{
year : `2013` ,
europe : 58 ,
china : 47 ,
america : 38
}),
new CountryRenewableElectricityItem(
{
year : `2014` ,
europe : 40 ,
china : 46 ,
america : 31
}),
new CountryRenewableElectricityItem(
{
year : `2015` ,
europe : 78 ,
china : 50 ,
america : 19
}),
new CountryRenewableElectricityItem(
{
year : `2016` ,
europe : 13 ,
china : 90 ,
america : 52
}),
new CountryRenewableElectricityItem(
{
year : `2017` ,
europe : 78 ,
china : 132 ,
america : 50
}),
new CountryRenewableElectricityItem(
{
year : `2018` ,
europe : 40 ,
china : 134 ,
america : 34
}),
new CountryRenewableElectricityItem(
{
year : `2018` ,
europe : 40 ,
china : 134 ,
america : 34
}),
new CountryRenewableElectricityItem(
{
year : `2019` ,
europe : 80 ,
china : 96 ,
america : 38
}),
];
super (...newItems.slice(0 ));
}
}
}
ts コピー import { IgcPropertyEditorPanelModule } from 'igniteui-webcomponents-layouts' ;
import { IgcLegendModule, IgcCategoryChartModule } from 'igniteui-webcomponents-charts' ;
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, LegendDescriptionModule, CategoryChartDescriptionModule } from 'igniteui-webcomponents-core' ;
import { IgcLegendComponent, IgcCategoryChartComponent } from 'igniteui-webcomponents-charts' ;
import { IgcPropertyEditorPanelComponent, IgcPropertyEditorPropertyDescriptionComponent } from 'igniteui-webcomponents-layouts' ;
import { CountryRenewableElectricityItem, CountryRenewableElectricity } from './CountryRenewableElectricity' ;
import { IgcPropertyEditorPropertyDescriptionChangedEventArgs } from 'igniteui-webcomponents-layouts' ;
import { MarkerType, MarkerType_$type } from 'igniteui-webcomponents-charts' ;
import { EnumUtil } from 'igniteui-webcomponents-core' ;
import 'igniteui-webcomponents/themes/light/bootstrap.css' ;
import { defineAllComponents } from 'igniteui-webcomponents' ;
import { ModuleManager } from 'igniteui-webcomponents-core' ;
defineAllComponents();
import "./index.css" ;
ModuleManager.register(
IgcPropertyEditorPanelModule,
IgcLegendModule,
IgcCategoryChartModule
);
export class Sample {
private legend: IgcLegendComponent
private propertyEditor: IgcPropertyEditorPanelComponent
private valueListEditor: IgcPropertyEditorPropertyDescriptionComponent
private chart: IgcCategoryChartComponent
private _bind: () => void ;
constructor ( ) {
var legend = this .legend = document .getElementById('legend' ) as IgcLegendComponent;
var propertyEditor = this .propertyEditor = document .getElementById('PropertyEditor' ) as IgcPropertyEditorPanelComponent;
var valueListEditor = this .valueListEditor = document .getElementById('ValueListEditor' ) as IgcPropertyEditorPropertyDescriptionComponent;
this .editorChangeUpdateValueLines = this .editorChangeUpdateValueLines.bind(this );
var chart = this .chart = document .getElementById('chart' ) as IgcCategoryChartComponent;
this ._bind = () => {
propertyEditor.componentRenderer = this .renderer;
propertyEditor.target = this .chart;
valueListEditor.changed = this .editorChangeUpdateValueLines;
chart.dataSource = this .countryRenewableElectricity;
chart.legend = this .legend;
}
this ._bind();
}
private _countryRenewableElectricity: CountryRenewableElectricity = null ;
public get countryRenewableElectricity (): CountryRenewableElectricity {
if (this ._countryRenewableElectricity == null )
{
this ._countryRenewableElectricity = new CountryRenewableElectricity();
}
return this ._countryRenewableElectricity;
}
private _componentRenderer: ComponentRenderer = null ;
public get renderer (): ComponentRenderer {
if (this ._componentRenderer == null ) {
this ._componentRenderer = new ComponentRenderer();
var context = this ._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
LegendDescriptionModule.register(context);
CategoryChartDescriptionModule.register(context);
}
return this ._componentRenderer;
}
public editorChangeUpdateValueLines(sender: any , args : IgcPropertyEditorPropertyDescriptionChangedEventArgs): void {
var item = sender as IgcPropertyEditorPropertyDescriptionComponent;
var chart = this .chart;
var valueLineType = item.primitiveValue;
chart.valueLines = valueLineType;
}
}
new Sample();
ts コピー <!DOCTYPE html >
<html >
<head >
<title > Sample | Ignite UI | Web Components | infragistics</title >
<meta charset ="UTF-8" />
<link rel ="shortcut icon" href ="https://static.infragistics.com/xplatform/images/browsers/wc.png" >
<link rel ="stylesheet" href ="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link rel ="stylesheet" href ="https://fonts.googleapis.com/css?family=Kanit&display=swap" />
<link rel ="stylesheet" href ="https://fonts.googleapis.com/css?family=Titillium Web" />
<link rel ="stylesheet" href ="https://static.infragistics.com/xplatform/css/samples/shared.v8.css" />
<link rel ="stylesheet" href ="/src/index.css" type ="text/css" />
</head >
<body >
<div id ="root" >
<div class ="container sample" >
<div class ="options vertical" >
<igc-property-editor-panel
name ="PropertyEditor"
id ="PropertyEditor"
description-type ="CategoryChart"
is-horizontal ="true"
is-wrapping-enabled ="true" >
<igc-property-editor-property-description
property-path ="ValueListHandler"
name ="ValueListEditor"
id ="ValueListEditor"
label ="Value List"
should-override-default-editor ="true"
value-type ="EnumValue"
drop-down-values ="Auto, Average, GlobalAverage, GlobalMaximum, GlobalMinimum, Maximum, Minimum"
drop-down-names ="Auto, Average, GlobalAverage, GlobalMaximum, GlobalMinimum, Maximum, Minimum"
primitive-value ="Auto" >
</igc-property-editor-property-description >
</igc-property-editor-panel >
</div >
<div class ="legend-title" >
Renewable Electricity Generated
</div >
<div class ="legend" >
<igc-legend
name ="legend"
id ="legend"
orientation ="Horizontal" >
</igc-legend >
</div >
<div class ="container fill" >
<igc-category-chart
name ="chart"
id ="chart"
included-properties ="year, america, europe"
chart-type ="Column"
is-horizontal-zoom-enabled ="false"
is-vertical-zoom-enabled ="false"
crosshairs-display-mode ="None"
is-transition-in-enabled ="false"
y-axis-minimum-value ="0"
y-axis-maximum-value ="100" >
</igc-category-chart >
</div >
</div >
</div >
<% if (false) { %><script src ="src/index.ts" > </script > <% } %>
</body >
</html >
html コピー
Web Components 금융 오버레이
또한 주식 차트 에서 내장된 재무 오버레이 및 지표를 그릴 Web Components 있습니다.
추가 리소스
다음 항목에서 관련 차트 유형에 대한 자세한 내용을 확인할 수 있습니다.
API 참조
다음은 위 섹션에서 언급된 API 멤버 목록입니다.