wiki-plugin-bars
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -1,2 +0,4 @@ | ||
(function() { | ||
"use strict"; | ||
(function () { | ||
/* | ||
@@ -9,10 +11,12 @@ * Federated Wiki : Bars Plugin | ||
window.plugins.bars = { | ||
bind: function(div, item) {}, | ||
emit: function(div, item) { | ||
return wiki.getScript('/js/d3/d3.min.js', function() { | ||
bind: function bind(div, item) {}, | ||
emit: function emit(div, item) { | ||
return wiki.getScript('/js/d3/d3.min.js', function () { | ||
var bars, data, h, rules, vis, w, x, y; | ||
data = (function() { | ||
data = function () { | ||
var j, len, ref, results; | ||
ref = wiki.getData(); | ||
results = []; | ||
for (j = 0, len = ref.length; j < len; j += 5) { | ||
@@ -22,4 +26,6 @@ x = ref[j]; | ||
} | ||
return results; | ||
})(); | ||
}(); | ||
w = 380; | ||
@@ -30,12 +36,12 @@ h = 230; | ||
vis = d3.select(div.get(0)).append("svg:svg").attr("width", w + 40).attr("height", h + 30).append("svg:g").attr("transform", "translate(20,0)"); | ||
bars = vis.selectAll("g.bar").data(data).enter().append("svg:g").attr("class", "bar").attr("transform", function(d, i) { | ||
return `translate(0,${y(i)})`; | ||
bars = vis.selectAll("g.bar").data(data).enter().append("svg:g").attr("class", "bar").attr("transform", function (d, i) { | ||
return "translate(0,".concat(y(i), ")"); | ||
}); | ||
bars.append("svg:rect").attr("fill", "steelblue").attr("width", x).attr("height", y.rangeBand()); | ||
bars.append("svg:text").attr("x", x).attr("y", y.rangeBand() / 2).attr("dx", -6).attr("dy", ".35em").attr("fill", "white").attr("text-anchor", "end").text(x.tickFormat(100)); | ||
bars.append("svg:text").attr("x", 0).attr("y", y.rangeBand() / 2).attr("dx", -6).attr("dy", ".35em").attr("text-anchor", "end").text(function(d, i) { | ||
bars.append("svg:text").attr("x", 0).attr("y", y.rangeBand() / 2).attr("dx", -6).attr("dy", ".35em").attr("text-anchor", "end").text(function (d, i) { | ||
return String.fromCharCode(65 + i); | ||
}); | ||
rules = vis.selectAll("g.rule").data(x.ticks(10)).enter().append("svg:g").attr("class", "rule").attr("transform", function(d) { | ||
return `translate(${x(d)},0)`; | ||
rules = vis.selectAll("g.rule").data(x.ticks(10)).enter().append("svg:g").attr("class", "rule").attr("transform", function (d) { | ||
return "translate(".concat(x(d), ",0)"); | ||
}); | ||
@@ -49,5 +55,3 @@ rules.append("svg:line").attr("y1", h).attr("y2", h + 6).attr("stroke", "black"); | ||
}; | ||
}).call(this); | ||
}).call(void 0); | ||
//# sourceMappingURL=bars.js.map |
{ | ||
"name": "wiki-plugin-bars", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Federated Wiki - Activity Plug-in", | ||
@@ -31,2 +31,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5", | ||
"grunt": "^1.0.4", | ||
@@ -33,0 +35,0 @@ "grunt-contrib-coffee": "^2.1.0", |
Sorry, the diff of this file is not supported yet
48
6