1. Implement text drawing
| The code is as follows |
Copy Code |
[Js]
Ext.create (' Ext.draw.Component ', {
RenderTo:Ext.getBody (),
Viewbox:false,
Draggable: {
Constrain:true,//Allow drag
ConstrainTo:Ext.getBody ()
},
Floating:true,
Autosize:true,
Items: [{
Type: ' Text ',
Text: ' Graphical texts ',
Fill: ' Green ',
Font: ' 16px Arial ',
Rotate: {
Degrees:45
}
}]
}); |
Through the above code, we can show the picture text, the effect is as follows:
2. Basic graphics, path drawing
We first draw a circle, a rectangle through the basic graph, and finally draw a isosceles through the path syntax:
| The code is as follows |
Copy Code |
|
[Js]
var drawcomponent = ext.create (' Ext.draw.Component ', {
Viewbox:false,
Items: [{
Type: ' Circle ',//Garden
Fill: ' #79BB3F ',
RADIUS:100,
X:100,
y:100
}, {
Type: ' rect ',//Rectangle
WIDTH:50,
Height:30,
Fill: ' #f00 ',
x:0,
y:0
}, {
Type: "Path",
Path: "M100 0 L150 L200 0 Z",//Path
"Stroke-width": "1",
Stroke: "#000",
Fill: "Blue"
}]
});
Ext.create (' Ext.window ', {
width:230,
HEIGHT:250,
Layout: ' Fit ',
Items: [Drawcomponent]
). Show ();
|
The effect is as follows: