diff --git a/example/histogram/DataExample.csv b/example/column/DataExample.csv similarity index 100% rename from example/histogram/DataExample.csv rename to example/column/DataExample.csv diff --git a/example/histogram/histogram.html b/example/column/column.html similarity index 70% rename from example/histogram/histogram.html rename to example/column/column.html index 2e97215..0b98719 100644 --- a/example/histogram/histogram.html +++ b/example/column/column.html @@ -3,7 +3,7 @@ - Histogram + Column @@ -15,22 +15,22 @@ seajs.config({ alias: { 'DataV': dir + '/../../lib/datav.js', - 'Histogram': dir + '/../../lib/charts/Histogram.js' + 'Column': dir + '/../../lib/charts/Column.js' } });
diff --git a/lib/charts/histogram.js b/lib/charts/column.js similarity index 94% rename from lib/charts/histogram.js rename to lib/charts/column.js index 9a1df47..073f495 100644 --- a/lib/charts/histogram.js +++ b/lib/charts/column.js @@ -5,12 +5,12 @@ } else { // Assign to common namespaces or simply the global object (window) this[name] = definition(function (id) { return this[id];}); } -})('Histogram', function (require) { +})('Column', function (require) { var DataV = require('DataV'); /** - * Histogram构造函数 - * Create histogram in a dom node with id "chart", default width is 522; height is 522px; + * Column构造函数 + * Create Column in a dom node with id "chart", default width is 522; height is 522px; * Options: * * - `width` 宽度,默认为节点宽度 @@ -18,14 +18,14 @@ * * Examples: * ``` - * var histogram = new Histogram("chart", {"width": 500, "height": 600, "typeNames": ["Y", "Z"]}); + * var column = new Column("chart", {"width": 500, "height": 600, "typeNames": ["Y", "Z"]}); * ``` * @param {Mix} node The dom node or dom node Id - * @param {Object} options options json object for determin histogram style. + * @param {Object} options options json object for determin column style. */ - var Histogram = DataV.extend(DataV.Chart, { + var Column = DataV.extend(DataV.Chart, { initialize: function (node, options) { - this.type = "Histogram"; + this.type = "Column"; this.node = this.checkContainer(node); this.defaults = {}; @@ -60,7 +60,7 @@ /** * 创建画布 */ - Histogram.prototype.createCanvas = function () { + Column.prototype.createCanvas = function () { var conf = this.defaults; this.node.style.position = "relative"; this.canvas = new Raphael(this.node, conf.width, conf.height); @@ -74,12 +74,12 @@ * * Examples: * ``` - * histogram.setSource(source); + * column.setSource(source); * ``` * * @param {Array} source 数据源 第一列为排布在x轴的数据,后n列为排布在y轴的数据 */ - Histogram.prototype.setSource = function (source) { + Column.prototype.setSource = function (source) { var conf = this.defaults; var i, j, l; var xTemp = [], @@ -126,7 +126,7 @@ /** * 设置坐标轴 */ - Histogram.prototype.setAxis = function () { + Column.prototype.setAxis = function () { var conf = this.defaults; var tagWidth = conf.width / 5 > 50 ? 50 : conf.width / 5; conf.legendArea = [conf.width - tagWidth - conf.margin, 0, conf.width, conf.height]; @@ -150,7 +150,7 @@ /** * 进行柱状图的绘制 */ - Histogram.prototype.drawDiagram = function () { + Column.prototype.drawDiagram = function () { var that = this; var conf = this.defaults; var paper = this.canvas; @@ -594,15 +594,15 @@ * * Examples: * ``` - * histogram.render({"width": 1024}) + * column.render({"width": 1024}) * ``` - * @param {Object} options options json object for determin histogram style. + * @param {Object} options options json object for determin column style. */ - Histogram.prototype.render = function (options) { + Column.prototype.render = function (options) { this.setOptions(options); this.canvas.clear(); this.setAxis(); this.drawDiagram(); }; - return Histogram; + return Column; }); \ No newline at end of file