⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charting.moz.js

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 JS
📖 第 1 页 / 共 5 页
字号:
this.addCategory(BiChartCategory.fromXmlElement(this,categories[i]));var series=dataEl.selectNodes("SeriesGroup/Series");var l=series.length;for(var i=0;i<l;i++)
this.addSeries(BiChartSeries.fromXmlElement(this,series[i]));var presentation=docEl.selectSingleNode("Presentation");this.setChartType(presentation.getAttribute("Type")||"line");var chartArea=presentation.selectSingleNode("ChartArea");if(chartArea)
this._chartArea.fromXmlElement(chartArea);var points=presentation.selectNodes("Points/Point");var l=points.length;for(var i=0;i<l;i++){this.addPoint(BiChartPoint.fromXmlElement(this,points[i]));}
var charts=presentation.selectNodes("Charts/Chart");l=charts.length;var cp;for(var i=0;i<l;i++){cp=BiChartPresentation.fromXmlElement(this,charts[i]);if(cp)
this._chartPresentations[cp.getSeries().getId()]=cp;}
var legend=presentation.selectSingleNode("Legend");if(legend)
this._legend.fromXmlElement(legend);var valueAxis=presentation.selectSingleNode("Axes/ValueAxis");if(valueAxis)
this._valueAxis.fromXmlElement(valueAxis);var categoryAxis=presentation.selectSingleNode("Axes/CategoryAxis");if(categoryAxis)
this._categoryAxis.fromXmlElement(categoryAxis);var gridLines=presentation.selectSingleNode("GridLines");if(gridLines){this._gridLines.fromXmlElement(gridLines);}};_p.toXmlDocument=function(){var doc=new BiXmlDocument();doc.loadXML("<Graph><Data><Categories/><SeriesGroup/></Data><Presentation/></Graph>");var docEl=doc.documentElement;var categoriesEl=docEl.firstChild.firstChild;for(var i=0;i<this._categories.length;i++)
categoriesEl.appendChild(this._categories[i].toXmlElement(doc));var seriesGroupEl=docEl.firstChild.lastChild;for(var i=0;i<this._series.length;i++)
seriesGroupEl.appendChild(this._series[i].toXmlElement(doc));var presentationEl=docEl.lastChild;presentationEl.setAttribute("Type",this.getChartType());presentationEl.appendChild(this._legend.toXmlElement(doc));var axesEl=doc.createElement("Axes");presentationEl.appendChild(axesEl);axesEl.appendChild(this._valueAxis.toXmlElement(doc));axesEl.appendChild(this._categoryAxis.toXmlElement(doc));presentationEl.appendChild(this._gridLines.toXmlElement(doc));presentationEl.appendChild(this._chartArea.toXmlElement(doc));var points=this.getPoints();var pointsEl=doc.createElement("Points");for(var i=0;i<points.length;i++)
pointsEl.appendChild(points[i].toXmlElement(doc));presentationEl.appendChild(pointsEl);var chartsEl=doc.createElement("Charts");for(var id in this._chartPresentations)
chartsEl.appendChild(this._chartPresentations[id].toXmlElement(doc));presentationEl.appendChild(chartsEl);return doc;};_p._onMouseEvent=function(e){var c=e.getTarget();while(c!=null&&c!=this&&(typeof c.getSeries!="function"||typeof c.getCategory!="function"))
c=c.getParent();if(c==this||c==null)
return;var sType="point"+e.getType();var ce=new BiChartMouseEvent(sType,e._event,c.getSeries(),c.getCategory());this.dispatchEvent(ce);ce.dispose();};_p.getContextMenuForPoint=function(oSeries,oCategory){return null;};_p.getToolTipForPoint=function(oSeries,oCategory){var tt=BiToolTip.getTextToolTip("Series \""+oSeries.getTitle()+"\" Category \""+oCategory.getTitle()+"\"\nValue: "+oSeries.getValueByCategoryId(oCategory.getId()));tt.setHideInterval(600*1000);return tt;};function BiChartCategory(oGraph,sId,sTitle){if(_biInPrototype)return;BiObject.call(this);this._graph=oGraph;this._id=sId;if(sTitle)this._title=sTitle;};_p=_biExtend(BiChartCategory,BiObject,"BiChartCategory");_p._id=null;_p._title="";_p._index=null;BiChartCategory.prototype.getId=function(){return this._id;};BiChartCategory.prototype.getTitle=function(){return this._title;};BiChartCategory.prototype.setTitle=function(v){this._title=v;};BiChartCategory.prototype.getIndex=function(){return this._index;};BiChartCategory.fromXmlElement=function(oGraph,oNode){var cat=new BiChartCategory(oGraph);cat.fromXmlElement(oNode);return cat;};_p.fromXmlElement=function(oNode){var id=oNode.getAttribute("Id");var title=oNode.selectSingleNode("Title");title=title?title.text:null;this._id=id;this._title=title;};_p.toXmlElement=function(oDoc){var category=oDoc.createElement("Category");category.setAttribute("Id",this.getId());if(this.getTitle()){var titleEl=oDoc.createElement("Title");titleEl.appendChild(oDoc.createTextNode(this.getTitle()));category.appendChild(titleEl);}
return category;};_p.dispose=function(){if(this._disposed)return;this._graph=null;};function BiChartSeries(oGraph,sId,sTitle,oValues){if(_biInPrototype)return;BiObject.call(this);this._graph=oGraph;this._id=sId;this._categoryValueMap={};if(sTitle)this._title=sTitle;if(oValues)this.setValues(oValues);}
_p=_biExtend(BiChartSeries,BiObject,"BiChartSeries");_p._title="";_p._cachedSum=null;_p._cachedAbsSum=null;_p._cachedValues=null;_p._cachedMaximumValue=null;_p._cachedMinimumValue=null;BiChartSeries.fromXmlElement=function(oGraph,oNode){var series=new BiChartSeries(oGraph);series.fromXmlElement(oNode);return series;};_p.fromXmlElement=function(oNode){var id=oNode.getAttribute("Id");var title=oNode.selectSingleNode("Title");title=title?title.text:null;this._id=id;this._title=title;var	values=oNode.selectNodes("Values/Value");var l=values.length;var catId;for(var i=0;i<l;i++){catId=values[i].getAttribute("Category");this.setValueByCategoryId(catId,Number(values[i].text));}};_p.toXmlElement=function(oDoc){var series=oDoc.createElement("Series");series.setAttribute("Id",this.getId());if(this.getTitle()){var titleEl=oDoc.createElement("Title");titleEl.appendChild(oDoc.createTextNode(this.getTitle()));series.appendChild(titleEl);}
var valuesEl=oDoc.createElement("Values");var valueEl;for(var catId in this._categoryValueMap){valueEl=oDoc.createElement("Value");valueEl.setAttribute("Category",catId);valueEl.appendChild(oDoc.createTextNode(this._categoryValueMap[catId].toString()));valuesEl.appendChild(valueEl);}
series.appendChild(valuesEl);return series;};BiChartSeries.prototype.getTitle=function(){return this._title;};BiChartSeries.prototype.setTitle=function(v){this._title=v;};BiChartSeries.prototype.getId=function(){return this._id;};BiChartSeries.prototype.getIndex=function(){return this._index;};_p.getValueByCategory=function(oCategory){return this.getValueByCategoryId(oCategory.getId());};_p.setValueByCategory=function(oCategory,nValue){this.setValueByCategoryId(oCategory.getId(),nValue);};_p.getValueByCategoryId=function(sCatId){var v=this._categoryValueMap[sCatId];return isNaN(v)?null:v;};_p.setValueByCategoryId=function(sCatId,nValue){this._clearCache();if(nValue==null||isNaN(nValue))
delete this._categoryValueMap[sCatId];else this._categoryValueMap[sCatId]=nValue;};_p.setValues=function(aValues){var cats=this._graph.getCategories();var l=cats.length;var id;this._values=new Array(l);for(var i=0;i<l;i++){id=cats[i].getId();if(aValues[i]==null||isNaN(aValues[i]))
delete this._categoryValueMap[id];else this._categoryValueMap[id]=aValues[i];}
this._clearCache();};_p.getValues=function(){if(this._cachedValues!=null)return this._cachedValues;var cats=this._graph.getCategories();var l=cats.length;var res=new Array(l);var v;for(var i=0;i<l;i++){v=this._categoryValueMap[cats[i].getId()];res[i]=isNaN(v)?null:v;}
return this._cachedValues=res;};_p.getValueByIndex=function(i){var cat=this._graph.getCategories()[i]
return cat?this.getValueByCategory(cat):null;};_p.setValueByIndex=function(i,nValue){var cat=this._graph.getCategories()[i];if(cat)
this.setValueByCategory(cat,nValue)};_p.getMaximumValue=function(){if(this._cachedMaximumValue!=null)return this._cachedMaximumValue;return this._cachedMaximumValue=Math.max.apply(null,this.getValues());};_p.getMinimumValue=function(){if(this._cachedMinimumValue!=null)return this._cachedMinimumValue;return this._cachedMinimumValue=Math.min.apply(null,this.getValues());};_p.getSum=function(){if(this._cachedSum!=null)
return this._cachedSum;var sum=0;for(var id in this._categoryValueMap)
sum+=this._categoryValueMap[id];return this._cachedSum=sum;};_p.getAbsSum=function(){if(this._cachedAbsSum!=null)
return this._cachedAbsSum;var sum=0;for(var id in this._categoryValueMap)
sum+=Math.abs(this._categoryValueMap[id]);return this._cachedAbsSum=sum;};_p.dispose=function(){if(this._disposed)return;for(var id in this._categoryValueMap)
delete this._categoryValueMap[id];this._categoryValueMap=null;this._clearCache();};_p._clearCache=function(){this._cachedSum=null;this._cachedAbsSum=null;this._cachedValues=null;this._cachedMaximumValue=null;this._cachedMinimumValue=null;};function BiGridChart(oGraph){if(_biInPrototype)return;BiGrid.call(this);this._graph=oGraph;this._rowsById={};this._cellsById={};this._fromGraph();this.setShowRowHeaders(true);this.setSelectionMode("cell");this.setRowHeadersWidth(70);}
_p=_biExtend(BiGridChart,BiGrid,"BiGridChart");BiGridChart.prototype.getGraph=function(){return this._graph;};_p._fromGraph=function(){var cats=this._graph.getCategories();this.setColumnCount(cats.length);var columnNames=[];var columnWidths=[];var columnAligns=[];for(var i=0;i<cats.length;i++){columnNames[i]=cats[i].getTitle();columnWidths[i]=50;columnAligns[i]="right";}
this.setColumnNames(columnNames);this.setColumnWidths(columnWidths);this.setColumnAligns(columnAligns);var series=this._graph.getSeries();var data,row,cell,sId,catId;for(var i=0;i<series.length;i++){sId=series[i].getId();row=new BiGridChartRow(this._graph,sId);this.addRow(row);this._cellsById[sId]={};this._rowsById[sId]=row;for(var j=0;j<cats.length;j++){catId=cats[j].getId();cell=new BiGridChartCell(this._graph,sId,catId);row.addCell(cell);this._cellsById[sId][catId]=cell;}}};_p.getRowById=function(sSeriesId){return this._rowsById[sSeriesId];};_p.getCellByIds=function(sSeriesId,sCategoryId){return this._cellsById[sSeriesId][sCategoryId];};_p.dispose=function(){if(this._disposed)return;BiGrid.prototype.dispose.call(this);this._graph=null;for(var i in this._rowsById)
delete this._rowsById[i];this._rowsById=null;for(var i in this._cellsById){for(var j in this._cellsById[i])
delete this._cellsById[i][j];delete this._cellsById[i]}
this._cellsById=null;}
function BiGridChartRow(oGraph,sSeriesId){if(_biInPrototype)return;BiGridRow.call(this)
this._graph=oGraph;this._seriesId=sSeriesId;};_p=_biExtend(BiGridChartRow,BiGridRow,"BiGridChartRow");BiGridChartRow.prototype.getGraph=function(){return this._graph;};BiGridChartRow.prototype.getSeriesId=function(){return this._seriesId;};_p.getRowHeaderLabelHtml=function(){return this._graph.getSeriesById(this._seriesId).getTitle();};_p.dispose=function(){if(this._disposed)return;BiGridCell.prototype.dispose.call(this);this._graph=null;};function BiGridChartCell(oGraph,sSeriesId,sCategoryId){if(_biInPrototype)return;BiGridCell.call(this)
this._graph=oGraph;this._seriesId=sSeriesId;this._categoryId=sCategoryId;};_p=_biExtend(BiGridChartCell,BiGridCell,"BiGridChartCell");BiGridChartCell.prototype.getGraph=function(){return this._graph;};BiGridChartCell.prototype.getSeriesId=function(){return this._seriesId;};BiGridChartCell.prototype.getCategoryId=function(){return this._categoryId;};_p.getData=function(){return this._graph.getSeriesById(this._seriesId).getValueByCategoryId(this._categoryId);};_p.getLabelHtml=function(){var v=this.getData();return v!=null?v:"&nbsp;";};_p.dispose=function(){if(this._disposed)return;BiGridCell.prototype.dispose.call(this);this._graph=null;};function BiChartLegend(oGraph){if(_biInPrototype)return;BiComponent.call(this);this._graph=oGraph;this.setSize(50,20);this.setRight(10);this.setBorder(new BiBorder(1,"solid","black"));this.setBackColor("white");};_p=_biExtend(BiChartLegend,BiComponent,"BiChartLegend");_p._fontSize=11;_p._topSet=false;BiChartLegend.prototype.getGraph=function(){return this._graph;};BiChartLegend.prototype.getFontSize=function(){return this._fontSize;};_p.layoutComponent=function()
{this.__layoutComponent();BiComponent.prototype.layoutComponent.call(this);};_p.__layoutComponent=function()
{if(this.getCreated())
{var ph=this.getPreferredHeight();this.setSize(this.getPreferredWidth(),this.getPreferredHeight());if(!this._topSet)
this._setTop((this.getParent().getClientHeight()-ph)/2);}};_p._update=function()
{if(!this.getCreated())
return;var cs=this.getChildren();var tmp;for(var i=cs.length-1;i>=0;i--){tmp=cs[i];this.remove(tmp);tmp.dispose();}
if(!this.getVisible())
return;var items;if(this._graph.getChartType()=="pie")
items=this._graph.getCharts()[0].getChildren();else items=this._graph.getCharts();var l=items.length;for(i=0;i<l;i++)
{label=new BiChartLegendLabel(items[i]);label.setStyleProperty("fontSize",this._fontSize+"px");this.add(label);}
this.__layoutComponent();if(BiBrowserCheck.ie)
this.__layoutComponent();this.layoutAllChildren();};_p.__layoutChildren=function()
{if(!this.getCreated())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -