This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontainer.tsx
More file actions
106 lines (105 loc) · 6.16 KB
/
container.tsx
File metadata and controls
106 lines (105 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Sample for containers
*/
import * as React from "react";
import * as ReactDOM from "react-dom";
import { LinearGaugeComponent, ILoadedEventArgs, LinearGaugeTheme, Orientation, ContainerType, AxesDirective, AxisDirective, PointersDirective, PointerDirective, RangesDirective, RangeDirective } from '@syncfusion/ej2-react-lineargauge';
import { PropertyPane } from '../common/property-pane';
import { SampleBase } from '../common/sample-base';
import { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns';
export class Container extends SampleBase<{}, {}> {
private gaugeInstance: LinearGaugeComponent;
private orientationElement: DropDownListComponent;
private containerElement: DropDownListComponent;
private orienatationChange(): void {
this.gaugeInstance.orientation = this.orientationElement.value as Orientation;
this.gaugeInstance.refresh();
}
private containerChange(): void {
this.gaugeInstance.container.type = this.containerElement.value as ContainerType;
this.gaugeInstance.refresh();
}
public load(args: ILoadedEventArgs): void {
let selectedTheme: string = location.hash.split('/')[1];
selectedTheme = selectedTheme ? selectedTheme : 'Material';
args.gauge.theme = (selectedTheme.charAt(0).toUpperCase() + selectedTheme.slice(1)) as LinearGaugeTheme;
}
private droplist: { [key: string]: Object }[] = [
{ value: 'Vertical' },
{ value: 'Horizontal' }
];
private modelist: { [key: string]: Object }[] = [
{ value: 'Normal' },
{ value: 'RoundedRectangle' },
{ value: 'Thermometer' }
];
render() {
return (
<div className='control-pane'>
<div className='control-section row'>
<div className='col-lg-8'>
<LinearGaugeComponent load={this.load.bind(this)} id='gauge' ref={gauge => this.gaugeInstance = gauge} title='Temperature Measure' container={{ width: 13, type: 'Thermometer', roundedCornerRadius: 5 }}>
<AxesDirective>
<AxisDirective minimum={0} maximum={180} line={{ width: 0 }} minorTicks={{ color: '#9e9e9e' }} majorTicks={{ interval: 20, color: '#9e9e9e' }}>
<PointersDirective>
<PointerDirective value={90} height={13} width={13} type='Bar' roundedCornerRadius={5} color='#f02828'>
</PointerDirective>
</PointersDirective>
</AxisDirective>
<AxisDirective minimum={0} maximum={180} opposedPosition={true} line={{ width: 0 }} majorTicks={{ interval: 20 }}>
<PointersDirective>
<PointerDirective width={0}>
</PointerDirective>
</PointersDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent>
</div>
<div className='col-lg-4 property-section'>
<PropertyPane title='Properties'>
<table id='property' title='Properties' className='property-panel-table' style={{ width: '100%' }}>
<tr style={{ height: '50px' }}>
<td>
<div>Orientation</div>
</td>
<td>
<div>
<DropDownListComponent width={120} id="orientationMode" style={{ "width": "90%" }} change={this.orienatationChange.bind(this)} className="form-control" ref={d => this.orientationElement = d} dataSource={this.droplist} fields={{text: 'value', value: 'value'}} value="Vertical"/>
</div>
</td>
</tr>
<tr style={{ height: '50px' }}>
<td>
<div>Container Type</div>
</td>
<td>
<div style={{ paddingBottom: '20px', width: '90%' }}>
<DropDownListComponent width={120} id="containerMode" style={{ "width": "90%" }} change={this.containerChange.bind(this)} className="form-control" ref={d => this.containerElement = d} dataSource={this.modelist} fields={{text: 'value', value: 'value'}} value="Normal"/>
</div>
</td>
</tr>
</table>
</PropertyPane>
</div>
</div>
<div id="action-description">
<p>
This sample demonstrates the type of containers used in linear gauge. Orientation and container type of linear gauge can be changed by using <code>Orientation</code> and <code>Container Type</code> options.
</p>
</div>
<div id="description">
<p>
In this example, you can see how to render and configure the ranges in linear gauge. You can use <code>start</code>,
<code>end</code>, <code>startWidth</code>,
<code>endWidth</code> and <code>position</code> properties to customize the ranges. You can also specify various
colors for the ranges in the axis. If you enable the <code>useRangeColor</code> property, then the axis labels will
be displayed based on its range color.
</p>
<p>
More information about linear gauge can be found in this <a target="_blank" href="http://ej2.syncfusion.com/documentation">documentation section</a>.
</p>
</div>
</div>
)
}
}