javascript smipleChart 简单图标类_javascript技巧

胖芳小哥_8239

胖芳小哥_8239

2016-05-16

1083人浏览

原创

因为编辑器会对代码有所破坏,所以提供一个在线演示
http://demo.jb51.net/chengxu/smiplechart.htm

复制代码 代码如下:





smipleChart

















<script type="text/javascript"> <BR>(function(doc,undefined){ <BR>var win = this, <BR>hasSVG = win.SVGAngle || doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"), <BR>isIE = /msie/i.test(navigator.userAgent) && !win.opera, <BR>path = hasSVG?'d':'path', <BR>seal = hasSVG?'z':'e', <BR>math = Math, <BR>mathRound = math.round, <BR>mathFloor = math.floor, <BR>mathCeil = math.ceil, <BR>mathMax = math.max, <BR>mathMin = math.min, <BR>mathAbs = math.abs, <BR>mathCos = math.cos, <BR>mathSin = math.sin, <BR>M = 'M', <BR>L = 'L'; <br><br>win.$ = function(Id){ <BR>return document.getElementById(Id); <BR>}; <br><br>win.extend = function(){ <BR>var target = arguments[0] || {}, i = 1, length = arguments.length, deep = true, options; <BR>if ( typeof target === "boolean" ) { <BR>deep = target; <BR>target = arguments[1] || {}; <BR>i = 2; <BR>} <BR>if ( typeof target !== "object" && Object.prototype.toString.call(target)!="[object Function]") <BR>target = {}; <BR>for(;i<length;i++){ <BR>if ( (options = arguments[ i ]) != null ) <BR>for(var name in options){ <BR>var src = target[ name ], copy = options[ name ]; <BR>if ( target === copy ) <BR>continue; <BR>if ( deep && copy && typeof copy === "object" && !copy.nodeType ){ <BR>target[ name ] = arguments.callee( deep, src || ( copy.length != null ? [ ] : { } ), copy ); <BR>} <BR>else if(copy !== undefined) <BR>target[ name ] = copy; <BR>} <br><br>} <BR>return target; <BR>}; <br><br>win.each = function ( object, callback, args ) { <BR>var name, i = 0, length = object.length; <BR>if ( args ) { <BR>args = Array.prototype.slice.call(arguments).slice(2); <BR>if ( length === undefined ) { <BR>for ( name in object ) <BR>if ( callback.apply( object[ name ],[name,object[ name ]].concat(args) ) === false ) <BR>break; <BR>} else <BR>for ( ; i < length; i++) <BR>if ( callback.apply( object[ i ],[i,object[ i ]].concat(args)) === false ) // <BR>break; <BR>} else { <BR>if ( length === undefined ) { <BR>for ( name in object ) <BR>if ( callback.call( object[ name ], name, object[ name ] ) === false ) <BR>break; <BR>} else <BR>for ( var value = object[0]; <BR>i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} <BR>} <BR>return object; <BR>}; <BR>//--------------------------------------------------------------- <BR>function processPoint( x ){ <BR>return isIE ? ~~x.toFixed(0) : ~~x.toFixed(0) + 0.5; <BR>}; <BR>function calTextLen(txt, cssStr){ <BR>var span = doc.createElement('span'); <BR>if(cssStr){ <BR>typeof cssStr === 'string' <BR>? span.style.cssText = cssStr <BR>: extend(span.style,cssStr); <BR>}else{ <BR>extend(span.style,{ <BR>fontSiz : '12px', <BR>fontFamily : '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif' <BR>}); <BR>} <BR>span.innerHTML = txt || ''; <BR>span.style.visibility = 'hidden'; <BR>doc.body.appendChild(span); <BR>var width = span.offsetWidth, <BR>height = span.offsetHeight; <BR>doc.body.removeChild(span); <BR>return {w:width,h:height}; <BR>}; <BR>function angle(r,center,o,jingdu){ <BR>var hudu = Math.PI*2*(o/360), <BR>x = center[0]+ r*Math.sin(hudu), <BR>y = center[1]+ -r*Math.cos(hudu); <BR>return [x.toFixed(jingdu||0),y.toFixed(jingdu||0)]; <BR>} <br><br>function xx(a,b,lineNum){ <br><br>var t = 10000; <BR>var stf = ((b*t-a*t)/lineNum)/t, <BR>arr = [1,2,2.5,5,10], <BR>c = 1, <BR>v; <br><br>// &#20998;&#21106;&#32447;&#30340;&#22522;&#25968;&#26159; [1,2,2.5,5,10] &#36825;&#20010;&#27493;&#39588;&#26159;&#26597;&#25214; &#38388;&#38548; &#23646;&#20110;&#21738;&#20010;&#33539;&#22260; <BR>if(stf<arr[0]){ <BR>while( stf<arr[0] ){ <BR>c = c*10; <BR>arr[0]=arr[0]/c; <BR>} <BR>each([1,2,2.5,5,10],function(i,o){ <BR>arr[i]= o/c; <BR>}); <BR>}else if(stf>arr[4]){ <BR>while( stf>arr[4] ){ <BR>c = c*10; <BR>arr[4] = arr[4]*c; <BR>} <BR>each([1,2,2.5,5,10],function(i,o){ <BR>arr[i]= o*c; <BR>}); <BR>} <br><br>//&#19978;&#38754;&#25214;&#21040;&#38388;&#38548;&#21518; &#25214;&#21040;&#38388;&#38548;&#20013;&#26368;&#25509;&#36817;&#30340;&#19968;&#20010; <BR>each(arr,function(i,o){ <BR>if(stf<o){ <BR>v = o; <BR>return false; <BR>} <BR>}); <BR>//a &#26159;&#26368;&#23567;&#30340; <BR>//b&#26159;&#26368;&#22823; &#30340; <BR>a = (a*t-mathAbs((a%v)*t))/t; <BR>b = (b*t+(b%v===0?0:(v-b%v))*t)/t; <br><br>//&#30475;&#30475;&#36824;&#21097;&#20960;&#26465;&#32447;&#27809;&#26377;&#30011; <br><br>var num = Math.max(0,lineNum - Math.round((b-a)/v)); <br><br>if(a>=0){ <BR>//&#35753;&#22270;&#27604;&#36739;&#38752;&#20013;&#38388; <BR>/*while(num!==0){ <BR>num%2===0 <BR>? a = (a*t-v*t)/t <BR>: b = (b*t+v*t)/t; <BR>num--; <BR>}*/ <br><br>//&#22352;&#26631;&#27604;&#36739;&#25972;&#25968;&#21270; <BR>if(a!=0&&num!=0){ <BR>while(a!=0&&num!=0){ <BR>a = (a*t-v*t)/t; <BR>num--; <BR>if((a*t-v*num*t)/10000>0&&a%10===0) <BR>break; <BR>} <BR>} <br><br>if(num!=0){ <BR>while(num!==0){ <BR>b = (b*t+v*t)/t <BR>num--; <BR>} <BR>} <br><br>}else{ <BR>//&#35753;&#22270;&#27604;&#36739;&#38752;&#20013;&#38388; <BR>/*while(num!==0){ <BR>num%2===0 <BR>? b = (b*t+v*t)/t <BR>: a = (a*t-v*t)/t <BR>num--; <BR>}*/ <BR>//&#22352;&#26631;&#27604;&#36739;&#25972;&#25968;&#21270; <BR>if(b<0&&num!=0){ <BR>while(b!=0&&num!=0){ <BR>b = (b*t+v*t)/t; <BR>num--; <BR>if((b*t+v*num*t)/t<0&&a%10===0) <BR>break; <BR>} <BR>} <BR>if(num!=0){ <BR>while(num!==0){ <BR>a = (a*t-v*t)/t <BR>num--; <BR>} <BR>} <br><br>} <BR>return {min:a,max:b,stf:v}; <BR>} <BR>//--------------------------------------------------------------------------------------------------------------- <BR>//&#23545;svg vml&#20803;&#32032;&#30340;&#19968;&#20123;&#21019;&#24314; &#20462;&#25913;&#23646;&#24615; &#26679;&#24335; &#21024;&#38500; == &#19968;&#20123;&#30340;&#25805;&#20316; <BR>win.vector = function(){}; <BR>win.vector.prototype = { <BR>$c : function(graphic,nodeName){ <BR>this.element = this[0] = doc.createElementNS('http://www.w3.org/2000/svg', nodeName); <BR>this.graphic = graphic; <BR>return this; <BR>}, <BR>attr: function(hash,val){ <BR>var elem = this.element, <BR>key, <BR>value; <BR>if(typeof hash === 'string'){ <BR>if(val === undefined){ <BR>return elem.getAttribute(hash); <BR>}else{ <BR>elem.setAttribute(hash, val); <BR>return this; <BR>} <BR>} else { <BR>for(key in hash){ <BR>value = hash[key]; <BR>if(key === path){ <BR>value && value.join <BR>&&(value = value.join(' ')); <br><br>/(NaN| |^$)/.test(value) <BR>&&(value = 'M 0 0'); <BR>} <BR>elem.setAttribute(key, value) <BR>} <BR>} <BR>return this; <BR>}, <BR>css: function(hash){ <BR>var str = ''; <BR>for(var key in hash){ <BR>if(isIE && key == "opacity"){ <BR>this.element.style['filter'] = "alpha(opacity="+ hash[key] * 100+")"; <BR>}else{ <BR>this.element.style[key] = hash[key]; <BR>} <BR>} <BR>return this; <BR>}, <BR>on: function(eventName, handler){ <BR>var self = this; <BR>this.element.addEventListener(eventName,function(){ <BR>handler.call(self) <BR>},false); <BR>return this; <BR>}, <BR>appendTo: function(parent){ <BR>if(parent){ <BR>parent.element <BR>? parent.element.appendChild(this.element) <BR>: parent.appendChild(this.element) <br><br>} else { <BR>this.graphic.container.appendChild(this.element); <BR>} <BR>return this; <BR>}, <BR>addText: function(str){ <BR>var elem = this.element; <BR>if(elem.nodeName === 'text'){ <BR>elem.appendChild(doc.createTextNode(str.toString() || ' ')); <BR>} <BR>return this; <BR>}, <BR>setOpacity : function(v){ <BR>this.attr('fill-opacity',v) <BR>}, <BR>toFront: function() { <BR>this.element.parentNode.appendChild(this.element) <BR>return this; <BR>}, <BR>show: function(){ <BR>this.element.style.display = 'block'; <BR>return this; <BR>}, <BR>hide: function(){ <BR>this.element.style.display = 'none'; <BR>return this; <BR>} <BR>}; <BR>//--------------------------------------------------------------------------------------------------------------- <br><br><br><br>//--------------------------------------------------------------------------------------------------- <BR>//&#22914;&#26524;&#26159;vml&#20462;&#25913;&#20854;&#20013;&#30340;&#19968;&#20123;&#26041;&#27861; <BR>if(!hasSVG){ <BR>//-------------&#21019;&#24314;vml&#29615;&#22659;----------------- <BR>doc.createStyleSheet().addRule(".vml", "behavior:url(#default#VML);display:inline-block;position:absolute;left:0px;top:0px"); <BR>!doc.namespaces.vml && !+"\v1"; <BR>doc.namespaces.add("vml", "urn:schemas-microsoft-com:vml"); <br><br>//-------------&#20462;&#25913;&#19968;&#20123;&#26041;&#27861;----------------- <BR>extend(vector.prototype,{ <BR>$c : function(graphic,nodeName){ <BR>var name = nodeName || 'shape'; <BR>this.element= this[0] = (name === 'div' || name === 'span') <BR>? doc.createElement(name) <BR>: doc.createElement('<vml:'+name+' class="vml">'); <BR>this.graphic = graphic; <BR>return this; <BR>}, <BR>on : function(eventName, handler){ <BR>var self = this; <BR>this.element.attachEvent("on" + eventName,function(){ <BR>handler.call(self); <BR>}); <BR>return this; <BR>}, <BR>addText : function(txt){ <BR>var elem = this.element; <BR>elem.innerHTML = txt || ''; <BR>return this; <BR>}, <BR>setOpacity : function(v){ <BR>this.opacity.opacity=v; <BR>} <BR>}); <BR>} <BR>//--------------------------------------------------------------------------------------------------- <br><br><br><br><br><br><br><br>//&#30011;&#22270;&#31867; <BR>//------------------------------------------------------------ <BR>win.smipleChart = function(){ <BR>this.init.apply(this,arguments); <BR>}; <BR>smipleChart.prototype = { <BR>options : { <BR>charts : { <BR>paddingRight : 20, <BR>radius : 200, <BR>style : { <BR>fontFamily : '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif', <BR>fontSize : '12px', <BR>background : '#FFFFFF' <BR>} <BR>}, <BR>title : { <BR>text : '', <BR>y : 10, <BR>style : { <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'16px', <BR>fontWeight:'bold' <BR>} <BR>}, <BR>subTitle : { <BR>text : '', <BR>y : 30, <BR>style : { <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px', <BR>color: '#111' <BR>} <BR>}, <BR>yUnit : { <BR>text : '', <BR>style : { <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px', <BR>color: '#111' <BR>}, <BR>lineNum :10 <BR>} <BR>}, <BR>init : function(container,options,width,height){ <BR>this.width = width || container.offsetWidth; <BR>this.height = height || container.offsetHeight; <BR>this.mainGroup = {}; <br><br>//svg &#37324;&#38754;&#30011;&#22270; &#24517;&#39035;&#26377;&#19968;&#20010;svg&#26631;&#31614; vml&#23601;&#29992;div&#20102; <BR>this.container = hasSVG <BR>? new vector().$c(1,'svg') <BR>.attr({ <BR>xmlns : 'http://www.w3.org/2000/svg', <BR>version : '1.1' <BR>}) <BR>.css({fontSize : '12px'}) <BR>.appendTo(container).element <BR>: new vector().$c(1,'div') <BR>.css({ <BR>fontSize : '12px', <BR>width : this.width +'px', <BR>height : this.height+'px' <BR>}) <BR>.appendTo(container).element; <BR>var c = extend(true,{},this.options) <BR>var opts = this.opts = extend(true,c,options), <BR>style = extend(opts.charts.style,{ <BR>width : this.width, <BR>height : this.height <BR>}); <br><br><br><br>//&#35745;&#31639;&#32472;&#30011;&#30424;&#23376;&#30340;&#26102;&#20505;&#38656;&#35201;&#30340;&#19968;&#20123;&#21442;&#25968; <BR>this.getDrawArea() <BR>.createTooltip() //&#21019;&#24314;&#25552;&#31034;&#20449;&#24687;&#30340;&#26694;&#26694; <BR>.drawTitle() //&#30011;&#26631;&#39064; <BR>//&#30011;&#30424;&#23376; <br><br>if('line,area,pie'.indexOf(opts.charts.type)>=0){ <BR>opts.charts.panel = 'x'; <BR>} <br><br>if(' pie,pies'.indexOf(opts.charts.type)<0){ <BR>this.drawPanel(); <BR>} <br><br>this.drawLegend(opts.legend.type); //&#30011;&#33394;&#22359;&#26465; <br><br>var type = { <BR>line : 'drawLine', <BR>area : 'drawArea', <BR>columns : 'drawColumns', <BR>pie : 'drawPie', <BR>pies : 'drawPies', <BR>segment : 'drawSegment' <BR>}[opts.charts.type]; <BR>this[type](); <br><br>}, <BR>createElement : function(nodeName){ <BR>return new vector().$c(this,nodeName); <BR>}, <BR>group: function(name){ <BR>return this.createElement(isIE?'div':'g').attr('mark',name); <BR>}, <BR>getDrawArea : function(){ <BR>var opts = this.opts, <BR>width = this.width, <BR>height = this.height, <BR>title = opts.title, <BR>subTitle = opts.subTitle, <BR>area = { <BR>// &#21435;&#25481;&#22352;&#26631;&#36724;&#24038;&#36793;&#30340;&#21051;&#24230;&#25991;&#26412;&#23485;&#24230;(&#39044;&#20272;) 80&#20026;&#23450;&#20540; &#24038;&#36793;&#21482;&#30041;80&#30340;&#38388;&#36317; <BR>areaWidth : width - 80, <BR>// &#21435;&#25481;&#22352;&#26631;&#36724;&#24213;&#19979;&#30340;&#25991;&#26412;&#21644;&#26631;&#32447;&#30340;&#39640;&#24230; <BR>areaHeight : height - 40, <BR>//&#21407;&#28857;&#30340;X&#20301;&#32622; &#19979;&#38754;&#20250;&#35745;&#31639;&#21040; <BR>startX : 0, <BR>//&#21407;&#28857;&#30340;Y&#20301;&#32622; &#19979;&#38754;&#20250;&#35745;&#31639;&#21040; <BR>startY : 0, <BR>//&#20013;&#24515;&#30340;x&#22352;&#26631; &#30011;&#39292;&#22270;&#30340;&#26102;&#20505;&#38656;&#35201;&#30693;&#36947;&#22278;&#24515;&#30340;&#20301;&#32622; <BR>centerX: 0, <BR>//&#20013;&#24515;&#30340;y&#22352;&#26631; &#30011;&#39292;&#22270;&#30340;&#26102;&#20505;&#38656;&#35201;&#30693;&#36947;&#22278;&#24515;&#30340;&#20301;&#32622; <BR>centerY: 0 <BR>}; <br><br>//&#22914;&#26524;&#20027;&#26631;&#39064;&#23384;&#22312; &#20943;&#21435;&#20027;&#26631;&#39064;&#30340;&#39640;&#24230; &#21542;&#21017; &#20943;&#21435;10&#30340;&#39640; <BR>area.areaHeight -=(title.text !== '') <BR>? title.y <BR>: 10; <br><br>// &#21435;&#25481;&#21103;&#26631;&#39064;&#39640;&#24230; <BR>area.areaHeight -=(subTitle.text !== '') <BR>? subTitle.y <BR>: 10 <br><br>area.startX = 80; <BR>area.startY = height - 40; <br><br>//&#22278;&#24515;&#30340;&#20301;&#32622; <BR>area.centerX = width / 2; <BR>area.centerY = height / 2; <br><br>//&#21491;&#36793;&#30041;&#19968;&#20123;&#31354;&#38553; <BR>area.areaWidth -=20; <BR>//&#19978;&#36793;&#20063;&#30041;&#19968;&#20123;&#38388;&#36317; <BR>area.areaHeight -=15; <br><br>opts.area = area; <br><br>return this; <br><br>}, <BR>drawTitle : function(){ <BR>var opts = this.opts, <BR>self = this, <BR>arr = [opts.title,opts.subTitle,opts.yUnit], <BR>//3&#20010;&#26631;&#39064;&#22352;&#26631;&#30340;&#20301;&#32622;&#30340;&#22522;&#26412;&#21442;&#25968; <BR>config = [ <BR>{ <BR>x : this.width / 2, <BR>y : opts.title.y <BR>}, <BR>{ <BR>x : this.width / 2, <BR>y : opts.subTitle.y <BR>}, <BR>{ <BR>x : opts.yUnit.x, <BR>y : this.height / 2 - 20 <BR>} <BR>], <BR>tpanel = this.group('title') <BR>.appendTo(); <br><br>each(arr,function(i,title){ <BR>var text = title.text; <BR>if(text){ <BR>var elem = self.baseDraw('span',{ <BR>'text-anchor':'left', <BR>x : mathMax(config[i].x - calTextLen(text,title.style).w/2,10), <BR>y : config[i].y <BR>},calTextLen(title.text,title.style).h) <BR>.css(title.style) <BR>.addText(text) <BR>.appendTo(tpanel); <br><br>//&#22914;&#26524;&#20026;2&#30340;&#26102;&#20505; &#23601;&#35828;&#26126;&#26159;&#21103;&#26631;&#39064; &#23558;&#23427;&#31446;&#36807;&#26469; <BR>if(i===2){ <BR>hasSVG <BR>? elem.attr({transform : 'rotate(270, '+(opts.yUnit.x+10)+', ' + self.height / 2 + ')'}) <BR>: (elem.element.style.filter ='progid:DXImageTransform.Microsoft.BasicImage(rotation=3)') <BR>} <br><br>} <BR>}); <BR>return this; <BR>}, <br><br><BR>//&#30011;&#30424;&#23376; &#27604;&#36739;&#40635;&#28902; <BR>drawPanel : function(type){ <BR>var opts = this.opts, <BR>self = this, <BR>area = opts.area, <BR>isSegment= opts.charts.type==='segment', <BR>//&#30424;&#23376;&#30340;&#31867;&#22411; &#26159;&#27178;&#30424;&#23376; &#36824;&#26159;&#32437;&#30424;&#23376; <BR>type = opts.charts.panel || 'x'; <br><br>// &#24213;&#26495; <BR>var drawAreaWidth = area.areaWidth, <BR>drawAreaHeight = area.areaHeight, <BR>//&#21407;&#28857;&#30340;&#22352;&#26631; <BR>startX = area.startX, <BR>startY = area.startY; <br><br>var allData = [], <BR>minValue = 0, <BR>maxValue = 10, <BR>lineNum = mathMax(opts.yUnit.lineNum,2), <BR>min = opts.yUnit.min, <BR>staff; <br><br>//&#32452;&#21512;&#25152;&#26377;&#30340;&#25968;&#25454; <BR>each(opts.chartData,function(i,o){ <BR>isSegment <BR>? each(o.data,function(j,d){ <BR>allData[j] <BR>? allData[j] = allData[j] + (~~d) <BR>: allData[j] = ~~d; <BR>}) <BR>: allData = allData.concat(o.data) <BR>}); <br><br>//&#32473;&#25152;&#26377;&#30340;&#25968;&#25454;&#25490;&#24207; &#20026;&#20102;&#19979;&#38754;&#27714;&#26368;&#22823;&#20540; &#26368;&#23567;&#20540; <BR>allData.sort(function(a,b){return a-b}); <br><br>//&#27714;&#20986;&#26368;&#22823;&#20540; &#26368;&#23567;&#20540; <BR>maxValue = allData[allData.length - 1]; <br><br>each(allData,function(i,o){ <BR>if(o){ <BR>minValue = o; <BR>return false; <BR>} <BR>}); <br><br>//&#20027;&#30424;&#23376;&#23481;&#22120; <BR>this.panel = this.group('panel').appendTo(); <br><br><BR>var dd = xx(minValue,maxValue,lineNum), <BR>min = dd.min, <BR>max = dd.max, <BR>f = dd.stf; <br><br>//&#34920;&#31034;&#30011;&#30340;&#26159;&#27178;&#22352;&#26631; <BR>if(type.toLowerCase()==='x'){ <BR>//&#27178;&#22352;&#26631;&#21333;&#20301;&#38388;&#38548; <BR>var xPices = drawAreaWidth / opts.xUnit.units.length, <BR>//&#21333;&#20301;&#38388;&#38548;&#30340;&#20013;&#24515;&#28857; <BR>offset = xPices / 2, <br><br>yPices = drawAreaHeight / lineNum; <br><br><BR>//--------------------------------&#30011;&#27178;&#21521;&#30340;&#28857;&#21644;&#25991;&#23383;--------------------------------------------------------- <BR>each(opts.xUnit.units,function(i,d){ <BR>self.baseDraw('path',{ <BR>border : 1, <BR>borderColor : '#C0C0C0', <BR>isfill : false, <BR>path : [ <BR>M, <BR>processPoint(startX + (i * xPices)), <BR>processPoint(startY), <BR>L, <BR>processPoint(startX + (i*xPices)), <BR>processPoint(startY + 5) <BR>] <BR>}). <BR>appendTo(self.panel); <BR>var y = hasSVG?5:10, <BR>span = self.baseDraw('span',{ <BR>x : startX + offset + (i * xPices), <BR>y : startY+y, <BR>'text-anchor':'middle' <BR>}) <BR>.css({ <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px' <BR>}) <BR>.addText(opts.xUnit.units[i]) <BR>.appendTo(self.panel) <BR>.element; <br><br>//vml&#27809;&#26377;x y&#30340;&#27010;&#24565; &#25152;&#20197;&#35201;&#31616;&#21333;span&#23485;&#24230;&#30340;&#19968;&#21322; &#20197;&#21518;&#29992;span&#37117;&#38656;&#35201;&#20943;&#25481; <BR>!hasSVG <BR>span.style.left = parseInt(span.style.left) - span.offsetWidth/2+'px'; <br><br>}); <BR>//--------------------------------&#30011;&#32437;&#21521;&#30340;&#28857;&#21644;&#25991;&#23383;----------------------------------------------------------------------- <BR>for(i=0;i<=lineNum;i++){ <BR>self.baseDraw('path',{ <BR>border : 1, <BR>borderColor : '#C0C0C0', <BR>isfill : false, <BR>path : [M, startX, processPoint(startY - (i * yPices)), L, processPoint(startX + drawAreaWidth), processPoint(startY - (i *yPices))] <BR>}) <BR>.css({zIndex:-10}) <BR>.appendTo(self.panel); <br><br>var span = self.baseDraw('span',{ <BR>x : startX - 15, <BR>y : startY - i * yPices-calTextLen(min+i*f+'').h/2, <BR>'text-anchor':'middle' <BR>}) <BR>.css({ <BR>'font-family':'Verdana,Arial,Helvetica,sans-serif', <BR>'font-size':'12px', <BR>width: '40px', <BR>display:'block', <BR>textAlign:'right' <BR>}) <BR>.addText((min*1000+(i*1000*f/1000)*1000)/1000+'') <BR>.appendTo(self.panel) <BR>.element; <br><br>if(!hasSVG){ <BR>span.style.top = parseInt(span.style.top) + span.offsetHeight/2 -5+'px'; <BR>span.style.left = parseInt(span.style.left) -35+'px' <BR>} <BR>} <br><br>}else{ <BR>//&#27178;&#22352;&#26631;&#21333;&#20301;&#38388;&#38548; <BR>var yPices = drawAreaHeight / (opts.xUnit.units.length), <BR>//&#21333;&#20301;&#38388;&#38548;&#30340;&#20013;&#24515;&#28857; <BR>offset = Math.round(yPices / 2); <br><br><br><br>var x = hasSVG?25:70, <BR>vv = hasSVG?0:5; <br><br>each(opts.xUnit.units,function(i,d){ <br><br>self.baseDraw('path',{ <BR>border : 1, <BR>borderColor : '#C0C0C0', <BR>isfill : false, <BR>path : [ <BR>M, <BR>processPoint(startX-5), <BR>processPoint(startY-i * yPices), <BR>L, <BR>processPoint(startX), <BR>processPoint(startY-i * yPices), <BR>] <BR>}) <BR>.appendTo(self.panel); <BR>var span = self.baseDraw('span',{ <BR>x : startX - x, <BR>y : startY -i * yPices-offset-calTextLen(d).h/2+vv, <BR>'text-anchor':'middle' <BR>}) <BR>.css({ <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px', <BR>width : '60px', <BR>textAlign:'right' <BR>}) <BR>.addText(d) <BR>.appendTo(self.panel) <br><br>}); <br><br><BR>var xPices = drawAreaWidth / lineNum; <br><br>for(var i=0;i<=lineNum;i++){ <BR>self.baseDraw('path',{ <BR>border : 1, <BR>borderColor : '#C0C0C0', <BR>isfill : false, <BR>path : [ <BR>M, <BR>processPoint(startX + (i * xPices)), <BR>processPoint(startY), <BR>L, <BR>processPoint(startX + (i*xPices)), <BR>processPoint(startY - drawAreaHeight) <BR>] <BR>}). <BR>appendTo(self.panel); <br><br>var span = self.baseDraw('span',{ <BR>x : startX - calTextLen(min+i*f+'').w/2 + i * xPices, <BR>y : startY, <BR>'text-anchor':'left' <BR>}) <BR>.css({ <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px' <BR>}) <BR>.addText(min+i*f+'') <BR>.appendTo(self.panel) <BR>.element; <BR>} <br><br>} <br><br>//----------------------------------------------------------------------------------------------------- <BR>//&#22312;&#30011;&#21306;&#22495;&#22270;&#30340;&#26102;&#20505;&#36824;&#38656;&#35201;&#36215;&#28857;&#30340;&#20301;&#32622;&#21834; <BR>//&#22240;&#20026;&#22352;&#26631;&#24456;&#21487;&#33021;&#26159;&#36127;&#25968; &#32780;&#19988;&#20063;&#33021;&#19981;&#26159;&#20174;0&#24320;&#22987;&#30340; &#25152;&#20197;+&#19978;jianju <BR>var jianju =0 <BR>if(min>0)jianju = min; <BR>if(max<0)jianju = max; <BR>//&#35745;&#31639;&#24320;&#22987;&#30340;&#20301;&#32622; <BR>startX = opts.charts.panel==='x' ? startX :startX-xPices*(min/f); <BR>startY = opts.charts.panel==='x' ? startY+yPices*(min/f) : startY; <br><br>opts.draw = { <BR>startX : startX, // X &#36724;&#36215;&#28857; <BR>startY : startY , // Y &#36724;&#36215;&#28857; <BR>xPices : xPices, // X &#36724;&#27599;&#20221;&#30340;&#23485;&#24230; <BR>yPices : yPices, // Y &#36724;&#27599;&#20221;&#30340;&#23485;&#24230; <BR>offset : offset, // X &#21333;&#20998;&#20013;&#24515;&#28857;&#20301;&#32622;&#20559;&#31227;&#37327; <BR>jianju : jianju*yPices/f, <BR>feed : f // Y &#36724;&#30340;&#27599;&#20221;&#26377;&#22810;&#23569; <BR>}; <BR>return this; <BR>}, <br><br>createTooltip : function(){ <BR>//&#19968;&#20010;&#32452; <BR>this.tipC = this.group('tip') <BR>.css({zIndex: 200,height:'20px',width:'20px',position:'absolute'}) <BR>.appendTo() <BR>.hide() <br><br>//&#30011;&#19968;&#20010;&#26694;&#26694;baseDraw <BR>this.tipBox = this.baseDraw('rect',{arc:0.22,fill:'#fff',border:2,borderColor:'#606060'}) <BR>.appendTo(this.tipC) <br><br>//&#22240;&#20026;svg&#37324;&#38754;&#30340;g&#21487;&#20197;&#30452;&#25509;&#23450;&#20301; &#20294;&#26159;vml&#37324;&#38754;&#30340;group&#28210;&#26579;&#24456;&#24930; &#25152;&#20197;&#25913;div &#25152;&#20197;&#36825;&#37324;&#30340;&#29238;&#19981;&#19968;&#27915; <BR>var p = isIE ?this.tipBox :this.tipC; <br><br>this.tipTxtContainer = this.baseDraw('text',{fill:'#000000',x:5,y:19,'text-anchor':'left'}) <BR>.css({ <BR>fontFamily:'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize:'12px', <BR>background: '#FFF' <BR>}) <BR>.appendTo(p); <br><br>this.tipText = doc.createTextNode(''); <BR>this.tipTxtContainer[0].appendChild(this.tipText); <BR>return this; <BR>}, <BR>showTooltip : function(obj, x, y,data){ <BR>var txt =obj.name + ((' : ' + data)||''), <BR>size = calTextLen(txt,this.tipTxtContainer[0].style.cssText), <BR>pos = {x : x - (size.w + 5 * 2)/2 ,y : y - 32}; <BR>this.tipC <BR>.toFront() <BR>.show(); <br><br>if(hasSVG){ <BR>this.tipC.attr({transform:'translate('+pos.x+','+pos.y+')'}); <br><br>this.tipBox <BR>.attr({width : size.w + 5 * 2,height : size.h + 5 * 2,stroke : obj.color||'#606060'}); <BR>}else{ <BR>this.tipC.css({left:pos.x,top:pos.y}); <br><br>this.tipBox <BR>.css({width:size.w + 5 * 2,height : size.h + 5 * 2}) <BR>this.tipBox[0].strokeColor = obj.color||'#606060'; <BR>} <br><br>this.tipText.nodeValue = txt || ''; <BR>}, <BR>hideTooltip: function(){ <BR>this.tipC.hide(); <BR>}, <br><br>drawLegend : function(type,redraw){ <BR>var self = this, <BR>opts = this.opts, <BR>//&#39068;&#33394;&#22359;&#30340;&#22823;&#23567; <BR>t_width = 20, <BR>t_height = 20, <BR>//&#22359;&#20043;&#38388;&#30340;&#36317;&#31163; <BR>t_space = 5, <BR>datas = opts.chartData, <BR>len = datas.length, <BR>css = opts.legend.style, <br><br>//&#26368;&#22823;&#38271;&#24230; &#22914;&#26524;&#26159;&#32437;&#30528;&#30340; &#38656;&#35201;&#26368;&#22823;&#30340;&#38271;&#24230; <BR>maxWidth = 10, <BR>maxHeight = 30, <BR>//&#36825;&#20010;&#19996;&#35199;&#30340;&#20301;&#32622; <BR>orig_pos = opts.legend.pos?opts.legend.pos:[2,2], <br><br>//&#26174;&#31034;&#38544;&#34255;&#32452;&#30340;&#20989;&#25968; <BR>handle = function(i){ <BR>var g = self.mainGroup['chart'+i]; <BR>if(g.show){ <BR>g.chart.hide(); <BR>g.show = false; <BR>hasSVG <BR>? this.attr({fill:'#ccc'}) <BR>: this[0].style.color = '#ccc' <BR>}else{ <BR>g.chart.show(); <BR>g.show = true; <BR>hasSVG <BR>? this.attr({fill:'#000'}) <BR>: this[0].style.color = '#000' <BR>} <BR>}, <br><br>arr = []; <br><br>type = type ||'lateral'; <BR>var legendPanel = self.group('Legend') <BR>.appendTo(); <BR>if(type==='lateral'){ <BR>//&#22914;&#26524;&#26159;&#27178;&#30528;&#30340; <BR>var top = orig_pos[1] + 5, <BR>th = hasSVG?0:3, <BR>left = orig_pos[0] + 5; <BR>each(datas, function(i,d){ <BR>left = i===0 ? left : t_space+left; <BR>//&#35745;&#31639;&#25152;&#26377;left&#30340;&#20301;&#32622; <BR>self.baseDraw('rect',{ <BR>arc : 0.1, <BR>fill : d.color, <BR>border : 1, <BR>borderColor : d.color, <BR>left : left, <BR>top : top, <BR>width : t_width+'px', <BR>height : t_height+'px' <BR>}) <BR>.appendTo(legendPanel); <BR>left = left + t_width+2 + t_space; <BR>var w = calTextLen(d.name,css).w <BR>self.baseDraw('span',{ <BR>'text-anchor':'left', <BR>x : left, <BR>y : top+th <BR>}) <BR>.css(extend(css,{cursor:'pointer'})) <BR>.on('click',function(){ <BR>if(opts.charts.type==='pies')return; <BR>handle.call(this,i); <BR>}) <BR>.addText(d.name) <BR>.appendTo(legendPanel); <BR>left = left + w; <br><br>}); <BR>this.baseDraw('rect',{ <BR>arc : 0.1, <BR>fill : 'none', <BR>border : 1.5, <BR>borderColor : '#666666', <BR>width : left+ t_space- orig_pos[0], <BR>height : maxHeight, <BR>left : orig_pos[0], <BR>top : orig_pos[1] <BR>}) <BR>.appendTo(legendPanel); <BR>}else{ <br><br>var top = orig_pos[1] + 5, <BR>th = hasSVG?0:3, <BR>left = orig_pos[0] + 5; <BR>each(datas, function(i,d){ <BR>top = i===0 ? top : t_space + top; <BR>self.baseDraw('rect',{ <BR>arc : 0.1, <BR>fill : d.color, <BR>border : 1, <BR>borderColor : d.color, <BR>left : left, <BR>top : top, <BR>width : t_width+'px', <BR>height : t_height+'px' <BR>}) <BR>.appendTo(legendPanel); <br><br>var h = calTextLen(d.name,css).h; <br><br>self.baseDraw('span',{ <BR>'text-anchor':'left', <BR>x : left+t_width+2+t_space, <BR>y : top+th <BR>}) <BR>.css(extend(css,{cursor:'pointer'})) <BR>.addText(d.name) <BR>.on('click',function(){ <BR>if(opts.charts.type==='pies')return; <BR>handle.call(this,i); <BR>}) <BR>.appendTo(legendPanel); <BR>top = top + h+ t_space; <BR>maxWidth = Math.max(maxWidth,calTextLen(d.name,css).w); <BR>}); <BR>this.baseDraw('rect',{ <BR>arc : 0.1, <BR>fill : 'none', <BR>border : 1.5, <BR>borderColor : '#666666', <BR>width : maxWidth+22+15, <BR>height : top+t_space-orig_pos[1], <BR>left : orig_pos[0], <BR>top : orig_pos[1] <BR>}) <BR>.appendTo(legendPanel); <BR>} <BR>return this; <BR>}, <BR>drawLine : function(){ <BR>var self = this, <BR>opts = this.opts; <BR>draw = opts.draw; <BR>each(opts.chartData,function(i,o){ <BR>var id = 'chart'+i, <BR>lineGroup = self.group(id) <BR>.appendTo(); <BR>self.mainGroup[id]={chart:lineGroup,show:true}; <BR>var path = [M], <BR>data = o.data, <BR>line; <br><br>for(var i = 0; i < data.length; i++){ <BR>if( data[i] == null){ <BR>//&#22914;&#26524;&#36825;&#20010;&#25968;&#25454;&#19981;&#23384;&#22312; &#24182;&#19988;&#19981;&#26159;&#31532;&#19968;&#20010;&#25968;&#25454; &#36335;&#24452;&#19978;&#21152; M <BR>if(path[path.length - 1] !== M) <BR>path.push(M); <BR>}else{ <BR>//&#22914;&#26524;&#19981;&#26159;&#31532;&#19968;&#20010;&#25968;&#25454; &#36335;&#24452;&#28155;&#21152;L <BR>i !== 0 && path.push("L"); <BR>//&#22914;&#26524;&#21069;&#38754;&#19968;&#20010;&#26159;null &#24182;&#19988;&#19981;&#26159;&#31532;&#19968;&#20010; &#25226;&#37027;&#20010;L&#21435;&#25481; <BR>if(i > 0 && data[i - 1] == null) <BR>path.pop(); <BR>//&#35745;&#31639;&#20986; &#28857;&#30340;x,y&#30340;&#20301;&#32622; <BR>var x = draw.startX + draw.offset + (i * draw.xPices), <BR>y = draw.startY - (data[i] * (draw.yPices / draw.feed)); <BR>if(isIE){ <BR>x = parseInt(x); <BR>y = parseInt(y); <BR>} <BR>path.push(x); <BR>path.push(y); <BR>//&#30011;&#28857; <BR>self.baseDraw('circle',{ <BR>x : x, <BR>y : y, <BR>r : 4, <BR>fillColor : o.color <BR>}) <BR>.attr({data:data[i]}) <BR>.css({zIndex:10,cursor:'pointer'}) <BR>.on('mouseover',(function(o,x,y){ <BR>return function(){ <BR>hasSVG <BR>? (this[0].setAttribute('r','5'),line.attr({'stroke-width':2.5})) <BR>: (this[0].strokeWeight = 3,line[0].strokeWeight = 2.5); <BR>self.showTooltip(o,x,y,this.attr('data')); <BR>} <br><br>})(o,x,y)) <BR>.on('mouseout',function(){ <BR>hasSVG <BR>? (this[0].setAttribute('r','4'),line.attr({'stroke-width':1.5})) <BR>: (this[0].strokeWeight = 1,line[0].strokeWeight = 1.5); <BR>self.hideTooltip() <BR>}) <BR>.on('click',function(){lineGroup.toFront(); }) <BR>.appendTo(lineGroup); <br><br>} <BR>}; <BR>//&#30011;&#25240;&#32447; <BR>line = self.baseDraw('path',{ <BR>border : 1.5, <BR>borderColor : o.color, <BR>isfill : false, <BR>path : path <BR>}) <BR>.css({zIndex:5}) <BR>.on('mouseover',function(){ <BR>hasSVG <BR>? this.attr({'stroke-width':2.5}) <BR>: (this[0].strokeWeight = 2.5); <BR>}) <BR>.on('mouseout',function(){ <BR>hasSVG <BR>? this.attr({'stroke-width':1.5}) <BR>: (this[0].strokeWeight = 1.5); <BR>}) <BR>.on('click',function(){lineGroup.toFront(); }) <BR>.appendTo(lineGroup); <BR>}); <BR>return this; <BR>}, <BR>drawArea : function(){ <BR>var self = this, <BR>opts = this.opts, <BR>draw = opts.draw; <BR>each(opts.chartData,function(i,o){ <BR>var id = 'chart' + i, <BR>areaGroup = self.group(id).appendTo(); <BR>self.mainGroup[id] = {chart : areaGroup,show : true}; <BR>//&#26377;2&#20010;&#36335;&#24452; &#19968;&#20010;&#26159;&#21306;&#22495;&#30340;&#36335;&#24452; &#19968;&#20010;&#26159;&#32447;&#30340;&#36335;&#24452; <br><br>var areaPath = [M, (draw.startX + draw.offset).toFixed(0), (draw.startY-draw.jianju).toFixed(0)], <BR>path = [M], <BR>data = o.data, <BR>line; <BR>for(var n=0,l=data.length;n<l;n++){ <BR>//&#22914;&#26524;&#25968;&#25454;&#26159;&#31354;&#30340; <BR>var len = areaPath.length; <BR>if( data[n] === null){ <BR>//&#22914;&#26524;&#21069;&#38754;&#30340;&#19968;&#20010;&#19981;&#26159;m &#23601;&#37325;&#26032;&#30011; &#25152;&#20197;&#21152;&#19978; M <BR>if(path[path.length - 1] !== M) <BR>path.push(M); <br><br>//&#22914;&#26524;&#31532;1&#20010; &#25110;&#32773;&#21069;&#38754;&#30340;&#37117;&#20026;bull &#20462;&#25913;&#36215;&#28857;&#22352;&#26631; <BR>len===3 <BR>&&(areaPath[1] = (draw.startX +(n+1)*draw.xPices + draw.offset).toFixed(0)); <br><br>//&#22914;&#26524;&#21069;&#38754;&#19968;&#20010;&#19981;&#26159;&#32467;&#26463;&#26631;&#35782;&#31526; &#21306;&#22495;&#22270;&#32467;&#26463; &#22914;&#26524;&#31532;&#19968;&#20010;&#25968;&#25454;&#26159;null &#21017;&#19981;&#36827;&#34892;&#19979;&#38754;&#30340;&#25805;&#20316; <BR>if(areaPath[len - 1] !== seal&&n!==0){ <BR>areaPath=areaPath.concat([ <BR>areaPath[len - 2], <BR>(draw.startY-draw.jianju).toFixed(0), <BR>seal <BR>]); <BR>} <BR>}else{ <BR>n !== 0 && path.push(L); <BR>areaPath.push(L); <BR>//&#22914;&#26524;&#21069;&#38754;&#30340;&#37027;&#20010;&#25968;&#25454;&#26159;null &#25226;&#20043;&#21069;&#30340;&#37027;&#20010;L&#21435;&#25481; <BR>if(n > 0 && data[n - 1] == null){ <BR>path.pop(); <BR>//&#22914;&#26524;&#26159;&#31532;&#19968;&#20010;&#20026;null &#19981;&#21024;&#38500;L <BR>n!==1&&areaPath.pop(); <BR>} <br><br>var x = draw.startX + draw.offset + (n * draw.xPices), <BR>y = draw.startY - ((data[n]) * (draw.yPices / draw.feed)); <BR>if(isIE){ <BR>x = parseInt(x); <BR>y = parseInt(y); <BR>} <BR>path.push(x); <BR>path.push(y); <br><br><BR>if(areaPath[len - 1] === seal){ <BR>areaPath = areaPath.concat([ <BR>M, <BR>x, <BR>parseInt(draw.startY-draw.jianju), <BR>L, <BR>x, <BR>y <BR>]); <BR>}else{ <BR>areaPath.push(x); <BR>areaPath.push(y); <BR>} <br><br>//&#22914;&#26524;&#26159;&#26368;&#21518;&#19968;&#20010;&#28857; <BR>if(n === l - 1){ <br><br>areaPath.push(x); <br><br>areaPath.push(parseInt(draw.startY-draw.jianju)); <BR>} <br><br>//&#30011;&#28857; <BR>self.baseDraw('circle',{ <BR>x : x, <BR>y : y, <BR>r : 4, <BR>fillColor : o.color <BR>}) <BR>.attr({data:data[n]}) <BR>.on('mouseover',(function(o,x,y){ <BR>return function(){ <BR>hasSVG <BR>? (this[0].setAttribute('r','5'),line.attr({'stroke-width':2.5})) <BR>: (this[0].strokeWeight = 3,line[0].strokeWeight = 2.5); <BR>self.showTooltip(o,x,y,this.attr('data')); <BR>} <br><br>})(o,x,y)) <BR>.on('mouseout',function(){ <BR>hasSVG <BR>? (this[0].setAttribute('r','4'),line.attr({'stroke-width':1.5})) <BR>: (this[0].strokeWeight = 1,line[0].strokeWeight = 1.5); <BR>self.hideTooltip() <BR>}) <BR>.on('click',function(){areaGroup.toFront(); }) <BR>.css({zIndex:10,cursor:'pointer'}) <BR>.appendTo(areaGroup); <br><br>} <BR>} <br><br>areaPath.push(seal) <br><br>self.baseDraw('path',{ <BR>border : 0, <BR>isfill : true, <BR>fillColor : o.color, <BR>opacity : 0.5, <BR>path : areaPath <BR>}) <BR>.css({zIndex:5}) <BR>.appendTo(areaGroup); <br><br>line = self.baseDraw('path',{ <BR>border : 2.5, <BR>borderColor : o.color, <BR>isfill : false, <BR>path : path <BR>}) <BR>.on('mouseover',function(){ <BR>hasSVG <BR>? this.attr({'stroke-width':2.5}) <BR>: (this[0].strokeWeight = 2.5); <BR>}) <BR>.on('mouseout',function(){ <BR>hasSVG <BR>? this.attr({'stroke-width':1.5}) <BR>: (this[0].strokeWeight = 1.5); <BR>}) <BR>.on('click',function(){areaGroup.toFront(); }) <BR>.css({zIndex:-1}) <BR>.appendTo(areaGroup); <BR>}); <BR>return this; <BR>}, <BR>drawColumns : function(){ <BR>var self = this, <BR>opts = this.opts, <BR>draw = opts.draw, <BR>chartData = opts.chartData, <BR>dataLen = chartData.length, <BR>//&#22810;&#20010;&#26609;&#23376;&#20043;&#38388;&#30340;&#38388;&#36317; <BR>columnSpace = 3, <BR>//&#19968;&#20010;&#20301;&#32622;&#20013; &#25152;&#26377;&#30340;&#38388;&#38548;&#20043;&#21644; <BR>columnPadding = columnSpace * dataLen + columnSpace, <BR>//&#27599;&#20010;&#26609;&#23376;&#30340;&#23485;&#24230; <BR>columnSize = self.opts.charts.panel==='x' <BR>? Number(((draw.xPices - columnPadding) / dataLen).toFixed(0)) <BR>: Number(((draw.yPices - columnPadding) / dataLen).toFixed(0)); <br><br>each(chartData, function(i,o){ <BR>var data = o.data, <BR>id = 'chart' + i, <BR>isX = opts.charts.panel==='x', <BR>colGroup = self.group(id).appendTo(), <BR>//&#27599;&#20010;&#28857;&#24320;&#22987;&#30340;&#20301;&#32622; <BR>start = self.opts.charts.panel==='x' <BR>? draw.startX + columnSpace + i*(columnSize+columnSpace) <BR>: draw.startY + columnSpace + i*(columnSize+columnSpace) <br><br>self.mainGroup[id] = {chart:colGroup,show:true}; <br><br>for(var j = 0,l=data.length; j < l ; j++){ <BR>if(data[j]===null) continue; <BR>//&#22914;&#26524;&#26159;&#27178;&#30424;&#23376; <BR>if(isX){ <BR>var x = Number((start + j *draw.xPices ).toFixed(0)), <BR>y = Number((draw.startY).toFixed(0)), <BR>height = Number((data[j] * (draw.yPices / draw.feed)).toFixed(0)), <BR>path = [ <BR>M, <BR>x, <BR>y, <BR>L, <BR>x, <BR>y -height, <BR>L, <BR>x + columnSize, <BR>y - height, <BR>L, <BR>x + columnSize, <BR>y, <BR>seal <BR>]; <BR>var pos = [x+columnSize/2,data[j]>0?y-height:draw.startY]; <BR>}else{ <br><br>var x = Number((draw.startX).toFixed(0)), <BR>width = Number((data[j]*((draw.xPices / draw.feed))).toFixed(0)), <BR>y = Number((start - (j+1) *draw.yPices ).toFixed(0)), <BR>path = [ <BR>M, <BR>x, <BR>y, <BR>L, <BR>x+ width, <BR>y , <BR>L, <BR>x + width, <BR>y + columnSize, <BR>L, <BR>x , <BR>y+ columnSize, <BR>seal <BR>]; <BR>var pos = [draw.startX+width/2,y-columnSize]; <BR>} <br><br>self.baseDraw('path',{ <BR>border : 0, <BR>isfill : true, <BR>fillColor : o.color, <BR>opacity : 1, <BR>path : path <BR>}) <BR>.attr({data:data[j]}) <BR>.css({zIndex:5,cursor:'pointer'}) <BR>.on('mouseover',(function(x,y,d){ <br><br>return function(){ <br><br>this.setOpacity(0.85); <br><br>self.showTooltip(o,x,y,this.attr('data')); <BR>} <br><br>})(pos[0],pos[1],data[j]) <br><br>) <BR>.on('mouseout',(function(x,y){ <BR>return function(){ <BR>this.setOpacity(1); <BR>self.hideTooltip(); <BR>} <BR>})(x,y)) <BR>.appendTo(colGroup); <br><br>} <BR>}); <BR>return this; <BR>}, <BR>drawPie : function(){ <BR>var self = this, <BR>opts = this.opts, <BR>area = opts.area, <BR>rx = area.centerX, <BR>ry = area.centerY, <BR>inc = 0, <BR>total = 0, <BR>data = [], <BR>cumulative = -0.25, // start at top; <BR>circ = 2 * Math.PI, <BR>radiu = mathMin(opts.charts.radius,mathMin(area.areaWidth/2,area.areaHeight/2)), <BR>fraction, <BR>half_fraction; <br><br>each(opts.chartData,function(i,o){ <BR>typeof o.data ==='object' <BR>? (data.push((function(o){ <BR>var all =0; <BR>for(var i in o) <BR>all+=~~o[i] <BR>return all <BR>})(o.data))) <BR>:data.push(mathAbs(o.data)) <br><br>}); <br><br>each(data,function(i,o){ <BR>total = total + o; <BR>}); <br><br>each(data,function(i,o){ <BR>var pieGroup = self.group('chart'+i).appendTo(), <BR>s = inc/total*360, <BR>e = (inc + o)/total*360, <BR>name = opts.chartData[i].name, <BR>size = calTextLen(name), <BR>dot = angle(radiu,[rx,ry],s+(e-s)/2,2), <BR>x = rx + (dot[0]-rx)/2 - size.w/2, <BR>y = ry + (dot[1]-ry)/2 - size.h/2, <BR>len = Math.sqrt((x-rx)*(x-rx)+(y-ry)*(y-ry)), <BR>moveDisplacement = ((x-rx)*8/len)+','+((y-ry)*8/len); <br><br>inc = inc + o; <br><br>var value = Number(o); <BR>fraction = total ? value / total : 0; <BR>half_fraction = total ? (value / 2) / total : 0; <br><br>var start = cumulative * circ; <BR>half_cumulative = cumulative + half_fraction; <BR>cumulative += fraction; <br><br>var end = cumulative * circ; <br><br>self.baseDraw('pie',{ <BR>config : opts.chartData[i], <BR>s : start, <BR>e : end, <BR>r : radiu, <BR>innerR : 0 <BR>}) <BR>.css({zIndex:5,cursor:'pointer'}) <BR>.attr({move:moveDisplacement}) <BR>.on('mouseover',function(){ <BR>this.setOpacity(0.85); <BR>}) <BR>.on('mouseout',function(){ <BR>this.setOpacity(1); <BR>}) <BR>.on('click',function(){ <BR>var m = this.attr('move') <BR>if(m.indexOf('+')>0){ <BR>hasSVG <BR>? this.attr({ <BR>transform: 'translate(0,0)' <BR>}) <BR>: this.css({ <BR>left : '0px', <BR>top : '0px' <BR>}) <BR>this.attr({move:m.replace('+','')}); <br><br>}else{ <BR>var s= m.split(','); <BR>hasSVG <BR>? this.attr({ <BR>transform: 'translate('+m+')' <BR>}) <BR>: this.css({ <BR>left : s[0]+'px', <BR>top : s[1]+'px' <BR>}) <br><br>this.attr({move:m+'+'}); <BR>} <BR>}) <BR>.appendTo(pieGroup); <br><br>self.mainGroup['chart'+i] = {chart:pieGroup,show:true}; <br><br>self.baseDraw('span',{ <BR>x : x, <BR>y : y, <BR>fill : '#fff', <BR>'text-anchor':'left' <BR>}) <BR>.css({ <BR>fontFamily : 'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize : '12px', <BR>position : 'absolute', <BR>color : '#fff', <BR>zIndex : 10 <BR>}) <BR>.addText(name) <BR>.appendTo(pieGroup); <BR>}); <br><br>}, <BR>drawPies : function(){ <br><br>var self = this, <BR>opts = this.opts, <BR>area = opts.area, <BR>rx = area.centerX, <BR>ry = area.centerY, <BR>total = 0, <BR>data = [], <BR>chartData = opts.chartData, <BR>cumulative = -0.25, // start at top; <BR>circ = 2 * Math.PI, <BR>radiu = mathMin(opts.charts.radius,mathMin(area.areaWidth/2,area.areaHeight/2)), <BR>fraction, <BR>half_cumulative, <BR>half_fraction; <br><br>each(chartData,function(i,o){ <BR>each(o.data,function(j,d){ <BR>data[j] <BR>? data[j] +=mathAbs(d) <BR>: data[j] =mathAbs(d) <BR>}); <br><br>}); <BR>//&#30475;&#26377;&#22810;&#23569;&#20010;&#25968;&#25454;&#26469;&#29983;&#25104;&#26469;&#29983;&#25104;&#20869;&#21322;&#24452; <BR>var len = data.length, <BR>innerSpace = radiu / 10; <BR>Rpice = (radiu - innerSpace) / len, <BR>piesGroup = this.group('pies').appendTo(); <br><br>each(data,function(i,d){ <BR>var inc = 0 ; <BR>if(d===0) return; <BR>each(chartData,function(j,o){ <BR>if(~~o.data[i]===0)return; <BR>var outR = radiu - Rpice * i, <BR>innerR = radiu - Rpice * (i + 1), <BR>value = ~~o.data[i], <BR>fraction = value / d; <BR>half_fraction = (value/2)/d , <BR>start = cumulative * circ, <BR>s = inc/d*360, <BR>e = (inc + value)/d*360; <br><br>inc = inc + value; <BR>var name = o.name, <BR>size = calTextLen(name), <BR>dot = angle(radiu,[rx,ry],s+(e-s)/2,2), <BR>px = dot[0]>rx?1:-1, <BR>py = dot[1]>ry?1:-1; <BR>var x = rx + px*innerSpace + ((dot[0]-rx-px*innerSpace)/len)*(len-i-1)+((dot[0]-rx-px*innerSpace)/len)/2- size.w/2, <BR>y = ry + py*innerSpace +((dot[1]-ry-py*innerSpace)/len)*(len-i-1)+((dot[1]-ry-py*innerSpace)/len)/2- size.h/2; <br><br>half_cumulative = cumulative + half_fraction, <BR>cumulative += fraction, <BR>end = cumulative * circ; <br><br>self.baseDraw('pie',{ <BR>config : o, <BR>s : start, <BR>e : end, <BR>r : outR, <BR>innerR : innerR <BR>}) <BR>.css({zIndex:5,cursor:'pointer'}) <BR>.on('mouseover',function(){ <BR>this.setOpacity(0.85); <BR>}) <BR>.on('mouseout',function(){ <BR>this.setOpacity(1); <BR>}) <BR>.appendTo(piesGroup); <BR>self.baseDraw('span',{ <BR>x : x, <BR>y : y, <BR>fill : '#fff', <BR>'text-anchor':'left' <BR>}) <BR>.css({ <BR>fontFamily : 'Verdana,Arial,Helvetica,sans-serif', <BR>fontSize : '12px', <BR>position : 'absolute', <BR>color : '#fff', <BR>zIndex : 10 <BR>}) <BR>.addText(name) <BR>.appendTo(piesGroup); <br><br>}) <BR>}); <br><br>}, <BR>drawSegment : function(){ <BR>var self = this, <BR>opts = this.opts, <BR>draw = opts.draw, <BR>chartData = opts.chartData, <BR>columnPad = 5, <BR>columnWidth = draw.xPices - columnPad * 2; <br><br>each(chartData,function(i,c){ <br><br><BR>}); <BR>}, <BR>baseDraw : function(type,config){ <BR>var self = this <BR>arg = arguments; <BR>return { <BR>rect : function(){ <BR>var set = {}; <BR>set.rx = set.ry = config.arc*30 || 5; <BR>set.width = config.width || 50; <BR>set.height = config.height || 50; <BR>set.fill = config.fill || '#fff'; <BR>set['fill-opacity'] = config.opacity || 0.85; <BR>set['stroke-width'] = config.border || 2; <BR>set.stroke = config.borderColor || '#606060'; <BR>set.transform = 'translate('+(config.left||0)+','+(config.top||0)+')'; <BR>return self.createElement('rect') <BR>.attr(set) <br><br>}, <BR>text : function(){ <BR>return self.createElement('text') <BR>.attr(config) <BR>}, <BR>span : function(){ <BR>var elem= self.createElement('text') <BR>.attr(config) <BR>.attr({ <BR>y : config.y+(arg[2]||15) <BR>}) <BR>return elem; <BR>}, <BR>path : function(){ <BR>var set = {}; <BR>set['stroke-width'] = config.border; <BR>set.stroke = config.borderColor || '#C0C0C0'; <BR>set.fill = config.isfill?config.fillColor:'none'; <BR>set.d = config.path; <BR>config.opacity <BR>&&(set['fill-opacity'] = config.opacity); <br><br>return self.createElement('path') <BR>.attr(set); <BR>}, <BR>circle : function(){ <BR>var set = {}; <BR>set.cx = config.x; <BR>set.cy = config.y; <BR>set.r = config.r; <BR>set.fill = config.fillColor; <BR>return self.createElement('circle') <BR>.attr(set); <BR>}, <BR>pie : function(){ <BR>//config,s,e,r,index <BR>var opts = self.opts, <BR>s = config.s, <BR>r = config.r, <BR>e = config.e - 0.000001, <BR>id = 'chart'+config.index, <BR>area = opts.area, <BR>rx = area.centerX, <BR>ry = area.centerY, <BR>cosStart = mathCos(s), <BR>sinStart = mathSin(s), <BR>cosEnd = mathCos(e), <BR>sinEnd = mathSin(e), <BR>color = config.config.color, <BR>innerR = config.innerR, <BR>longArc = e - s < Math.PI ? 0 : 1, <BR>path = [ <BR>M, <BR>rx + r * cosStart, <BR>ry + r * sinStart, <BR>'A', <BR>r, <BR>r, <BR>0, <BR>longArc, <BR>1, <BR>rx + r * cosEnd, <BR>ry + r * sinEnd, <BR>L, <BR>rx + innerR * cosEnd, <BR>ry + innerR * sinEnd, <BR>'A', // arcTo <BR>innerR, // x radius <BR>innerR, // y radius <BR>0, // slanting <BR>longArc, // long or short arc <BR>0, // clockwise <BR>rx + innerR * cosStart, <BR>ry + innerR * sinStart, <BR>'Z' <BR>]; <br><br>return self.baseDraw('path',{ <BR>border : 1, <BR>border : '#fff', <BR>isfill : true, <BR>fillColor : color, <BR>opacity : 1, <BR>path : path <br><br>}) <br><br>} <BR>}[type](); <BR>} <BR>}; <br><br>//--------------------------------------------------------------------------------------------------- <BR>//&#22914;&#26524;&#26159;vml &#20462;&#25913;smipleChart.prototype&#20013;&#30340;&#19968;&#20123;&#26041;&#27861; <BR>!hasSVG <BR>&&extend(smipleChart.prototype,{ <BR>baseDraw : function(type,config){ <BR>var self = this, <BR>width = this.width, <BR>height = this.height, <BR>name = arguments[2]; <BR>return { <BR>rect : function(){ <BR>var attr = {}, <BR>css = {}; <BR>attr.arcsize = config.arc || 0.2 +''; <BR>if(config.fill==='none'){ <BR>attr.filled = 'f' <BR>}else{ <BR>attr.filled = 't'; <BR>attr.fillcolor = config.fill || '#fff'; <BR>} <br><br>attr.strokeWeight = config.border || 2; <BR>attr.strokeColor = config.borderColor || '#606060'; <BR>css.width = config.width || 50 +'px'; <BR>css.height = config.height || 50 +'px'; <BR>css.zIndex = 10; <BR>css.left = config.left||0+'px'; <BR>css.top = config.top ||0+'px'; <br><br>return self.createElement('roundrect') <BR>.attr(attr) <BR>.css(css) <BR>}, <BR>text : function(){ <BR>return self.createElement('TextBox') <BR>.attr({inset : "2px,2px,2px,2px" }) <BR>}, <BR>span : function(){ <BR>return self.createElement('span'). <BR>css({ <BR>position:'absolute', <BR>left : config.x+'px', <BR>top : config.y+'px' <BR>}) <BR>}, <BR>path : function(){ <BR>var attr = {}, <BR>css = { <BR>width : width+'px', <BR>height : height+'px' <BR>}; <br><br>if(config.border===0){ <BR>attr.Stroked = 'f'; <BR>attr.strokeWeight =0; <BR>}else{ <BR>attr.strokeWeight = config.border||1 ; <BR>} <BR>attr.strokeColor = config.borderColor || "#C0C0C0"; <BR>attr.filled = config.isfill?'t':'f'; <BR>attr.filled==='t' <BR>&&(attr.fillcolor=config.fillColor||"#C0C0C0"); <BR>attr.coordsize = width+','+height; <BR>attr.path = config.path; <BR>var elem = self.createElement() <BR>.attr(attr) <BR>.css(css); <BR>if(config.opacity){ <BR>var fill = self.createElement('fill') <BR>.attr({ <BR>type : 'fill', <BR>color : config.fillColor||"#C0C0C0", <BR>opacity : config.opacity <BR>}) <BR>.appendTo(elem); <BR>//&#37027;&#36825;&#20010;&#23545;&#35937;&#30340;&#19968;&#20010;&#23646;&#24615;&#24341;&#29992;&#35774;&#32622;&#36879;&#26126;&#30340;&#20803;&#32032; &#20197;&#21518;&#20250;&#29992;&#21040; <BR>elem.opacity = fill[0]; <BR>} <BR>return elem; <br><br>}, <BR>circle : function(){ <BR>var attr ={ <BR>strokeWeight : 1, <BR>coordsize : width+','+height, <BR>filled : 't' <BR>}, <BR>css ={ <BR>width : width+'px', <BR>height : height+'px' <BR>} <BR>x = config.x, <BR>y = config.y, <BR>r = config.r; <BR>attr.strokeColor=attr.fillcolor = config.fillColor <br><br>attr.path =[ <BR>'wa', // clockwisearcto <BR>x - r, // left <BR>y - r, // top <BR>x + r, // right <BR>y + r, // bottom <BR>x + r, // start x <BR>y, // start y <BR>x + r, // end x <BR>y, // end y <BR>'e' // close <BR>]; <BR>return self.createElement() <BR>.attr(attr) <BR>.css(css) <BR>}, <BR>pie : function(){ <BR>////config,s,e,r,index <br><br>var opts = self.opts, <BR>area = opts.area, <BR>r = config.r, <BR>rx = area.centerX, <BR>ry = area.centerY, <BR>innerR= config.innerR||0, <BR>sDot = angle(r,[rx,ry],s,2), <BR>eDot = angle(r,[rx,ry],e,2), <BR>color = config.config.color, <BR>s = config.s, <BR>e = config.e, <BR>e = e - s == 2 * Math.PI ? e - 0.001 : e, <BR>cosStart = mathCos(s), <BR>sinStart = mathSin(s), <BR>cosEnd = mathCos(e), <BR>sinEnd = mathSin(e), <br><br><BR>path = [ <BR>'wa', // clockwisearcto <BR>(rx - r).toFixed(0), // left <BR>(ry - r).toFixed(0), // top <BR>(rx + r).toFixed(0), // right <BR>(ry + r).toFixed(0), // bottom <BR>(rx + r * cosStart).toFixed(0), // start x <BR>(ry + r * sinStart).toFixed(0), // start y <BR>(rx + r * cosEnd).toFixed(0), // end x <BR>(ry + r * sinEnd).toFixed(0), // end y <br><br>'at', // clockwisearcto <BR>(rx - innerR).toFixed(0), // left <BR>(ry - innerR).toFixed(0), // top <BR>(rx + innerR).toFixed(0), // right <BR>(ry + innerR).toFixed(0), // bottom <BR>(rx + innerR * cosEnd).toFixed(0), // start x <BR>(ry + innerR * sinEnd).toFixed(0), // start y <BR>(rx + innerR * cosStart).toFixed(0), // end x <BR>(ry + innerR * sinStart).toFixed(0), // end y <br><br>'x', // finish path <BR>'e' // close <BR>]; <br><br>return self.baseDraw('path',{ <BR>border : 1, <BR>border : '#fff', <BR>isfill : true, <BR>fillColor : color, <BR>opacity : 1, <BR>path : path <BR>}) <br><br>} <BR>}[type](); <BR>} <BR>}); <br><br>//--------------------------------------------------------------------------------------------------- <BR>})(document); <br><br>window.onload = function(){ <BR>var config = { <BR>charts : { <BR>type : 'line', <BR>radius : 150, <BR>panel : 'x', <BR>style: { <BR>fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif', // default font <BR>fontSize: '12px' <BR>} <BR>}, <BR>title : { <BR>text : '&#32447;&#24615;&#22270;&#26631;' , <BR>y : 10, <BR>style : { <BR>color: 'black', <BR>fontSize: '16px' <BR>} <BR>}, <BR>subTitle : { <BR>text : '&#32447;&#24615;&#22270;&#26631;&#21103;&#26631;&#39064;', <BR>y : 35, <BR>style: { <BR>color: '#111', <BR>fontSize: '12px' <BR>} <BR>}, <BR>legend : { <BR>enable : true, <BR>//type : 'lateral', // lateral &#27178;&#21521; &#25110; lengthwise &#32437;&#21521; <BR>type : 'lateral', <BR>pos : [10,10], <BR>style:{ <BR>fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif', // default font <BR>fontSize: '12px', <BR>magin:'0px' <BR>} <BR>}, <BR>yUnit : { <BR>text : '&#32447;&#24615;&#22270;&#26631;&#20391;&#26631;&#39064;', <BR>x : 20, <BR>style: { <BR>color : '#111', <BR>fontSize : '12px' <BR>} <BR>}, <BR>xUnit : { <BR>units: [ <BR>'&#19968;&#26376;', <BR>'&#20108;&#26376;', <BR>'&#19977;&#26376;', <BR>'&#22235;&#26376;', <BR>'&#20116;&#26376;', <BR>'&#20845;&#26376;', <BR>'&#19971;&#26376;', <BR>'&#20843;&#26376;', <BR>'&#20061;&#26376;', <BR>'&#21313;&#26376;', <BR>'&#21313;&#19968;&#26376;', <BR>'&#21313;&#20108;&#26376;' <BR>] <BR>}, <BR>chartData : [ <BR>{ <br><br>name : 'xcv', <BR>color : '#4572A7', <BR>data : [-18,45,-38,29,95,-45,77] <BR>}, { <br><br>name: 'frfr', <BR>color: '#AA4643', <BR>data: [-44,12,78,-100,13,4,-56,-34] <BR>}, { <BR>name: 'AAAAA', <BR>color: '#89A54E', <br><br>data: [null,78,83,null,22,-78,2,44,78] <BR>}, { <BR>name: 'BBBB', <BR>color: '#80699B', <BR>data: [null, 58, 35, null, 52, 47, 26, -55, 39, 123,15,66] <BR>} <BR>] <BR>}; <br><br>new smipleChart($('line'),config); <BR>config.charts.type ='area'; <BR>config.title.text ='&#21306;&#22495;&#22270;&#26631;' <BR>config.subTitle.text='&#21306;&#22495;&#22270;&#26631;&#21103;&#26631;&#39064;' <BR>config.yUnit.text ='&#21306;&#22495;&#22270;&#26631;&#20391;&#26631;&#39064;' <br><br>new smipleChart($('area'),config); <BR>config.title.text ='&#26609;&#29366;&#22270;&#26631;' <BR>config.subTitle.text='&#26609;&#29366;&#22270;&#26631;&#21103;&#26631;&#39064;' <BR>config.yUnit.text ='&#26609;&#29366;&#22270;&#26631;&#20391;&#26631;&#39064;' <BR>config.charts.type ='columns'; <BR>config.chartData =[ <BR>{ <br><br>name : 'xcv', <BR>color : '#4572A7', <br><br>data : [-0.01,-0.62,0,0.55,null,0.78,-0.63,-0.82,null,null,0.33] <BR>}, { <br><br>name: 'frfr', <BR>color: '#AA4643', <BR>data: [-0.22,0.82,0.55,1.32,0.33,0.95,null,1,0.65,null,0.78] <BR>}, { <BR>name: 'AAAAA', <BR>color: '#89A54E', <br><br>data: [null,0.62,0.34,null,0.63,0,-0.23,-1,0.62,0.45,null,-0.56] <BR>} <BR>] <br><br>new smipleChart($('zhu'),config); <BR>config.charts.panel='y' <BR>new smipleChart($('zhu1'),config); <BR>config.charts.type ='pie'; <BR>config.title.text ='&#39292;&#22270;&#22270;&#26631;' <BR>config.subTitle.text='&#39292;&#22270;&#22270;&#26631;&#21103;&#26631;&#39064;' <BR>config.yUnit.text ='' <BR>config.legend.type='lengthwise'; <BR>config.chartData =[ <BR>{ <br><br>name : 'aaa', <BR>color : '#4572A7', <br><br>data : [433,123,null,66] <BR>}, { <br><br>name: 'bbb', <BR>color: '#AA4643', <BR>data: [45,33,33,511] <BR>}, { <BR>name: 'ccc', <BR>color: '#89A54E', <br><br>data: [55,null,75,333] <BR>} <BR>] <BR>config.legend.pos= [680,30] <BR>new smipleChart($('pie'),config); <BR>config.charts.type ='pies'; <BR>config.title.text ='&#22810;&#23618;&#39292;&#22270;&#22270;&#26631;' <BR>config.subTitle.text='&#22810;&#23618;&#39292;&#22270;&#22270;&#26631;&#21103;&#26631;&#39064;' <BR>config.legend.type='lateral'; <BR>config.legend.pos= [330,400] <BR>new smipleChart($('pies'),config); <br><br><BR>config.chartData =[ <BR>{ <br><br>name : 'xcv', <BR>color : '#4572A7', <br><br>data : [433,355,275,null,588,323,576,32,99] <BR>}, { <br><br>name: 'frfr', <BR>color: '#AA4643', <BR>data: [45,666,100,null,677,56,88,633,55,64] <BR>}, { <BR>name: 'AAAAA', <BR>color: '#89A54E', <br><br>data: [55,162,75,null,364,0,637,112,163,615] <BR>} <BR>] <BR>config.yUnit.lineNum = 2; <BR>config.title.text ='&#27604;&#36739;&#23567;&#30340;' <BR>config.subTitle.text='&#21482;&#35774;&#32622;&#20102;2&#26465;&#32447;' <BR>config.yUnit.text ='&#23567;&#27979;&#26631;&#39064;' ; <br><br>config.charts.type ='line'; <BR>config.legend.pos= [10,10] <BR>new smipleChart($('vv'),config); <BR>config.yUnit.lineNum = 10; <BR>config.charts.panel = 'x'; <BR>config.charts.type ='segment'; <BR>//new smipleChart($('segment'),config); <br><br>} <BR></script>


Java免费学习笔记:立即使用
解锁 Java 大师之旅:从入门到精通的终极指南

java速学教程(入门到精通)
java速学教程(入门到精通)

java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载

相关标签:

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
GoFrame框架Web开发与路由中间件
GoFrame框架Web开发与路由中间件

本专题聚焦GoFrame框架的Web开发,拆解路由注册与匹配规则、请求参数获取、参数校验与中间件执行顺序,说明统一响应、JWT鉴权、文件上传与接口文档生成的落地方式,并补充优雅重启与测试实践。

2026.11.17

20

15

GoFrame框架安装与gf命令行工具
GoFrame框架安装与gf命令行工具

本专题围绕GoFrame框架的安装与工具链配置展开,讲清Go版本要求、gf命令行的安装方式、代理镜像与依赖准备,说明项目初始化、热编译、交叉编译打包的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.17

20

15

GoFrame框架零基础入门
GoFrame框架零基础入门

本专题整理GoFrame框架的入门知识,从模块化设计理念、环境准备到跑通第一个Web服务,讲清目录分层、配置加载、日志与中间件的用法,并对比Gin、Go-Zero的差异,帮助Go开发者建立整体认知。

2026.11.17

20

15

SQLAlchemy 一对多关系怎么建立
SQLAlchemy 一对多关系怎么建立

SQLAlchemy 一对多关系怎么建立?本专题整理父子表外键、relationship 双向映射、关联查询、级联删除和加载优化等相关文章,帮助你理解并实现常见的 ORM 关系建模。

2026.11.17

20

10

SQLAlchemy 如何增删改查
SQLAlchemy 如何增删改查

SQLAlchemy 如何增删改查?本专题整理 ORM 新增记录、条件查询、更新和删除、Session 事务提交与批量处理等实用文章,帮助你掌握 Python 数据库操作流程。

2026.11.17

20

11

SQLAlchemy ORM 模型怎么写
SQLAlchemy ORM 模型怎么写

SQLAlchemy ORM 模型怎么写?本专题整理模型类定义、Mapped 字段映射、主键与约束、表结构创建和常见报错的相关文章,帮助你从基础配置到实际建模逐步掌握 SQLAlchemy。

2026.11.17

20

16

Go-Zero API开发使用教程
Go-Zero API开发使用教程

本专题聚焦Go-Zero的API开发,拆解.api描述文件的语法结构、路由与分组定义、参数绑定与校验规则,说明统一响应体、JWT鉴权、跨域与接口文档生成的落地方式,并给出网关聚合与接口测试的实践建议。

2026.11.12

180

15

Go-Zero安装与goctl环境配置教程
Go-Zero安装与goctl环境配置教程

本专题围绕Go-Zero的安装与工具链配置展开,讲清Go版本要求、goctl安装方式、代理镜像、protoc依赖与环境变量设置,说明多版本共存、升级回退与CI流水线安装的做法,并整理安装阶段的常见报错与验证步骤。

2026.11.12

120

15

Go-Zero零基础入门教程
Go-Zero零基础入门教程

本专题整理Go-Zero的入门知识,从框架定位、环境准备到跑通第一个API服务,讲清目录分层、配置加载、日志与中间件的基本用法,并对比Gin、Kratos的差异,帮助Go开发者建立整体认知,判断它是否适合当前项目。

2026.11.12

120

15

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
热门推荐
/
最新课程
phpStudy极速入门视频教程
phpStudy极速入门视频教程

共6课时 | 54.7万人学习

独孤九贱(4)_PHP视频教程
独孤九贱(4)_PHP视频教程

共89课时 | 134.3万人学习