Text and alignment of the Raphael
<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"%><% StringPath=Request.getcontextpath (); StringBasePath=Request.getscheme ()+ "://" +Request.getservername ()+ ":" +Request.getserverport ()+Path+ "/";%><!DOCTYPE HTML><HTML><Head><Basehref= "<%=basePath%>"><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Title</title><Scripttype= "Text/javascript"src= "Js/jquery-1.11.1.js"></Script><Scripttype= "Text/javascript"src= "Js/raphael.js"></Script><Scripttype= "Text/javascript"src= "Js/index006.js"></Script></Head><Body><DivID= "Container"></Div></Body></HTML>
$(function() {Initraphael ();});functionInitraphael (e) {//This will find the object based on the ID of container . varpaper = Raphael (' container ', 500, 500); varT = Paper.text (+, ' abc '). attr (' font-size ', 16); varRec = Paper.rect (200, 40, 100, 5). attr ({fill:' #ccf ', ' Stroke-width ': 0 }); varT2 = Paper.text (200,60, ' def ')). attr ({//horizontal left alignment;' Text-anchor ': ' Start ', ' Font-size ': 16, ' font-family ': ' Courier New ' }); //The vertical distance can be adjusted to view the generated SVG <text> object, which has a <tspan> object with the DY attribute, which controls the alignment of the vertical direction; varL = Paper.path (' m200,20h100m-100,0v100m200,60h100 '); //gets the attribute;Console.log (t2.attr (' Text-anchor ')));}
Text and alignment of the Raphael