/*
 * Copyright (c) 2001-2007, TIBCO Software Inc.
 * Use, modification, and distribution subject to terms of license.
 */
jsx3.require("jsx3.chart.Series","jsx3.chart.PointRenderer");jsx3.Class.defineClass("jsx3.chart.LineSeries",jsx3.chart.Series,null,function(c,h){var Dc=jsx3.vector;c.FORM_SEGMENT="segment";c.FORM_STEP="step";c.FORM_REVSTEP="reverseStep";c.FORM_HORIZONTAL="horizontal";c.FORM_VERTICAL="vertical";c.Ae={segment:1,step:1,reverseStep:1,horizontal:1,vertical:1};c.Xg=4;c.uz=function(o){this.series=o;};c.uz.prototype.render=function(e,l,d,k,f,a){var Mb=d-e;var mc=k-l;var cc=new Dc.Group(e,l,Mb,mc);var ob=this.series.qT();var _=new Dc.Line(0,0,0,Math.round(mc/2),Mb,Math.round(mc/2));_.setStroke(ob);cc.appendChild(_);var Ob=this.series.getPointRenderer();if(Ob!=null){var zc=Math.round(Mb/4);var Lc=this.series.B9();var Gc=this.series.b8();var Xb=Ob.render(zc,zc,Mb-zc,mc-zc,Lc,Gc);cc.appendChild(Xb);}return cc;};h.init=function(f,g){this.jsxsuper(f,g);this.xField=null;this.yField=null;this.form=c.FORM_SEGMENT;this.interpolateValues=jsx3.Boolean.FALSE;this.pointRadius=null;this.pointRenderer=null;this.pointFill=null;this.pointStroke=null;this.pointGradient=null;this.setTooltipFunction("jsx3.chart.LineSeries.tooltip");};h.getXField=function(){return this.xField;};h.setXField=function(r){this.xField=r;};h.getYField=function(){return this.yField;};h.setYField=function(e){this.yField=e;};h.getForm=function(){return this.form;};h.setForm=function(b){if(c.Ae[b]){this.form=b;}else{throw new jsx3.IllegalArgumentException("form",b);}};h.getInterpolateValues=function(){return this.interpolateValues;};h.setInterpolateValues=function(a){this.interpolateValues=a;};h.getPointRadius=function(){return this.pointRadius!=null?this.pointRadius:c.Xg;};h.setPointRadius=function(j){this.pointRadius=j;};h.getPointRenderer=function(){return this.d8("pointRenderer");};h.setPointRenderer=function(f){this.uR("pointRenderer",f);};h.getPointFill=function(){return this.pointFill;};h.setPointFill=function(a){this.pointFill=a;};h.getPointStroke=function(){return this.pointStroke;};h.setPointStroke=function(e){this.pointStroke=e;};h.getPointGradient=function(){return this.pointGradient;};h.setPointGradient=function(o){this.pointGradient=o;};h.B9=function(){var Z=this.Q0("LJ");if(Z==null)this.mG();return this.Q0("LJ");};h.b8=function(){var Ib=this.Q0("PY");if(Ib==null)this.mG();return this.Q0("PY");};h.mG=function(){var Gc=this.qT();var pb=Dc.Fill.valueOf(this.getPointFill());if(pb==null&&Gc!=null)pb=new Dc.Fill(Gc.getColor());if(pb!=null)pb=jsx3.chart.addGradient(pb,this.pointGradient);var Z=Dc.Stroke.valueOf(this.getPointStroke());this.xI("LJ",pb);this.xI("PY",Z);};h.updateView=function(){this.jsxsuper();var ub=this.l5();this.shape=new Dc.Shape(null,0,0,ub.getWidth(),ub.getHeight());this.shape.setId(this.getId()+"_line");ub.appendChild(this.shape);var K=this.qT();this.shape.setStroke(K);this.A3(this.shape);this.mG();var Z=null,Cc=null;var pb=this.Xs();for(var vb=0;vb<pb.length;vb++){var L=pb[vb];if(L==null)continue;var S=null,Y=null,tb=false;if(Z!=null){S=Z[1];Y=Z[2];tb=Cc==vb-1;}this.cf(vb,tb,L[0],L[1],L[2],L[3],S,Y);Z=L;Cc=vb;}};h.cf=function(q,l,p,b,k,g,f,o){var _=this.l5();var tb=this.shape;var xc=this.getPointRenderer();if(xc!=null){var R=this.getPointRadius();var gb=this.getColorFunction();var U=gb!=null?gb.call(null,p,g):this.B9();var O=xc.render(b-R,k-R,b+R,k+R,U,this.b8());O.setId(this.getId()+"_p"+q);this.A3(O,q,p.getAttribute("jsxid"));_.appendChild(O);var yb=this.getTooltipFunction();if(yb!=null)O.setToolTip(yb.call(null,this,p));}var Lc=q==0||!l&&!this.interpolateValues;if(Lc){tb.X6(b,k);}else{if(this.form==c.FORM_SEGMENT){tb.Z7(b,k);}else{if(this.form==c.FORM_HORIZONTAL){tb.X6(f,k).Z7(b,k);}else{if(this.form==c.FORM_VERTICAL){tb.X6(b,o).Z7(b,k);}else{if(this.form==c.FORM_STEP){tb.Z7(b,o).Z7(b,k);}else{if(this.form==c.FORM_REVSTEP){tb.Z7(f,k).Z7(b,k);}else{jsx3.chart.LOG.error("bad LineSeries form: "+this.form);}}}}}}};h.Xs=function(){var ac=this.Q0("VX");if(ac==null){ac=[];this.xI("VX",ac);}return ac;};h.PM=function(m,o,n,d){this.Xs().push([m,o,n,d]);};h.AS=function(o,m,l,f){this.Xs().push(null);};h.clear=function(){var bb=this.Xs();bb.splice(0,bb.length);};h.getXValue=function(a){if(this.xField)return jsx3.chart.asNumber(a.getAttribute(this.xField));return null;};h.getYValue=function(f){if(this.yField)return jsx3.chart.asNumber(f.getAttribute(this.yField));return null;};h.getLegendRenderer=function(){return new c.uz(this);};c.tooltip=function(j,p){var Gc=j.getXValue(p);var E=j.getYValue(p);return Gc!=null?"{"+Gc+","+E+"}":E;};h.toString=function(){return "[LineSeries '"+this.getName()+"']";};c.getVersion=function(){return jsx3.chart.q2;};});
