Skip to content

Commit a2af5b8

Browse files
azure-pipelines[bot]tfsbuildHUSSAR-mtrela
authored
Adding changes from build igniteui-xplat-examples-output+PRs_2024.6.19.2 (#586)
Co-authored-by: tfsbuild <tfsbuild@infragistics.com> Co-authored-by: HUSSAR-mtrela (Martin Trela) <HUSSAR-mtrela@users.noreply.github.com>
1 parent 91631c6 commit a2af5b8

3 files changed

Lines changed: 39 additions & 26 deletions

File tree

samples/charts/tree-map/highlighting/sandbox.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"infiniteLoopProtection": false,
33
"hardReloadOnChange": false,
44
"view": "browser"
5-
}
5+
}

samples/charts/tree-map/highlighting/src/CountyHierarchicalData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export class CountyHierarchicalDataItem {
22
public constructor(init: Partial<CountyHierarchicalDataItem>) {
33
Object.assign(this, init);
44
}
5-
5+
66
public code: string;
77
public parent: string;
88
public name: string;

samples/charts/tree-map/highlighting/src/index.tsx

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44

55
import { IgrPropertyEditorPanelModule } from 'igniteui-react-layouts';
6-
import { IgrTreemapModule, TreemapHighlightingMode } from 'igniteui-react-charts';
6+
import { IgrTreemapModule } from 'igniteui-react-charts';
77
import { IgrPropertyEditorPanel, IgrPropertyEditorPropertyDescription } from 'igniteui-react-layouts';
88
import { IgrTreemap } from 'igniteui-react-charts';
99
import { ComponentRenderer, PropertyEditorPanelDescriptionModule, TreemapDescriptionModule } from 'igniteui-react-core';
@@ -18,36 +18,50 @@ const mods: any[] = [
1818
mods.forEach((m) => m.register());
1919

2020
export default class Sample extends React.Component<any, any> {
21-
21+
private propertyEditor: IgrPropertyEditorPanel
22+
private propertyEditorRef(r: IgrPropertyEditorPanel) {
23+
this.propertyEditor = r;
24+
this.setState({});
25+
}
2226
private highlightedModeEditor: IgrPropertyEditorPropertyDescription
2327
private treemap: IgrTreemap
2428
private treemapRef(r: IgrTreemap) {
2529
this.treemap = r;
2630
this.setState({});
27-
this.onHighlightingModeChange = this.onHighlightingModeChange.bind(this);
2831
}
2932

3033
constructor(props: any) {
3134
super(props);
32-
35+
36+
this.propertyEditorRef = this.propertyEditorRef.bind(this);
3337
this.treemapRef = this.treemapRef.bind(this);
3438
}
3539

3640
public render(): JSX.Element {
3741
return (
3842
<div className="container sample">
39-
<div className="options horizontal">
40-
<select onChange={this.onHighlightingModeChange}>
41-
<option>Brighten</option>
42-
<option>FadeOthers</option>
43-
</select>
43+
<div className="options vertical">
44+
<IgrPropertyEditorPanel
45+
ref={this.propertyEditorRef}
46+
componentRenderer={this.renderer}
47+
target={this.treemap}
48+
descriptionType="Treemap"
49+
isHorizontal="true"
50+
isWrappingEnabled="true">
51+
<IgrPropertyEditorPropertyDescription
52+
propertyPath="HighlightingMode"
53+
name="HighlightedModeEditor"
54+
label="Highlighting Mode: "
55+
primitiveValue="Brighten"
56+
dropDownValues={["Brighten", "FadeOthers"]}>
57+
</IgrPropertyEditorPropertyDescription>
58+
</IgrPropertyEditorPanel>
4459
</div>
4560

4661
<div className="legend-title">
4762
Comparing Population of Countries
4863
</div>
4964

50-
5165
<div className="container fill">
5266
<IgrTreemap
5367
ref={this.treemapRef}
@@ -68,25 +82,13 @@ export default class Sample extends React.Component<any, any> {
6882
parentNodeRightPadding="0"
6983
parentNodeTopPadding="0"
7084
outline="black"
71-
strokeThickness="1"
72-
highlightingMode={TreemapHighlightingMode.Brighten}>
85+
strokeThickness="1">
7386
</IgrTreemap>
7487
</div>
7588
</div>
7689
);
7790
}
7891

79-
public onHighlightingModeChange(args: any){
80-
let value = args.target.value as string;
81-
82-
if(value === "Brighten"){
83-
this.treemap.highlightingMode = TreemapHighlightingMode.Brighten;
84-
}
85-
else{
86-
this.treemap.highlightingMode = TreemapHighlightingMode.FadeOthers;
87-
}
88-
}
89-
9092
private _countyHierarchicalData: CountyHierarchicalData = null;
9193
public get countyHierarchicalData(): CountyHierarchicalData {
9294
if (this._countyHierarchicalData == null)
@@ -95,8 +97,19 @@ export default class Sample extends React.Component<any, any> {
9597
}
9698
return this._countyHierarchicalData;
9799
}
98-
}
99100

101+
private _componentRenderer: ComponentRenderer = null;
102+
public get renderer(): ComponentRenderer {
103+
if (this._componentRenderer == null) {
104+
this._componentRenderer = new ComponentRenderer();
105+
var context = this._componentRenderer.context;
106+
PropertyEditorPanelDescriptionModule.register(context);
107+
TreemapDescriptionModule.register(context);
108+
}
109+
return this._componentRenderer;
110+
}
111+
112+
}
100113

101114
// rendering above component in the React DOM
102115
const root = ReactDOM.createRoot(document.getElementById('root'));

0 commit comments

Comments
 (0)