도형 렌더러
Shape 셀 렌더러는 그리드에 포함되어 있는 몇 개의 shape 아이콘 중 하나를 텍스트와 같이 표시합니다.
pivot, grid, 피벗, 필터, filter
pivot, export
pivot, style, callback, styleCallback
pivot, value, getCellValue
pivot, pivotFields, getPivotFields
shapeCellRenderer에 도형을 설정 해보겠습니다.
도형을 표시하기 위해서는 renderer의 type은 shape로 설정합니다.
1
2
3
renderer: {
type: "shape"
}
다음으로 도형컬럼에 도형과 style을 설정합니다.
figureName 속성으로 지정합니다.figureSize 설정으로 크기를 자유롭게 지정할 수 있습니다.figureBackground로 색상 또한 다양하게 설정할 수 있습니다.1
2
3
4
5
6
7
styles: {
figureBackground: "#ff008800",
figureName: "minus",
iconLocation: "right",
figureSize: "50%",
paddingRight: 6
}
OrderID 컬럼에 원 도형을 표시합니다.
1
2
3
4
5
6
7
8
gridView.setColumnProperty("OrderID", "renderer", {type:"shape"});
gridView.setColumnProperty("OrderID", "styles", {
figureBackground: "#ff008800",
figureName: "ellipse",
iconLocation: "right",
paddingRight: 6
});
버튼 클릭시 CustomerID 컬럼에 값에 따른 동적으로 도형을 표시합니다.
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
gridView.setColumnProperty("CustomerID", "renderer", {type:"shape"});
gridView.setColumnProperty("CustomerID", "dynamicStyles", [{
criteria: "(value = 'WARTH') or (value = 'HILAA')",
styles: {
figureBackground: "#ff0000ff",
figureName: "diamond"
}
}, {
criteria: "value = 'VINET'",
styles: "figureBackground=#ffffcc00;figureName=plus"
}, {
criteria: "value = 'TOMSP'",
styles: "figureBackground=#ffcccc00;figureName=ellipse"
}, {
criteria: "value = 'HANAR'",
styles: {
figureBackground: "#ff008800",
figureName: "minus",
iconLocation: "right",
paddingRight: 6
}
}, {
criteria: "value = 'HUNGO'",
styles: "figureBackground=#ff2ffc2f;figureBorder=#ffaaaaaa;figureName=equal"
}, {
criteria: "value = 'SUPRD'",
styles: "figureBackground=#ffff44f5;figureName=rectangle"
}]);
버튼 클릭시 UnitPrice 컬럼에 숫자 값에 따른 도형을 표시합니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
gridView.setColumnProperty("UnitPrice", "renderer", {type:"shape"});
gridView.setColumnProperty("UnitPrice", "dynamicStyles", [{
criteria: "value < 20",
styles: "figureBackground=#ff0000ff;foreground=#ff0000ff;figureName=itriangle"
}, {
criteria: "value < 10",
styles: "background=#110000ff;figureBackground=#ff0000ff;foreground=#ff0000ff;figureName=downarrow"
}, {
criteria: "value >= 20",
styles: "figureBackground=#ffff0000;foreground=#ffff0000;figureName=triangle"
}, {
criteria: "value > 80",
styles: "background=#11ff0000;figureBackground=#ffff0000;foreground=#ffff0000;figureName=uparrow"
}]);