`

extjs4.1 几种绘图

 
阅读更多
draw.js


Ext.onReady(function() {

/**
* 1.圆形
*/
var drawComponent = Ext.create('Ext.draw.Component', {
viewBox : false,
items : [Ext.create('Ext.draw.Sprite', {
type : 'circle',
fill : '#005EAC',
radius : 100,
x : 110,
y : 110
})]
});
Ext.create('Ext.Window', {


width : 240,
height : 250,
layout : 'fit',
items : [drawComponent]
}).show();


/**
* 2.矩形
*/
var drawComponent2 = Ext.create('Ext.draw.Component', {
viewBox : false,
items : [{
type : 'rect',// 图表形状
fill : '#4D95DA',// 填充颜色
width : 350,
height : 200,
x : 20,
y : 20
}]


});
Ext.create('Ext.Window', {


width : 240,
height : 250,
layout : 'fit',
items : [drawComponent2]
}).show();


/**
* 3.文本
*/
var drawComponent3 = Ext.create('Ext.draw.Component', {
viewBox : false,
items : [{
type : 'text',// 图表形状
text : 'hello,world',
fill : '#4D95DA',// 填充颜色
font : '20px "Lucida Grande", "Lucida Sans Unicode", Verdana,Arial, Helvetica, sans-serif',
x : 40,
y : 40
}]


});
Ext.create('Ext.Window', {


width : 240,
height : 250,
layout : 'fit',
items : [drawComponent3]
}).show();
/**
* path
*/
var drawComponent4 = Ext.create('Ext.draw.Component', {
viewBox : true,
items : [{
type : 'path',
path : ['M153 334', 'C153 334 151 334 151 334',
'C151 339 153 344 156 344',
'C164 344 171 339 171 334',
'C171 322 164 314 156 314',
'C142 314 131 322 131 334',
'C131 350 142 364 156 364',
'C175 364 191 350 191 334',
'C191 311 175 294 156 294',
'C131 294 111 311 111 334',
'C111 361 131 384 156 384',
'C186 384 211 361 211 334',
'C211 300 186 274 156 274'],
fill : 'white',
stroke : 'red',
"stroke-width" : "2"
}]
});
Ext.create('Ext.Window', {


width : 240,
height : 250,
layout : 'fit',
items : [drawComponent4]
}).show();
});
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics