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

📄 charting.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
    this.setSize(1000, 1000);    this._labels = [];};var _p = BiChartCategoryAxis.prototype = new BiComponent;_p._className = "BiChartCategoryAxis";_p._tagName = "v:group";_p._axisBetweenCategories = true;_p._desiredVisible = true;_p._majorTickInterval = null;_p._minorTickInterval = null;_p._showMajorTicks = true;_p._showMinorTicks = true;_p._showLabels = true;_p._fontSize = 11;BiChartCategoryAxis.prototype.setMajorTickInterval = function(v){    this._majorTickInterval = v;} ;BiChartCategoryAxis.prototype.setMinorTickInterval = function(v){    this._minorTickInterval = v;} ;BiChartCategoryAxis.prototype.getShowMajorTicks = function(){    return this._showMajorTicks;} ;BiChartCategoryAxis.prototype.setShowMajorTicks = function(v){    this._showMajorTicks = v;} ;BiChartCategoryAxis.prototype.getShowMinorTicks = function(){    return this._showMinorTicks;} ;BiChartCategoryAxis.prototype.setShowMinorTicks = function(v){    this._showMinorTicks = v;} ;BiChartCategoryAxis.prototype.getShowLabels = function(){    return this._showLabels;} ;BiChartCategoryAxis.prototype.setShowLabels = function(v){    this._showLabels = v;} ;BiChartCategoryAxis.prototype.getAxisBetweenCategories = function(){    return this._axisBetweenCategories;} ;BiChartCategoryAxis.prototype.setAxisBetweenCategories = function(v){    this._axisBetweenCategories = v;} ;BiChartCategoryAxis.prototype.getFontSize = function(){    return this._fontSize;} ;_p.getMaximum = function(){    var l = this._graph.getCategories().length;    if (this._axisBetweenCategories)        return l;    return l - 1;};_p.getMinimum = function(){    return 0;} ;_p.getMajorTickInterval = function(){    if (this._majorTickInterval != null)        return this._majorTickInterval;    return 1;};_p.getMinorTickInterval = function(){    if (this._minorTickInterval != null)        return this._minorTickInterval;    return this.getMajorTickInterval() / 2;};_p.dispose = function(){    if (this._disposed)        return;    BiComponent.prototype.dispose.call(this);    this._graph = null;    for (var i = 0; i < this._labels.length; i++)        this._labels[i] = null;    this._labels = null;    this._majorTicks = null;    this._minorTicks = null;    this._axisLine = null;};_p._updateCoordSize = function(sCoordSize, sCoordOrigin){    var p = sCoordSize.split(",")    var w = Number(p[0]), h = Number(p[1]);    p = sCoordOrigin.split(",")    var x = Number(p[0]), y = Number(p[1]);    this._coordSize = this._graph._getCategoryOnXAxis() ? h : w;    this.setHtmlProperty("coordsize", sCoordSize);    this._majorTicks.setHtmlProperty("coordsize", sCoordSize);    this._minorTicks.setHtmlProperty("coordsize", sCoordSize);    this._axisLine.setHtmlProperty("coordsize", sCoordSize);    this.setHtmlProperty("coordorigin", sCoordOrigin);    this._majorTicks.setHtmlProperty("coordorigin", sCoordOrigin);    this._minorTicks.setHtmlProperty("coordorigin", sCoordOrigin);    this._axisLine.setHtmlProperty("coordorigin", sCoordOrigin);    this._minorTicks.setLocation(x, y);    this._minorTicks.setSize(w, h);    this._majorTicks.setLocation(x, y);    this._majorTicks.setSize(w, h);    this._axisLine.setLocation(x, y);    this._axisLine.setSize(w, h);    this._updateMajorTicks();    this._updateMinorTicks();    this._updateAxisLine();    this._updateLabels();};_p._updateAxisLine = function(){    var y0 = 0;    var max = this._graph._categoryAxis.getMaximum() * this._graph._catScaleFactor;    var min = 0;    var onX = this._graph._getCategoryOnXAxis();    if (onX)        this._axisLine.setHtmlProperty("path", "m " + min + "," + y0 + " l " + max + "," + y0);    else        this._axisLine.setHtmlProperty("path", "m " + y0 + "," + min + " l " + y0 + "," + max);};_p._updateMajorTicks = function(){    if (this._showMajorTicks)    {        var y0 = 0;        var y1 = Math.round(y0 - 0.01 * this._coordSize);        var major = this._graph._categoryAxis.getMajorTickInterval();        var catMax = this._graph._categoryAxis.getMaximum();        var sb = [];        var x = 0;        var onX = this._graph._getCategoryOnXAxis();        var x2;        while (x <= catMax)        {            x2 = Math.round(x * this._graph._catScaleFactor);            if (onX)                sb.push("m " + x2 + "," + y0 + " l " + x2 + "," + y1);            else                sb.push("m " + y0 + "," + x2 + " l " + y1 + "," + x2);            x += major;            x = Math.round(x / major) * major;        }        this._majorTicks.setHtmlProperty("path", sb.join("") + "e");    }};_p._updateMinorTicks = function(){    if (this._showMinorTicks)    {        var y0 = 0;        var y1 = Math.round(y0 - 0.005 * this._coordSize);        var minor = this._graph._categoryAxis.getMinorTickInterval();        var catMax = this._graph._categoryAxis.getMaximum();        var sb = [];        var x = minor;        var onX = this._graph._getCategoryOnXAxis();        var x2;        while (x < catMax)        {            x2 = Math.round(x * this._graph._catScaleFactor);            if (onX)                sb.push("m " + x2 + "," + y0 + " l " + x2 + "," + y1);            else                sb.push("m " + y0 + "," + x2 + " l " + y1 + "," + x2);            x += minor;            x = Math.round(x / minor) * minor;        }        this._minorTicks.setHtmlProperty("path", sb.join("") + "e");    }};_p._updateLabels = function(){    if (!this._created)        return;    var tmp;    for (var i = this._labels.length - 1; i >= 0; i--)    {        tmp = this._labels[i];        this.remove(tmp);        tmp.dispose();    }    this._labels = [];    if (this._showLabels)    {        var y0 = Math.round(this._graph._valueAxis.getMinimum() * this._graph._scaleFactor);        var y1 = y0 + this._coordSize;        var major = this._graph._categoryAxis.getMajorTickInterval();        var catMax = this._graph._categoryAxis.getMaximum();        var x = this._axisBetweenCategories ? 0.5 : 0;        var cats = this._graph.getCategories();        var x2, l;        var onX = this._graph._getCategoryOnXAxis();        while (x <= catMax)        {            x2 = Math.round(x * this._graph._catScaleFactor);            l = new BiVmlLabel(cats[Math.floor(x)].getTitle());            l.setFontSize(this._fontSize);            if (onX)            {                l.setLocation(x2, -.04 * this._coordSize);                l.setAlign("center");            }            else            {                l.setLocation(-.02 * this._coordSize, x2);                l.setAlign("right");            }            this.add(l);            this._labels.push(l);            x += major;        }    }};_p.setFontSize = function(n){    this._fontSize = n;    for (var i = 0; i < this._labels.length; i++)        this._labels[i].setFontSize(n);};_p.setVisible = function(b){    this._desiredVisible = b;    BiComponent.prototype.setVisible.call(this, b && this._graph._getSupportsCategoryAxis());};_p.getVisible = function(){    return this._desiredVisible;} ;_p._updateVisible = function(){    this.setVisible(this._desiredVisible);} ;BiChartCategoryAxis.fromXmlElement = function(oGraph, oNode){    var ax = new BiChartCategoryAxis(oGraph);    ax.fromXmlElement(oNode);    return ax;};_p.fromXmlElement = function(oNode){    var s = oNode.getAttribute("Visible");    if (s)        this.setVisible(s != "false");    s = oNode.getAttribute("ShowMajorTicks");    if (s)        this.setShowMajorTicks(s != "false");    s = oNode.getAttribute("ShowMinorTicks");    if (s)        this.setShowMinorTicks(s == "true");    s = oNode.getAttribute("ShowLabels");    if (s)        this.setShowLabels(s != "false");    s = oNode.getAttribute("MajorTickInterval");    if (s)        this.setMajorTickInterval(Number(s));    s = oNode.getAttribute("MinorTickInterval");    if (s)        this.setMinorTickInterval(Number(s));    s = oNode.getAttribute("AxisBetweenCategories");    if (s)        this.setAxisBetweenCategories(s != "false");};_p.toXmlElement = function(oDoc){    var el = oDoc.createElement("CategoryAxis");    el.setAttribute("Visible", String(this._desiredVisible));    if (this._showMajorTicks != null)        el.setAttribute("ShowMajorTicks", String(this._showMajorTicks));    if (this._showMinorTicks != null)        el.setAttribute("ShowMinorTicks", String(this._showMinorTicks));    if (this._majorTickInterval != null)        el.setAttribute("MajorTickInterval", String(this._majorTickInterval));    if (this._minorTickInterval != null)        el.setAttribute("MinorTickInterval", String(this._minorTickInterval));    return el;};function BiChartGridLines(oGraph){    BiComponent.call(this);    this._graph = oGraph;    this.setStyleProperty("antialias", "false");    BiGraph._vmlComponent1000(this);    this._minorCategory = BiGraph._createVmlElement();    this._minorValue = BiGraph._createVmlElement();    this._majorCategory = BiGraph._createVmlElement();    this._majorValue = BiGraph._createVmlElement();    BiGraph._vmlComponent1000(this._minorCategory);    BiGraph._vmlComponent1000(this._minorValue);    BiGraph._vmlComponent1000(this._majorCategory);    BiGraph._vmlComponent1000(this._majorValue);    this._minorCategory.setVisible(this.getShowMinorCategory());    this._minorValue.setVisible(this.getShowMinorValue());    this._majorCategory.setVisible(this.getShowMajorCategory());    this._majorValue.setVisible(this.getShowMajorValue());    this._minorCategory.setHtmlProperty("strokecolor", this.getMinorCategoryStrokeColor());    this._minorValue.setHtmlProperty("strokecolor", this.getMajorCategoryStrokeColor());    this._majorCategory.setHtmlProperty("strokecolor", this.getMinorValueStrokeColor());    this._majorValue.setHtmlProperty("strokecolor", this.getMajorValueStrokeColor());    this.add(this._minorCategory);    this.add(this._minorValue);    this.add(this._majorCategory);    this.add(this._majorValue);};var _p = BiChartGridLines.prototype = new BiComponent;_p._className = "BiChartGridLines";_p._tagName = "v:group";BiChartGridLines.prototype.getGraph = function(){    return this._graph;} ;_p._desiredVisible = true;_p._showMinorCategory = null;_p._showMinorValue = null;_p._showMajorCategory = null;_p._showMajorValue = null;_p._minorCategoryStrokeColor = null;_p._majorCategoryStrokeColor = null;_p._minorValueStrokeColor = null;_p._majorValueStrokeColor = null;_p.setShowMinorValue = function(b){    if (this._showMinorValue != b)    {        this._showMinorValue = b;        this._updateMinorValue();        this._minorValue.setVisible(b);    }};_p.setShowMajorValue = function(b){    if (this._showMajorValue != b)    {        this._showMajorValue = b;        this._updateMajorValue();        this._majorValue.setVisible(b);    }};_p.setShowMinorCategory = function(b){    if (this._showMinorCategory != b)    {        this._showMinorCategory = b;        this._updateMinorCategory();        this._minorCategory.setVisible(b);    }};_p.setShowMajorCategory = function(b){    if (this._showMajorCategory != b)    {        this._showMajorCategory = b;        this._updateMajorCategory();        this._majorCategory.setVisible(b);    }};_p.getShowMinorValue = function(){    return this._showMinorValue != null ? this._showMinorValue : false;} ;_p.getShowMajorValue = function(){    return this._showMajorValue != null ? this._showMajorValue : true;} ;_p.getShowMinorCategory = function(){    return this._showMinorCategory != null ? this._showMinorCategory : false;} ;_p.getShowMajorCategory = function(){    return this._showMajorCategory != null ? this._showMajorCategory : true;} ;_p.hasShowMinorValue = function(){    return this._showMinorValue != null;} ;_p.hasShowMajorValue = function(){    return this._showMajorValue != null;} ;_p.hasShowMinorCategory = function(){    return this._showMinorCategory != null;} ;_p.hasShowMajorCategory = function(){    return this._showMajorCategory != null;} ;_p.getMinorCategoryStrokeColor = function(){    return this._minorCategoryStrokeColor || "#ddd";} ;_p.getMajorCategoryStrokeColor = function(){    return this._majorCategoryStrokeColor || "#333";} ;_p.getMinorValueStrokeColor = function(){    return this._minorValueStrokeColor || "#ddd";} ;_p.getMajorValueStrokeColor = function(){    return this._majorValueStrokeColor || "#333";} ;_p.hasMinorCategoryStrokeColor = function(){    return this._minorCategoryStrokeColor != null;} ;_p.hasMajorCategoryStrokeColor = function(){    return this._majorCategoryStrokeColor != null;} ;_p.hasMinorValueStrokeColor = function(){    return this._minorValueStrokeColor != null;} ;_p.hasMajorValueStrokeColor = function(){    return this._majorValueStrokeColor != null;} ;_p.setMinorCategoryStrokeColor = function(s){    this._minorCategoryStrokeColor = s;    this._minorCategory.setHtmlProperty("stroked", s != "transparent");    this._minorCategory.setHtmlProperty("strokecolor", s);};_p.setMajorCategoryStrokeColor = function(s){    this._majorCategoryStrokeColor = s;    this._majorCategory.setHtmlProperty("stroked", s != "transparent");    this._majorCategory.setHtmlProperty("strokecolor", s);};_p.setMinorValueStrokeColor = function(s){    this._minorValueStrokeColor = s;    this._minorValue.setHtmlProperty("stroked", s != "transparent");    this._minorValue.setHtmlProperty("strokecolor", s);};_p.setMajorValueStrokeColor = function(s){    this._majorValueStrokeColor = s;    this._majorValue.setHtmlProperty("stroked", s != "transparent");    this._majorValue.setHtmlP

⌨️ 快捷键说明

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