React Chart Highlighting Example
다음 예는 React 차트에서 사용할 수 있는 다양한 강조 표시 옵션을 보여줍니다.
export class TemperatureAnnotatedDataItem {
public constructor(init: Partial<TemperatureAnnotatedDataItem>) {
Object.assign(this, init);
}
public index: number;
public tempInfo: string;
public temperature: number;
public month: string;
}
export class TemperatureAnnotatedData extends Array<TemperatureAnnotatedDataItem> {
public constructor(items: Array<TemperatureAnnotatedDataItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new TemperatureAnnotatedDataItem({ index: 0, tempInfo: `27°C`, temperature: 27, month: `Jan` }),
new TemperatureAnnotatedDataItem({ index: 1, tempInfo: `25°C`, temperature: 25, month: `Feb` }),
new TemperatureAnnotatedDataItem({ index: 2, tempInfo: `21°C`, temperature: 21, month: `Mar` }),
new TemperatureAnnotatedDataItem({ index: 3, tempInfo: `19°C`, temperature: 19, month: `Apr` }),
new TemperatureAnnotatedDataItem({ index: 4, tempInfo: `16°C`, temperature: 16, month: `May` }),
new TemperatureAnnotatedDataItem({ index: 5, tempInfo: `13°C`, temperature: 13, month: `Jun` }),
new TemperatureAnnotatedDataItem({ index: 6, tempInfo: `14°C`, temperature: 14, month: `Jul` }),
new TemperatureAnnotatedDataItem({ index: 7, tempInfo: `15°C`, temperature: 15, month: `Aug` }),
new TemperatureAnnotatedDataItem({ index: 8, tempInfo: `19°C`, temperature: 19, month: `Sep` }),
new TemperatureAnnotatedDataItem({ index: 9, tempInfo: `22°C`, temperature: 22, month: `Oct` }),
new TemperatureAnnotatedDataItem({ index: 10, tempInfo: `26°C`, temperature: 26, month: `Nov` }),
new TemperatureAnnotatedDataItem({ index: 11, tempInfo: `30°C`, temperature: 30, month: `Dec` }),
];
super(...newItems.slice(0));
}
}
}
tsimport React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChartModule } from "@infragistics/igniteui-react-charts";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChart } from "@infragistics/igniteui-react-charts";
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, CategoryChartDescriptionModule } from "@infragistics/igniteui-react-core";
import { TemperatureAnnotatedDataItem, TemperatureAnnotatedData } from './TemperatureAnnotatedData';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrPropertyEditorPanelModule,
IgrCategoryChartModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditor: IgrPropertyEditorPanel
private propertyEditorRef(r: IgrPropertyEditorPanel) {
this.propertyEditor = r;
this.setState({});
}
private highlightingModeEditor: IgrPropertyEditorPropertyDescription
private highlightingBehaviorEditor: IgrPropertyEditorPropertyDescription
private chart: IgrCategoryChart
private chartRef(r: IgrCategoryChart) {
this.chart = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.propertyEditorRef = this.propertyEditorRef.bind(this);
this.chartRef = this.chartRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorRef}
componentRenderer={this.renderer}
target={this.chart}
descriptionType="CategoryChart"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
propertyPath="HighlightingMode"
name="HighlightingModeEditor"
label="Highlighting Mode: "
primitiveValue="FadeOthersSpecific">
</IgrPropertyEditorPropertyDescription>
<IgrPropertyEditorPropertyDescription
propertyPath="HighlightingBehavior"
name="HighlightingBehaviorEditor"
label="Highlighting Behavior: "
primitiveValue="NearestItemsAndSeries">
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="legend-title">
Average Temperature in Sydney
</div>
<div className="container fill">
<IgrCategoryChart
ref={this.chartRef}
chartType="Column"
computedPlotAreaMarginMode="Series"
isHorizontalZoomEnabled="false"
isVerticalZoomEnabled="false"
dataSource={this.temperatureAnnotatedData}
highlightingMode="FadeOthersSpecific"
highlightingBehavior="NearestItemsAndSeries"
yAxisMaximumValue="35"
yAxisLabelLocation="OutsideRight"
toolTipType="None"
isTransitionInEnabled="false">
</IgrCategoryChart>
</div>
</div>
);
}
private _temperatureAnnotatedData: TemperatureAnnotatedData = null;
public get temperatureAnnotatedData(): TemperatureAnnotatedData {
if (this._temperatureAnnotatedData == null)
{
this._temperatureAnnotatedData = new TemperatureAnnotatedData();
}
return this._temperatureAnnotatedData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
CategoryChartDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
React 차트 강조 모드 및 동작
모든 React Charts는 다양한 강조 표시 옵션을 지원합니다. highlightingMode
플롯 영역에 렌더링된 시리즈/데이터 항목 위로 마우스를 가져갈 때 밝아지거나 희미해지도록 설정할 수 있습니다. highlightingBehavior
강조 표시 효과를 트리거하기 위해 바로 위 또는 가장 가까운 데이터 항목으로 설정할 수 있습니다. 강조 표시 모드와 동작은 IgrCategoryChart
, IgrFinancialChart
및 IgrDataChart
컨트롤에서 지원되며 강조 표시 기능을 사용하기 위한 동일한 API를 가지고 있습니다.
다음 예제는 React 차트의 highlightingMode
보여줍니다.
export class TemperatureAnnotatedDataItem {
public constructor(init: Partial<TemperatureAnnotatedDataItem>) {
Object.assign(this, init);
}
public index: number;
public tempInfo: string;
public temperature: number;
public month: string;
}
export class TemperatureAnnotatedData extends Array<TemperatureAnnotatedDataItem> {
public constructor(items: Array<TemperatureAnnotatedDataItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new TemperatureAnnotatedDataItem({ index: 0, tempInfo: `27°C`, temperature: 27, month: `Jan` }),
new TemperatureAnnotatedDataItem({ index: 1, tempInfo: `25°C`, temperature: 25, month: `Feb` }),
new TemperatureAnnotatedDataItem({ index: 2, tempInfo: `21°C`, temperature: 21, month: `Mar` }),
new TemperatureAnnotatedDataItem({ index: 3, tempInfo: `19°C`, temperature: 19, month: `Apr` }),
new TemperatureAnnotatedDataItem({ index: 4, tempInfo: `16°C`, temperature: 16, month: `May` }),
new TemperatureAnnotatedDataItem({ index: 5, tempInfo: `13°C`, temperature: 13, month: `Jun` }),
new TemperatureAnnotatedDataItem({ index: 6, tempInfo: `14°C`, temperature: 14, month: `Jul` }),
new TemperatureAnnotatedDataItem({ index: 7, tempInfo: `15°C`, temperature: 15, month: `Aug` }),
new TemperatureAnnotatedDataItem({ index: 8, tempInfo: `19°C`, temperature: 19, month: `Sep` }),
new TemperatureAnnotatedDataItem({ index: 9, tempInfo: `22°C`, temperature: 22, month: `Oct` }),
new TemperatureAnnotatedDataItem({ index: 10, tempInfo: `26°C`, temperature: 26, month: `Nov` }),
new TemperatureAnnotatedDataItem({ index: 11, tempInfo: `30°C`, temperature: 30, month: `Dec` }),
];
super(...newItems.slice(0));
}
}
}
tsimport React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChartModule } from "@infragistics/igniteui-react-charts";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChart } from "@infragistics/igniteui-react-charts";
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, CategoryChartDescriptionModule } from "@infragistics/igniteui-react-core";
import { TemperatureAnnotatedDataItem, TemperatureAnnotatedData } from './TemperatureAnnotatedData';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrPropertyEditorPanelModule,
IgrCategoryChartModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditor: IgrPropertyEditorPanel
private propertyEditorRef(r: IgrPropertyEditorPanel) {
this.propertyEditor = r;
this.setState({});
}
private highlightingModeEditor: IgrPropertyEditorPropertyDescription
private chart: IgrCategoryChart
private chartRef(r: IgrCategoryChart) {
this.chart = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.propertyEditorRef = this.propertyEditorRef.bind(this);
this.chartRef = this.chartRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorRef}
componentRenderer={this.renderer}
target={this.chart}
descriptionType="CategoryChart"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
propertyPath="HighlightingMode"
name="HighlightingModeEditor"
label="Highlighting Mode: "
primitiveValue="BrightenSpecific">
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="container fill">
<IgrCategoryChart
ref={this.chartRef}
chartType="Column"
computedPlotAreaMarginMode="Series"
isHorizontalZoomEnabled="false"
isVerticalZoomEnabled="false"
dataSource={this.temperatureAnnotatedData}
highlightingMode="BrightenSpecific"
toolTipType="None"
crosshairsDisplayMode="None"
isTransitionInEnabled="false">
</IgrCategoryChart>
</div>
</div>
);
}
private _temperatureAnnotatedData: TemperatureAnnotatedData = null;
public get temperatureAnnotatedData(): TemperatureAnnotatedData {
if (this._temperatureAnnotatedData == null)
{
this._temperatureAnnotatedData = new TemperatureAnnotatedData();
}
return this._temperatureAnnotatedData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
CategoryChartDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
다음 예제는 React 차트의 highlightingBehavior
보여줍니다.
export class TemperatureAnnotatedDataItem {
public constructor(init: Partial<TemperatureAnnotatedDataItem>) {
Object.assign(this, init);
}
public index: number;
public tempInfo: string;
public temperature: number;
public month: string;
}
export class TemperatureAnnotatedData extends Array<TemperatureAnnotatedDataItem> {
public constructor(items: Array<TemperatureAnnotatedDataItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new TemperatureAnnotatedDataItem({ index: 0, tempInfo: `27°C`, temperature: 27, month: `Jan` }),
new TemperatureAnnotatedDataItem({ index: 1, tempInfo: `25°C`, temperature: 25, month: `Feb` }),
new TemperatureAnnotatedDataItem({ index: 2, tempInfo: `21°C`, temperature: 21, month: `Mar` }),
new TemperatureAnnotatedDataItem({ index: 3, tempInfo: `19°C`, temperature: 19, month: `Apr` }),
new TemperatureAnnotatedDataItem({ index: 4, tempInfo: `16°C`, temperature: 16, month: `May` }),
new TemperatureAnnotatedDataItem({ index: 5, tempInfo: `13°C`, temperature: 13, month: `Jun` }),
new TemperatureAnnotatedDataItem({ index: 6, tempInfo: `14°C`, temperature: 14, month: `Jul` }),
new TemperatureAnnotatedDataItem({ index: 7, tempInfo: `15°C`, temperature: 15, month: `Aug` }),
new TemperatureAnnotatedDataItem({ index: 8, tempInfo: `19°C`, temperature: 19, month: `Sep` }),
new TemperatureAnnotatedDataItem({ index: 9, tempInfo: `22°C`, temperature: 22, month: `Oct` }),
new TemperatureAnnotatedDataItem({ index: 10, tempInfo: `26°C`, temperature: 26, month: `Nov` }),
new TemperatureAnnotatedDataItem({ index: 11, tempInfo: `30°C`, temperature: 30, month: `Dec` }),
];
super(...newItems.slice(0));
}
}
}
tsimport React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrPropertyEditorPanelModule } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChartModule } from "@infragistics/igniteui-react-charts";
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from "@infragistics/igniteui-react-layouts";
import { IgrCategoryChart } from "@infragistics/igniteui-react-charts";
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, CategoryChartDescriptionModule } from "@infragistics/igniteui-react-core";
import { TemperatureAnnotatedDataItem, TemperatureAnnotatedData } from './TemperatureAnnotatedData';
import 'igniteui-webcomponents/themes/light/bootstrap.css';
const mods: any[] = [
IgrPropertyEditorPanelModule,
IgrCategoryChartModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private propertyEditor: IgrPropertyEditorPanel
private propertyEditorRef(r: IgrPropertyEditorPanel) {
this.propertyEditor = r;
this.setState({});
}
private highlightingBehaviorEditor: IgrPropertyEditorPropertyDescription
private chart: IgrCategoryChart
private chartRef(r: IgrCategoryChart) {
this.chart = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.propertyEditorRef = this.propertyEditorRef.bind(this);
this.chartRef = this.chartRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample">
<div className="options vertical">
<IgrPropertyEditorPanel
ref={this.propertyEditorRef}
componentRenderer={this.renderer}
target={this.chart}
descriptionType="CategoryChart"
isHorizontal="true"
isWrappingEnabled="true">
<IgrPropertyEditorPropertyDescription
propertyPath="HighlightingBehavior"
name="HighlightingBehaviorEditor"
label="Highlighting Behavior: "
primitiveValue="DirectlyOver">
</IgrPropertyEditorPropertyDescription>
</IgrPropertyEditorPanel>
</div>
<div className="container fill">
<IgrCategoryChart
ref={this.chartRef}
chartType="Column"
computedPlotAreaMarginMode="Series"
isHorizontalZoomEnabled="false"
isVerticalZoomEnabled="false"
dataSource={this.temperatureAnnotatedData}
highlightingMode="Brighten"
highlightingBehavior="DirectlyOver"
toolTipType="None"
crosshairsDisplayMode="None"
isTransitionInEnabled="false">
</IgrCategoryChart>
</div>
</div>
);
}
private _temperatureAnnotatedData: TemperatureAnnotatedData = null;
public get temperatureAnnotatedData(): TemperatureAnnotatedData {
if (this._temperatureAnnotatedData == null)
{
this._temperatureAnnotatedData = new TemperatureAnnotatedData();
}
return this._temperatureAnnotatedData;
}
private _componentRenderer: ComponentRenderer = null;
public get renderer(): ComponentRenderer {
if (this._componentRenderer == null) {
this._componentRenderer = new ComponentRenderer();
var context = this._componentRenderer.context;
PropertyEditorPanelDescriptionModule.register(context);
CategoryChartDescriptionModule.register(context);
}
return this._componentRenderer;
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
React 차트 범례 강조
모든 React Charts는 범례 강조 표시를 지원합니다. legendHighlightingMode
활성화하면 마우스가 범례 마커 항목 위에 있을 때 렌더링된 시리즈가 플롯 영역에서 강조 표시됩니다. 범례 강조 표시는 IgrCategoryChart
, IgrFinancialChart
및 IgrDataChart
컨트롤에서 지원되며 강조 표시 기능을 사용하기 위한 동일한 API를 가지고 있습니다.
다음 예는 React 차트를 강조하는 범례 시리즈를 보여줍니다.
export class HighestGrossingMoviesItem {
public constructor(init: Partial<HighestGrossingMoviesItem>) {
Object.assign(this, init);
}
public franchise: string;
public totalRevenue: number;
public highestGrossing: number;
}
export class HighestGrossingMovies extends Array<HighestGrossingMoviesItem> {
public constructor(items: Array<HighestGrossingMoviesItem> | number = -1) {
if (Array.isArray(items)) {
super(...items);
} else {
const newItems = [
new HighestGrossingMoviesItem({ franchise: `Marvel Universe`, totalRevenue: 22.55, highestGrossing: 2.8 }),
new HighestGrossingMoviesItem({ franchise: `Star Wars`, totalRevenue: 10.32, highestGrossing: 2.07 }),
new HighestGrossingMoviesItem({ franchise: `Harry Potter`, totalRevenue: 9.19, highestGrossing: 1.34 }),
new HighestGrossingMoviesItem({ franchise: `Avengers`, totalRevenue: 7.76, highestGrossing: 2.8 }),
new HighestGrossingMoviesItem({ franchise: `Spider Man`, totalRevenue: 7.22, highestGrossing: 1.28 }),
new HighestGrossingMoviesItem({ franchise: `James Bond`, totalRevenue: 7.12, highestGrossing: 1.11 }),
];
super(...newItems.slice(0));
}
}
}
tsimport React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrLegendModule, IgrCategoryChartModule } from "@infragistics/igniteui-react-charts";
import { IgrLegend, IgrCategoryChart } from "@infragistics/igniteui-react-charts";
import { HighestGrossingMoviesItem, HighestGrossingMovies } from './HighestGrossingMovies';
const mods: any[] = [
IgrLegendModule,
IgrCategoryChartModule
];
mods.forEach((m) => m.register());
export default class Sample extends React.Component<any, any> {
private legend: IgrLegend
private legendRef(r: IgrLegend) {
this.legend = r;
this.setState({});
}
private chart: IgrCategoryChart
private chartRef(r: IgrCategoryChart) {
this.chart = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.legendRef = this.legendRef.bind(this);
this.chartRef = this.chartRef.bind(this);
}
public render(): JSX.Element {
return (
<div className="container sample">
<div className="legend-title">
Highest Grossing Movie Franchises
</div>
<div className="legend">
<IgrLegend
ref={this.legendRef}>
</IgrLegend>
</div>
<div className="container fill">
<IgrCategoryChart
ref={this.chartRef}
legend={this.legend}
chartType="Column"
dataSource={this.highestGrossingMovies}
xAxisInterval="1"
yAxisTitle="Billions of U.S. Dollars"
yAxisTitleLeftMargin="10"
yAxisTitleRightMargin="5"
yAxisLabelLeftMargin="0"
isHorizontalZoomEnabled="false"
isVerticalZoomEnabled="false"
highlightingMode="Brighten"
legendHighlightingMode="MatchSeries"
isTransitionInEnabled="false">
</IgrCategoryChart>
</div>
</div>
);
}
private _highestGrossingMovies: HighestGrossingMovies = null;
public get highestGrossingMovies(): HighestGrossingMovies {
if (this._highestGrossingMovies == null)
{
this._highestGrossingMovies = new HighestGrossingMovies();
}
return this._highestGrossingMovies;
}
}
// rendering above component in the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Sample/>);
tsx/* shared styles are loaded from: */
/* https://static.infragistics.com/xplatform/css/samples */
css
Highlight Layers
Ignite UI for React IgrCategoryChart
데이터 항목 위에 마우스를 올리면 세 가지 유형의 강조 표시를 활성화할 수 있습니다.
계열 강조 표시는 포인터가 마커나 열 위에 있을 때 표시되는 단일 데이터 포인트를 강조 표시합니다. 이는
isSeriesHighlightingEnabled
속성을 true로 설정하여 활성화됩니다.항목 강조 표시는 해당 위치에 줄무늬 모양을 그리거나 해당 위치에 마커를 렌더링하여 시리즈의 항목을 강조 표시합니다. 이는
isItemHighlightingEnabled
속성을 true로 설정하여 활성화됩니다.범주 강조 표시는 차트의 모든 범주 축을 대상으로 합니다. 포인터 위치에 가장 가까운 축 영역을 비추는 모양을 그립니다. 이는
isCategoryHighlightingEnabled
속성을 true로 설정하여 활성화됩니다.
다음 예제는 React 차트에서 사용할 수 있는 다양한 강조 표시 레이어를 보여줍니다.
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrCategoryChartModule } from "@infragistics/igniteui-react-charts";
import { IgrLegendModule } from "@infragistics/igniteui-react-charts";
import { IgrCategoryChart } from "@infragistics/igniteui-react-charts";
import { IgrLegend } from "@infragistics/igniteui-react-charts";
const mods: any[] = [
IgrLegendModule,
IgrCategoryChartModule
];
mods.forEach((m) => m.register());
export default class CategoryChartColumnChartWithHighlighting extends React.Component<any, any> {
public data: any[];
private chart: IgrCategoryChart
private chartRef(r: IgrCategoryChart) {
this.chart = r;
this.setState({});
}
private legend: IgrLegend
private legendRef(r: IgrLegend) {
this.legend = r;
this.setState({});
}
constructor(props: any) {
super(props);
this.chartRef = this.chartRef.bind(this);
this.legendRef = this.legendRef.bind(this);
this.onHighlightTargetChanged = this.onHighlightTargetChanged.bind(this);
this.onHighlightingModeChanged = this.onHighlightingModeChanged.bind(this);
this.onBehaviorModeChanged = this.onBehaviorModeChanged.bind(this);
this.onLegendHighlightingModeChanged = this.onLegendHighlightingModeChanged.bind(this);
this.state = {
isCategoryHighlighting: false,
isItemHighlighting: false,
isSeriesHighlighting: true,
highlightingMode: "Auto",
highlightingBehavior: "Auto",
legendHighlightingMode: "Auto"
}
this.initData();
}
public render(): JSX.Element {
return (
<div className="container sample" >
<div className="options horizontal">
<span className="options-label">Highlight Target: </span>
<select id="highlightingTarget" onChange={this.onHighlightTargetChanged}>
<option>Series</option>
<option>Item</option>
<option>Category</option>
<option>None</option>
</select>
<span className="options-label">Mode: </span>
<select id="highlightingMode" onChange={this.onHighlightingModeChanged}>
<option>Auto</option>
<option>Brighten</option>
<option>BrightenSpecific</option>
<option>FadeOthers</option>
<option>FadeOthersSpecific</option>
<option>None</option>
</select>
<span className="options-label">Behavior: </span>
<select id="behaviorMode" onChange={this.onBehaviorModeChanged}>
<option>Auto</option>
<option>DirectlyOver</option>
<option>NearestItems</option>
<option>NearestItemsAndSeries</option>
<option>NearestItemsRetainMainShapes</option>
</select>
<span className="options-label">Legend: </span>
<select id="legendHighlightingMode" onChange={this.onLegendHighlightingModeChanged}>
<option>Auto</option>
<option>MatchSeries</option>
<option>None</option>
</select>
</div>
<span className="legend-title">
Average Temperatures in the U.S. Cities
</span>
<div className="legend">
<IgrLegend
orientation="Horizontal"
ref={this.legendRef}>
</IgrLegend>
</div>
<div className="container fill" >
<IgrCategoryChart
ref={this.chartRef}
dataSource={this.data}
legend={this.legend}
isCategoryHighlightingEnabled={this.state.isCategoryHighlighting}
isItemHighlightingEnabled={this.state.isItemHighlighting}
isSeriesHighlightingEnabled={this.state.isSeriesHighlighting}
highlightingMode={this.state.highlightingMode}
highlightingBehavior={this.state.highlightingBehavior}
legendHighlightingMode={this.state.legendHighlightingMode}
yAxisTitle="Temperatures in Celsius"
yAxisMinimumValue={0}
xAxisInterval={1}>
</IgrCategoryChart>
</div>
</div>
);
}
public onHighlightTargetChanged(e: any) {
let value = e.target.value as string;
if(value == "Series") {
this.setState({
isItemHighlighting: false,
isSeriesHighlighting: true,
isCategoryHighlighting: false,
});
}
else if(value == "Item") {
this.setState( {
isItemHighlighting: true,
isSeriesHighlighting: false,
isCategoryHighlighting: false,
});
}
else if(value == "Category") {
this.setState({
isItemHighlighting: false,
isSeriesHighlighting: false,
isCategoryHighlighting: true,
});
}
else if(value=="None") {
this.setState({
isItemHighlighting: false,
isSeriesHighlighting: false,
isCategoryHighlighting: false,
});
}
}
public onHighlightingModeChanged(e: any) {
const val = e.target.value;
this.setState({ highlightingMode: val});
}
public onBehaviorModeChanged(e: any) {
const val = e.target.value;
this.setState({ highlightingBehavior: val});
}
public onLegendHighlightingModeChanged(e: any) {
const val = e.target.value;
this.setState({ legendHighlightingMode: val});
}
public initData() {
const CityTemperatureData: any = [
{ Month: "January", NY: 10.6, LA: 28.3},
{ Month: "February", NY: 7.8, LA: 31.1},
{ Month: "March", NY: 12.2, LA: 27.8},
{ Month: "April", NY: 11.7, LA: 33.9},
{ Month: "May", NY: 19.4, LA: 35.0},
{ Month: "June", NY: 23.3, LA: 36.7},
{ Month: "July", NY: 27.2, LA: 33.3},
{ Month: "August", NY: 25.6, LA: 36.7},
{ Month: "September", NY: 22.8, LA: 43.9},
{ Month: "October", NY: 17.8, LA: 38.3 },
{ Month: "November", NY: 17.8, LA: 32.8},
{ Month: "December", NY: 8.3, LA: 28.9},
];
this.data = [ CityTemperatureData];
}
}
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<CategoryChartColumnChartWithHighlighting/>);
tsx
Additional Resources
다음 항목에서 관련 차트 기능에 대한 자세한 내용을 확인할 수 있습니다.
API References
다음은 위 섹션에서 언급된 API 멤버 목록입니다.