var DvtSparkChart=function(){};DvtObj.createSubclass(DvtSparkChart,DvtContainer,"DvtSparkChart");DvtSparkChart.newInstance=function(a,b,d,e){var g=new DvtSparkChart;g.Init(a,b,d,e);return g};
DvtSparkChart.prototype.Init=function(a,b,d,e){DvtSparkChart.superclass.Init.call(this,a);this._callback=b;this._callbackObj=d;this.setOptions(e);this._eventHandler=new DvtEventManager(a);this._eventHandler.addListeners(this);this._chart=DvtChart.newInstance(a,null,null);this.addChild(this._chart);this._tooltipMask=new DvtRect(a);this.addChild(this._tooltipMask);this.setId("sparkChart1000"+Math.floor(1E4*Math.random()))};
DvtSparkChart.prototype.setId=function(a){DvtSparkChart.superclass.setId.call(this,a);this._chart&&this._chart.setId(a+"chart")};DvtSparkChart.prototype.setOptions=function(a){this._options=DvtSparkChartDefaults.calcOptions(a);if(this.getContext()instanceof DvtXmlContext||this.getContext()instanceof DvtCanvasContext)this._options.animationOnDisplay="none",this._options.animationOnDataChange="none"};
DvtSparkChart.prototype.render=function(a,b,d){this._data=a?DvtJSONUtils.clone(a):this._data;DvtSparkChartRenderer.render(this,b,d);a=this.__getData().tooltip;this._tooltipMask.setWidth(b);this._tooltipMask.setHeight(d);this._tooltipMask.setFill(new DvtSolidFill("#FFFFFF",1.0E-4));a&&this._eventHandler.associate(this._tooltipMask,new DvtSimpleObjPeer(null,a,this._options.color));this.setAriaRole("img");this.setAriaProperty("label",a);this.getContext().queueRender()};
DvtSparkChart.prototype.__dispatchEvent=function(a){DvtEventDispatcher.dispatchEvent(this._callback,this._callbackObj,this,a)};DvtSparkChart.prototype.__getChart=function(){return this._chart};DvtSparkChart.prototype.__getData=function(){return this._data?this._data:{}};DvtSparkChart.prototype.__getOptions=function(){return this._options};var DvtSparkChartDefaults={};DvtObj.createSubclass(DvtSparkChartDefaults,DvtObj,"DvtSparkChartDefaults");
DvtSparkChartDefaults.VERSION_1={type:"line",animationOnDisplay:"none",animationOnDataChange:"none",emptyText:null,color:"#666699",firstColor:null,lastColor:null,highColor:null,lowColor:null,visualEffects:"auto",axisScaledFromBaseline:"off",barSpacing:"subpixel",__defaultMarkerSize:5};DvtSparkChartDefaults.calcOptions=function(a){var b=DvtSparkChartDefaults._getDefaults(a);return a?DvtJSONUtils.merge(a,b):b};DvtSparkChartDefaults._getDefaults=function(){return DvtJSONUtils.clone(DvtSparkChartDefaults.VERSION_1)};
var DvtSparkChartRenderer={};DvtObj.createSubclass(DvtSparkChartRenderer,DvtObj,"DvtSparkChartRenderer");DvtSparkChartRenderer._DEFAULT_MARKER_SHAPE="square";DvtSparkChartRenderer.render=function(a,b,d){var e=DvtSparkChartRenderer._convertDataObj(a),g=DvtSparkChartRenderer._convertOptionsObj(a.__getOptions());this._renderChart(a,e,g,b,d)};DvtSparkChartRenderer._getDataItems=function(a){return(a=a.__getData())&&a.items?a.items:[]};
DvtSparkChartRenderer._renderChart=function(a,b,d,e,g){var h=a.__getChart(),k=a.__getOptions();if("area"==k.type||"line"==k.type){var m=!1;if(k.firstColor||k.lastColor||k.highColor||k.lowColor)m=!0;else for(var a=DvtSparkChartRenderer._getDataItems(a),n=0;n<a.length;n++)if(a[n]&&a[n].markerDisplayed){m=!0;break}m&&(k=k.__defaultMarkerSize/2,e-=2*k,g-=2*k,h.setTranslateX(k),h.setTranslateY(k))}h.setOptions(d);h.render(b,e,g)};
DvtSparkChartRenderer._convertDataObj=function(a){for(var b=a.__getData(),d=a.__getOptions(),e="floatingBar"==d.type,g={},h=[],k=[],m=-1,n=-1,o=Number.NEGATIVE_INFINITY,q=Number.POSITIVE_INFINITY,a=DvtSparkChartRenderer._getDataItems(a),s=0;s<a.length;s++){var t=a[s],u={};if(t instanceof Object){u.y=t.value;t.date&&(u.x=t.date,g.timeAxisType="enabled");if(!0===t.markerDisplayed||"true"===t.markerDisplayed)u.markerDisplayed=!0,u.markerShape=DvtSparkChartRenderer._DEFAULT_MARKER_SHAPE;t.color&&(u.color=
t.color);e&&(t=t.floatValue,isNaN(t)&&(t=0),k.push(t))}else u.y=t,e&&k.push(0);h.push(u);o<u.y&&(o=u.y,m=s);q>u.y&&(q=u.y,n=s)}d.highColor&&0<=m&&(h[m].markerDisplayed=!0,h[m].color||(h[m].color=d.highColor));d.lowColor&&0<=n&&(h[n].markerDisplayed=!0,h[n].color||(h[n].color=d.lowColor));d.firstColor&&0<h.length&&(h[0].markerDisplayed=!0,h[0].color||(h[0].color=d.firstColor));d.lastColor&&0<h.length&&(h[h.length-1].markerDisplayed=!0,h[h.length-1].color||(h[h.length-1].color=d.lastColor));g.series=
[{data:h}];e&&g.series.splice(0,0,{data:k,color:"rgba(0, 0, 0, 0)"});b.referenceObjects&&(g.yAxis={referenceObjects:b.referenceObjects});"enabled"==b.timeAxisType&&(g.timeAxisType="enabled");return g};
DvtSparkChartRenderer._convertOptionsObj=function(a){var b={chart:{},styleDefaults:{},yAxis:{},__layout:{}};b.chart.__spark=!0;b.chart.__sparkBarSpacing=a.barSpacing;b.chart.type=a.type;b.chart.animationOnDataChange=a.animationOnDataChange;b.chart.animationOnDisplay=a.animationOnDisplay;b.chart.emptyText=a.emptyText;b.styleDefaults.colors=[a.color];b.styleDefaults.animationDuration=a.animationDuration;b.styleDefaults.animationIndicators="none";b.yAxis.scaledFromBaseline=a.axisScaledFromBaseline;b.__layout.maxBarWidth=
1;"floatingBar"==a.type&&(b.chart.type="bar",b.chart.stack="on");b.styleDefaults.seriesEffect="none"==a.visualEffects||"area"!=a.type?"color":"gradient";DvtSparkChartRenderer._applySparkAttrs(b,a);return b};
DvtSparkChartRenderer._applySparkAttrs=function(a,b){a.layout={gapRatio:0};a.legend={rendered:!1};a.xAxis=a.xAxis?a.xAxis:{};a.xAxis.tickLabel={rendered:!1};a.xAxis.axisLine={rendered:!1};a.xAxis.majorTick={rendered:!1};a.yAxis=a.yAxis?a.yAxis:{};a.yAxis.tickLabel={rendered:!1};a.yAxis.axisLine={rendered:!1};a.yAxis.majorTick={rendered:!1};a.styleDefaults=a.styleDefaults?a.styleDefaults:{};a.styleDefaults.lineWidth=1;a.styleDefaults.markerSize=b.__defaultMarkerSize;a.styleDefaults.seriesTooltipType=
"none";a.styleDefaults.groupTooltipType="none";a.styleDefaults.valueTooltipType="none";a.title=a.title?a.title:{};a.title.style="font-size: 12px; color: #404259;"};