📄 charting.ie.js
字号:
/* * Bindows 1.5 * http://www.bindows.net/ * Copyright (c) 2003-2005 MB Technologies * * Bindows(tm) belongs to MB Technologies (Georgia, USA). All rights reserved. * You are not allowed to copy or modify this code. Commercial use requires * license. */function BiGraphBase(){if(_biInPrototype)return;BiComponent.call(this);this._series=[];this._charts={};this._categories=[];this._seriesMap={};this._categoriesMap={};this._points={};this._presentationManager=new BiChartPresentationManager(this);this._chartPresentations={};this.setSize(300,200);this.setForeColor("black");this.addEventListener("click",this._onMouseEvent);this.addEventListener("mousedown",this._onMouseEvent);this.addEventListener("mouseup",this._onMouseEvent);this.addEventListener("mouseover",this._onMouseEvent);this.addEventListener("mouseout",this._onMouseEvent);this.addEventListener("mousemove",this._onMouseEvent);this.addEventListener("dblclick",this._onMouseEvent);this.addEventListener("contextmenu",this._onMouseEvent);this.addEventListener("mousewheel",this._onMouseEvent);};_p=_biExtend(BiGraphBase,BiComponent,"BiGraphBase");_p._chartType="column"
_p._xAxis=null;_p._yAxis=null;_p._gridLines=null;_p._chartArea=null;_p._chartAreaLeft=100;_p._chartAreaTop=100;_p._chartAreaWidth=800;_p._chartAreaHeight=800;_p._autoScale=false;_p._scaleFactor=null;_p._catScaleFactor=null;BiGraphBase.prototype.getPresentationManager=function(){return this._presentationManager;};BiGraphBase.prototype.getChartArea=function(){return this._chartArea;};BiGraphBase.prototype.getValueAxis=function(){return this._valueAxis;};BiGraphBase.prototype.getCategoryAxis=function(){return this._categoryAxis;};BiGraphBase.prototype.getGridLines=function(){return this._gridLines;};BiGraphBase.prototype.getLegend=function(){return this._legend;};BiGraphBase.prototype.getAutoScale=function(){return this._autoScale;};_p.getGrid=function(){return this._gridComponent;};_p.setAutoScale=function(b)
{}
_p._scaleFont=function(){if(this._autoScale)
{this.setFontSize(Math.min(this.getClientWidth(),this.getClientHeight())/25);}};_p.setFontSize=function(n)
{this._valueAxis.setFontSize(n);this._categoryAxis.setFontSize(n);this._legend.setFontSize(n);};_p.getFontSize=function()
{var s1=this._valueAxis.getFontSize();var s2=this._categoryAxis.getFontSize();var s3=this._legend.getFontSize();if(s1==s2&&s2==s3)
return s1;return null;};_p.addSeries=function(oSeries){var id=oSeries.getId();this._series.push(oSeries);this._seriesMap[id]=oSeries;oSeries._index=this._series.length-1;this._chartPresentations[id]=new BiChartPresentation(this,oSeries);};_p.removeSeries=function(oSeries){this._series.remove(oSeries);delete this._seriesMap[oSeries.getId()];var chart=this.getChartForSeries(oSeries);this._removeChart(chart);oSeries._index=null;for(var i=0;i<this._series.length;i++)
this._series[i]._index=i;};_p.clearSeries=function(){for(var i=0;i<this._series.length;i++)
this._series[i]._index=null;this._series=[];this._seriesMap={};};_p.getSeriesById=function(sId){return this._seriesMap[sId];};BiGraphBase.prototype.getSeries=function(){return this._series;};_p.setSeries=function(aSeries){this.clearSeries();for(var i=0;i<aSeries.length;i++)
this.addSeries(aSeries[i]);};_p.addCategory=function(oCategory){this._categories.push(oCategory);this._categoriesMap[oCategory.getId()]=oCategory;oCategory._index=this._categories.length-1;};_p.removeCategory=function(oCategory){this._categories.remove(oCategory);delete this._categoriesMap[oCategory.getId()];for(var i=0;i<this._categories.length;i++)
this._categories[i]._index=i;};_p.clearCategories=function(){for(var i=0;i<this._categories.length;i++)
this._categories[i]._index=null;this._categories=[];this._categoriesMap={};};_p.getCategoryById=function(sId){return this._categoriesMap[sId];};BiGraphBase.prototype.getCategories=function(){return this._categories;};_p.setCategories=function(aCategories){this.clearCategories();for(var i=0;i<aCategories.length;i++)
this.addCategory(aCategories[i]);};_p.addPoint=function(oPoint){var sId=oPoint.getSeriesId();var cId=oPoint.getCategoryId();if(this._points[sId]==null)
this._points[sId]={};this._points[sId][cId]=oPoint;};_p.removePoint=function(oPoint){var sId=oPoint.getSeriesId();var cId=oPoint.getCategoryId();if(this._points[sId]==null)
return;delete this._points[sId][cId];};_p.clearPoints=function(){this._points={};};_p.getPointByIds=function(sSeriesId,sCategoryId){if(this._points[sSeriesId])
return this._points[sSeriesId][sCategoryId];return null;};_p.getPoints=function(){var res=[];for(var sId in this._points){for(var cId in this._points[sId])
res.push(this._points[sId][cId]);}
return res;};_p.setPoints=function(aPoints){this.clearPoints();for(var i=0;i<aPoints.length;i++)
this.addPoint(aPoints[i]);};_p.getComponentByIds=function(sSeriesId,sCategoryId){var c=this._charts[sSeriesId];if(!c)return null;return c.getComponentByCategoryId(sCategoryId);};_p.getChartPresentation=_p.getChartPresentationBySeriesId=function(sSeriesId){return this._chartPresentations[sSeriesId];};BiGraphBase.prototype.getChartType=function(){return this._chartType;};_p.setChartType=function(sType){if(this._chartType!=sType){this._chartType=sType;this._currentColorIndex=0;this._syncChartForSeries();}};_p.getCharts=function(){var res=[];for(var sId in this._charts)
res.push(this._charts[sId]);return res;};_p.getChartForSeries=function(oSeries){var id=oSeries.getId();return this._charts[id];};_p._syncChartForSeries=function(){var sType=this.getChartType();this._removeAllCharts();if(sType!="grid"){if(this._gridComponent){this.remove(this._gridComponent);this._gridComponent.dispose();this._gridComponent=null;}
var l=sType=="pie"?1:this._series.length;for(var i=0;i<l;i++)
this._createChartFromSeries(this._series[i]);}
else{if(!this._gridComponent){this._gridComponent=new BiGridChart(this);this._gridComponent.setLocation(0,0);this._gridComponent.setRight(0);this._gridComponent.setBottom(0);this._gridComponent.setBorder(new BiBorder(0));this.add(this._gridComponent);}}};_p._removeChart=function(oChart){var id=oChart.getSeries().getId();this._chartArea.remove(oChart);delete this._charts[id];oChart.dispose();};_p._removeAllCharts=function(){for(var id in this._charts){this._chartArea.remove(this._charts[id]);this._charts[id].dispose()
delete this._charts[id];}};_p.dispose=function(){if(this._disposed)return;BiComponent.prototype.dispose.call(this);var i,j;for(var i=this._series.length-1;i>=0;i--)
this._series[i].dispose();for(i=this._categories.length-1;i>=0;i--)
this._categories[i].dispose();for(i in this._seriesMap)
this._seriesMap[i].dispose();for(i in this._categoriesMap)
this._categoriesMap[i].dispose();for(i in this._points){for(j in this._points[i])
this._points[i][j].dispose();}
for(i in this._charts)
this._charts[i].dispose();for(i in this._chartPresentations)
this._chartPresentations[i].dispose();this._presentationManager.dispose();this._points=null;this._chartPresentations=null;this._charts=null;this._series=null;this._seriesMap=null;this._categories=null;this._categoriesMap=null;this._gridComponent=null;this._chartArea=null;this._valueAxis=null;this._categoryAxis=null;this._legend=null;this._contentArea=null;this._gridLines=null;};_p._getCategoryOnXAxis=function(){switch(this._chartType){case"bar":case"stackedbar":case"percentagestackedbar":return false;default:return true;}};_p._getStackedChart=function(){switch(this._chartType){case"stackedcolumn":case"stackedbar":case"percentagestackedcolumn":case"percentagestackedbar":return true;default:return false;}};_p._getPercentageStack=function(){switch(this._chartType){case"percentagestackedcolumn":case"percentagestackedbar":return true;default:return false;}};_p._getSupportsValueAxis=function(){var cs=this.getCharts();if(cs.length==0)
return false;return cs[0].getSupportsValueAxis();};_p._getSupportsCategoryAxis=function(){var cs=this.getCharts();if(cs.length==0)
return false;return cs[0].getSupportsCategoryAxis()};_p._getSupportsGridLines=function(){var cs=this.getCharts();if(cs.length==0)
return false;return cs[0].getSupportsGridLines()};_p._updateCharts=function(){for(var id in this._charts)
this._charts[id]._updateChart();};_p.update=function()
{};_p.updatePoint=function(sSeriesId,sCategoryId){if(this.getChartType()=="grid"){if(!this._gridComponent)return;var c=this._gridComponent.getCellByIds(sSeriesId,sCategoryId);if(c)
c.update();else{var r=this._gridComponent.getRowById(sSeriesId);if(r)
r.update();}}
else{var c=this.getChartForSeries(this.getSeriesById(sSeriesId));if(!c)return;if(sCategoryId!=null)
c._updateValueByCategoryId(sCategoryId);else c._updateValues();}};_p.fromXmlDocument=function(oDoc){this._removeAllCharts();this.clearCategories();this.clearSeries();var docEl=oDoc.documentElement;var title=docEl.selectSingleNode("Title");title=title?title.text:null;var dataEl=docEl.selectSingleNode("Data");var presentationEl=docEl.selectSingleNode("Presentation");var categories=dataEl.selectNodes("Categories/Category");var l=categories.length;for(var i=0;i<l;i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -