[med-svn] [r-cran-scatterd3] 02/09: Inject debian packaging

Andreas Tille tille at debian.org
Sat Jul 2 10:24:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-scatterd3.

commit e7c4ccbb5601bbfbecdc5ce06b3e98f76ba567bb
Author: Andreas Tille <tille at debian.org>
Date:   Sat Jul 2 11:55:40 2016 +0200

    Inject debian packaging
---
 debian/README.source                  |  13 +
 debian/changelog                      |   5 +
 debian/compat                         |   1 +
 debian/control                        |  27 ++
 debian/copyright                      |  77 ++++
 debian/js/d3-legend.js                | 741 ++++++++++++++++++++++++++++++++++
 debian/js/d3-legend.min.js            |   1 +
 debian/patches/d3-legend.min.js.patch |   8 +
 debian/patches/series                 |   1 +
 debian/rules                          |   6 +
 debian/source/format                  |   1 +
 debian/watch                          |   3 +
 12 files changed, 884 insertions(+)

diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..0591a2e
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,13 @@
+The Javascript file d3-legend.js was fetched from Github
+
+  wget https://raw.githubusercontent.com/susielu/d3-legend/master/d3-legend.js
+
+The minimized version was created via
+
+  yui-compressor d3-legend.js > d3-legend.min.js
+
+and afterwards turned into a quilt patch (since I have no idea how to tweak
+cdbs build system :-( ).
+
+
+ -- Andreas Tille <tille at debian.org>  Tue, 28 Jun 2016 17:09:05 +0200
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..df09988
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+r-cran-scatterd3 (0.6.2+dfsg-1) UNRELEASED; urgency=low
+
+  * Initial release (closes: #???)
+
+ -- Andreas Tille <tille at debian.org>  Tue, 28 Jun 2016 17:09:05 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..b07572b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,27 @@
+Source: r-cran-scatterd3
+Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
+Uploaders: Andreas Tille <tille at debian.org>
+Section: gnu-r
+Priority: optional
+Build-Depends: debhelper (>= 9),
+               cdbs,
+               r-base-dev,
+               r-cran-htmlwidgets,
+               r-cran-digest,
+               r-cran-ellipse
+Standards-Version: 3.9.8
+Vcs-Browser: https://anonscm.debian.org/viewvc/debian-med/trunk/packages/R/r-cran-scatterd3/trunk/
+Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/R/r-cran-scatterd3/trunk/
+Homepage: https://cran.r-project.org/web/packages/scatterD3
+
+Package: r-cran-scatterd3
+Architecture: all
+Depends: ${misc:Depends},
+         ${R:Depends},
+         r-cran-htmlwidgets,
+         r-cran-digest,
+         r-cran-ellipse,
+         libjs-d3
+Description: GNU R D3 JavaScript Scatterplot from R
+ This GNU R package creates 'D3' 'JavaScript' scatterplots from 'R' with
+ interactive features : panning, zooming, tooltips, etc.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..7274bd1
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,77 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: scatterD3
+Upstream-Contact: Julien Barnier <julien.barnier at ens-lyon.fr>
+Source: https://cran.r-project.org/web/packages/scatterD3
+Files-Excluded: */d3*.min.js
+                */inst/htmlwidgets/lib/LICENSE
+
+Files: *
+Copyright: 2013-2016 Julien Barnier, Kent Russell
+License: GPL-3+
+
+Files: debian/js/d3-legend.*.js
+Copyright: 2013-2015 Susie Lu
+License: as_is
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+Comment: Source is obtained from https://github.com/susielu/d3-legend/
+
+Files: inst/htmlwidgets/lib/d3-lasso-plugin
+Copyright: 2015-2016, Speros Kokenes
+License: BSD-3-clause
+Comment: Source is obtained from https://github.com/skokenes/D3-Lasso-Plugin
+
+Files: debian/*
+Copyright: 2016 Andreas Tille <tille at debian.org>
+License: GPL-3+
+
+License: GPL-3+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3 of the License, or
+    (at your option) any later version.
+ .
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ .
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ .
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in `/usr/share/common-licenses/GPL-3'.
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+  1. Redistributions of source code must retain the above copyright notice, this
+     list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+     this list of conditions and the following disclaimer in the documentation
+     and/or other materials provided with the distribution.
+  3. Neither the name of the copyright holder nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+    without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/debian/js/d3-legend.js b/debian/js/d3-legend.js
new file mode 100644
index 0000000..1a3ccfc
--- /dev/null
+++ b/debian/js/d3-legend.js
@@ -0,0 +1,741 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+var helper = require('./legend');
+
+module.exports = function(){
+
+  var scale = d3.scale.linear(),
+    shape = "rect",
+    shapeWidth = 15,
+    shapeHeight = 15,
+    shapeRadius = 10,
+    shapePadding = 2,
+    cells = [5],
+    labels = [],
+    classPrefix = "",
+    useClass = false,
+    title = "",
+    labelFormat = d3.format(".01f"),
+    labelOffset = 10,
+    labelAlign = "middle",
+    labelDelimiter = "to",
+    orient = "vertical",
+    ascending = false,
+    path,
+    legendDispatcher = d3.dispatch("cellover", "cellout", "cellclick");
+
+    function legend(svg){
+
+      var type = helper.d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter),
+        legendG = svg.selectAll('g').data([scale]);
+
+      legendG.enter().append('g').attr('class', classPrefix + 'legendCells');
+
+
+      var cell = legendG.selectAll("." + classPrefix + "cell").data(type.data),
+        cellEnter = cell.enter().append("g", ".cell").attr("class", classPrefix + "cell").style("opacity", 1e-6),
+        shapeEnter = cellEnter.append(shape).attr("class", classPrefix + "swatch"),
+        shapes = cell.select("g." + classPrefix + "cell " + shape);
+
+      //add event handlers
+      helper.d3_addEvents(cellEnter, legendDispatcher);
+
+      cell.exit().transition().style("opacity", 0).remove();
+
+      helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path);
+
+      helper.d3_addText(legendG, cellEnter, type.labels, classPrefix)
+
+      // sets placement
+      var text = cell.select("text"),
+        shapeSize = shapes[0].map( function(d){ return d.getBBox(); });
+
+      //sets scale
+      //everything is fill except for line which is stroke,
+      if (!useClass){
+        if (shape == "line"){
+          shapes.style("stroke", type.feature);
+        } else {
+          shapes.style("fill", type.feature);
+        }
+      } else {
+        shapes.attr("class", function(d){ return classPrefix + "swatch " + type.feature(d); });
+      }
+
+      var cellTrans,
+      textTrans,
+      textAlign = (labelAlign == "start") ? 0 : (labelAlign == "middle") ? 0.5 : 1;
+
+      //positions cells and text
+      if (orient === "vertical"){
+        cellTrans = function(d,i) { return "translate(0, " + (i * (shapeSize[i].height + shapePadding)) + ")"; };
+        textTrans = function(d,i) { return "translate(" + (shapeSize[i].width + shapeSize[i].x +
+          labelOffset) + "," + (shapeSize[i].y + shapeSize[i].height/2 + 5) + ")"; };
+
+      } else if (orient === "horizontal"){
+        cellTrans = function(d,i) { return "translate(" + (i * (shapeSize[i].width + shapePadding)) + ",0)"; }
+        textTrans = function(d,i) { return "translate(" + (shapeSize[i].width*textAlign  + shapeSize[i].x) +
+          "," + (shapeSize[i].height + shapeSize[i].y + labelOffset + 8) + ")"; };
+      }
+
+      helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
+      helper.d3_title(svg, legendG, title, classPrefix);
+
+      cell.transition().style("opacity", 1);
+
+    }
+
+
+
+  legend.scale = function(_) {
+    if (!arguments.length) return scale;
+    scale = _;
+    return legend;
+  };
+
+  legend.cells = function(_) {
+    if (!arguments.length) return cells;
+    if (_.length > 1 || _ >= 2 ){
+      cells = _;
+    }
+    return legend;
+  };
+
+  legend.shape = function(_, d) {
+    if (!arguments.length) return shape;
+    if (_ == "rect" || _ == "circle" || _ == "line" || (_ == "path" && (typeof d === 'string')) ){
+      shape = _;
+      path = d;
+    }
+    return legend;
+  };
+
+  legend.shapeWidth = function(_) {
+    if (!arguments.length) return shapeWidth;
+    shapeWidth = +_;
+    return legend;
+  };
+
+  legend.shapeHeight = function(_) {
+    if (!arguments.length) return shapeHeight;
+    shapeHeight = +_;
+    return legend;
+  };
+
+  legend.shapeRadius = function(_) {
+    if (!arguments.length) return shapeRadius;
+    shapeRadius = +_;
+    return legend;
+  };
+
+  legend.shapePadding = function(_) {
+    if (!arguments.length) return shapePadding;
+    shapePadding = +_;
+    return legend;
+  };
+
+  legend.labels = function(_) {
+    if (!arguments.length) return labels;
+    labels = _;
+    return legend;
+  };
+
+  legend.labelAlign = function(_) {
+    if (!arguments.length) return labelAlign;
+    if (_ == "start" || _ == "end" || _ == "middle") {
+      labelAlign = _;
+    }
+    return legend;
+  };
+
+  legend.labelFormat = function(_) {
+    if (!arguments.length) return labelFormat;
+    labelFormat = _;
+    return legend;
+  };
+
+  legend.labelOffset = function(_) {
+    if (!arguments.length) return labelOffset;
+    labelOffset = +_;
+    return legend;
+  };
+
+  legend.labelDelimiter = function(_) {
+    if (!arguments.length) return labelDelimiter;
+    labelDelimiter = _;
+    return legend;
+  };
+
+  legend.useClass = function(_) {
+    if (!arguments.length) return useClass;
+    if (_ === true || _ === false){
+      useClass = _;
+    }
+    return legend;
+  };
+
+  legend.orient = function(_){
+    if (!arguments.length) return orient;
+    _ = _.toLowerCase();
+    if (_ == "horizontal" || _ == "vertical") {
+      orient = _;
+    }
+    return legend;
+  };
+
+  legend.ascending = function(_) {
+    if (!arguments.length) return ascending;
+    ascending = !!_;
+    return legend;
+  };
+
+  legend.classPrefix = function(_) {
+    if (!arguments.length) return classPrefix;
+    classPrefix = _;
+    return legend;
+  };
+
+  legend.title = function(_) {
+    if (!arguments.length) return title;
+    title = _;
+    return legend;
+  };
+
+  d3.rebind(legend, legendDispatcher, "on");
+
+  return legend;
+
+};
+
+},{"./legend":2}],2:[function(require,module,exports){
+module.exports = {
+
+  d3_identity: function (d) {
+    return d;
+  },
+
+  d3_mergeLabels: function (gen, labels) {
+
+      if(labels.length === 0) return gen;
+
+      gen = (gen) ? gen : [];
+
+      var i = labels.length;
+      for (; i < gen.length; i++) {
+        labels.push(gen[i]);
+      }
+      return labels;
+    },
+
+  d3_linearLegend: function (scale, cells, labelFormat) {
+    var data = [];
+
+    if (cells.length > 1){
+      data = cells;
+
+    } else {
+      var domain = scale.domain(),
+      increment = (domain[domain.length - 1] - domain[0])/(cells - 1),
+      i = 0;
+
+      for (; i < cells; i++){
+        data.push(domain[0] + i*increment);
+      }
+    }
+
+    var labels = data.map(labelFormat);
+
+    return {data: data,
+            labels: labels,
+            feature: function(d){ return scale(d); }};
+  },
+
+  d3_quantLegend: function (scale, labelFormat, labelDelimiter) {
+    var labels = scale.range().map(function(d){
+      var invert = scale.invertExtent(d),
+      a = labelFormat(invert[0]),
+      b = labelFormat(invert[1]);
+
+      // if (( (a) && (a.isNan()) && b){
+      //   console.log("in initial statement")
+        return labelFormat(invert[0]) + " " + labelDelimiter + " " + labelFormat(invert[1]);
+      // } else if (a || b) {
+      //   console.log('in else statement')
+      //   return (a) ? a : b;
+      // }
+
+    });
+
+    return {data: scale.range(),
+            labels: labels,
+            feature: this.d3_identity
+          };
+  },
+
+  d3_ordinalLegend: function (scale) {
+    return {data: scale.domain(),
+            labels: scale.domain(),
+            feature: function(d){ return scale(d); }};
+  },
+
+  d3_drawShapes: function (shape, shapes, shapeHeight, shapeWidth, shapeRadius, path) {
+    if (shape === "rect"){
+        shapes.attr("height", shapeHeight).attr("width", shapeWidth);
+
+    } else if (shape === "circle") {
+        shapes.attr("r", shapeRadius)//.attr("cx", shapeRadius).attr("cy", shapeRadius);
+
+    } else if (shape === "line") {
+        shapes.attr("x1", 0).attr("x2", shapeWidth).attr("y1", 0).attr("y2", 0);
+
+    } else if (shape === "path") {
+      shapes.attr("d", path);
+    }
+  },
+
+  d3_addText: function (svg, enter, labels, classPrefix){
+    enter.append("text").attr("class", classPrefix + "label");
+    svg.selectAll("g." + classPrefix + "cell text").data(labels).text(this.d3_identity);
+  },
+
+  d3_calcType: function (scale, ascending, cells, labels, labelFormat, labelDelimiter){
+    var type = scale.ticks ?
+            this.d3_linearLegend(scale, cells, labelFormat) : scale.invertExtent ?
+            this.d3_quantLegend(scale, labelFormat, labelDelimiter) : this.d3_ordinalLegend(scale);
+
+    type.labels = this.d3_mergeLabels(type.labels, labels);
+
+    if (ascending) {
+      type.labels = this.d3_reverse(type.labels);
+      type.data = this.d3_reverse(type.data);
+    }
+
+    return type;
+  },
+
+  d3_reverse: function(arr) {
+    var mirror = [];
+    for (var i = 0, l = arr.length; i < l; i++) {
+      mirror[i] = arr[l-i-1];
+    }
+    return mirror;
+  },
+
+  d3_placement: function (orient, cell, cellTrans, text, textTrans, labelAlign) {
+    cell.attr("transform", cellTrans);
+    text.attr("transform", textTrans);
+    if (orient === "horizontal"){
+      text.style("text-anchor", labelAlign);
+    }
+  },
+
+  d3_addEvents: function(cells, dispatcher){
+    var _ = this;
+
+      cells.on("mouseover.legend", function (d) { _.d3_cellOver(dispatcher, d, this); })
+          .on("mouseout.legend", function (d) { _.d3_cellOut(dispatcher, d, this); })
+          .on("click.legend", function (d) { _.d3_cellClick(dispatcher, d, this); });
+  },
+
+  d3_cellOver: function(cellDispatcher, d, obj){
+    cellDispatcher.cellover.call(obj, d);
+  },
+
+  d3_cellOut: function(cellDispatcher, d, obj){
+    cellDispatcher.cellout.call(obj, d);
+  },
+
+  d3_cellClick: function(cellDispatcher, d, obj){
+    cellDispatcher.cellclick.call(obj, d);
+  },
+
+  d3_title: function(svg, cellsSvg, title, classPrefix){
+    if (title !== ""){
+
+      var titleText = svg.selectAll('text.' + classPrefix + 'legendTitle');
+
+      titleText.data([title])
+        .enter()
+        .append('text')
+        .attr('class', classPrefix + 'legendTitle');
+
+        svg.selectAll('text.' + classPrefix + 'legendTitle')
+            .text(title)
+
+      var yOffset = svg.select('.' + classPrefix + 'legendTitle')
+          .map(function(d) { return d[0].getBBox().height})[0],
+      xOffset = -cellsSvg.map(function(d) { return d[0].getBBox().x})[0];
+
+      cellsSvg.attr('transform', 'translate(' + xOffset + ',' + (yOffset + 10) + ')');
+
+    }
+  }
+}
+
+},{}],3:[function(require,module,exports){
+var helper = require('./legend');
+
+module.exports =  function(){
+
+  var scale = d3.scale.linear(),
+    shape = "rect",
+    shapeWidth = 15,
+    shapePadding = 2,
+    cells = [5],
+    labels = [],
+    useStroke = false,
+    classPrefix = "",
+    title = "",
+    labelFormat = d3.format(".01f"),
+    labelOffset = 10,
+    labelAlign = "middle",
+    labelDelimiter = "to",
+    orient = "vertical",
+    ascending = false,
+    path,
+    legendDispatcher = d3.dispatch("cellover", "cellout", "cellclick");
+
+    function legend(svg){
+
+      var type = helper.d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter),
+        legendG = svg.selectAll('g').data([scale]);
+
+      legendG.enter().append('g').attr('class', classPrefix + 'legendCells');
+
+
+      var cell = legendG.selectAll("." + classPrefix + "cell").data(type.data),
+        cellEnter = cell.enter().append("g", ".cell").attr("class", classPrefix + "cell").style("opacity", 1e-6),
+        shapeEnter = cellEnter.append(shape).attr("class", classPrefix + "swatch"),
+        shapes = cell.select("g." + classPrefix + "cell " + shape);
+
+      //add event handlers
+      helper.d3_addEvents(cellEnter, legendDispatcher);
+
+      cell.exit().transition().style("opacity", 0).remove();
+
+      //creates shape
+      if (shape === "line"){
+        helper.d3_drawShapes(shape, shapes, 0, shapeWidth);
+        shapes.attr("stroke-width", type.feature);
+      } else {
+        helper.d3_drawShapes(shape, shapes, type.feature, type.feature, type.feature, path);
+      }
+
+      helper.d3_addText(legendG, cellEnter, type.labels, classPrefix)
+
+      //sets placement
+      var text = cell.select("text"),
+        shapeSize = shapes[0].map(
+          function(d, i){
+            var bbox = d.getBBox()
+            var stroke = scale(type.data[i]);
+
+            if (shape === "line" && orient === "horizontal") {
+              bbox.height = bbox.height + stroke;
+            } else if (shape === "line" && orient === "vertical"){
+              bbox.width = bbox.width;
+            }
+
+            return bbox;
+        });
+
+      var maxH = d3.max(shapeSize, function(d){ return d.height + d.y; }),
+      maxW = d3.max(shapeSize, function(d){ return d.width + d.x; });
+
+      var cellTrans,
+      textTrans,
+      textAlign = (labelAlign == "start") ? 0 : (labelAlign == "middle") ? 0.5 : 1;
+
+      //positions cells and text
+      if (orient === "vertical"){
+
+        cellTrans = function(d,i) {
+            var height = d3.sum(shapeSize.slice(0, i + 1 ), function(d){ return d.height; });
+            return "translate(0, " + (height + i*shapePadding) + ")"; };
+
+        textTrans = function(d,i) { return "translate(" + (maxW + labelOffset) + "," +
+          (shapeSize[i].y + shapeSize[i].height/2 + 5) + ")"; };
+
+      } else if (orient === "horizontal"){
+        cellTrans = function(d,i) {
+            var width = d3.sum(shapeSize.slice(0, i + 1 ), function(d){ return d.width; });
+            return "translate(" + (width + i*shapePadding) + ",0)"; };
+
+        textTrans = function(d,i) { return "translate(" + (shapeSize[i].width*textAlign  + shapeSize[i].x) + "," +
+              (maxH + labelOffset ) + ")"; };
+      }
+
+      helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
+      helper.d3_title(svg, legendG, title, classPrefix);
+
+      cell.transition().style("opacity", 1);
+
+    }
+
+  legend.scale = function(_) {
+    if (!arguments.length) return scale;
+    scale = _;
+    return legend;
+  };
+
+  legend.cells = function(_) {
+    if (!arguments.length) return cells;
+    if (_.length > 1 || _ >= 2 ){
+      cells = _;
+    }
+    return legend;
+  };
+
+
+  legend.shape = function(_, d) {
+    if (!arguments.length) return shape;
+    if (_ == "rect" || _ == "circle" || _ == "line" ){
+      shape = _;
+      path = d;
+    }
+    return legend;
+  };
+
+  legend.shapeWidth = function(_) {
+    if (!arguments.length) return shapeWidth;
+    shapeWidth = +_;
+    return legend;
+  };
+
+  legend.shapePadding = function(_) {
+    if (!arguments.length) return shapePadding;
+    shapePadding = +_;
+    return legend;
+  };
+
+  legend.labels = function(_) {
+    if (!arguments.length) return labels;
+    labels = _;
+    return legend;
+  };
+
+  legend.labelAlign = function(_) {
+    if (!arguments.length) return labelAlign;
+    if (_ == "start" || _ == "end" || _ == "middle") {
+      labelAlign = _;
+    }
+    return legend;
+  };
+
+  legend.labelFormat = function(_) {
+    if (!arguments.length) return labelFormat;
+    labelFormat = _;
+    return legend;
+  };
+
+  legend.labelOffset = function(_) {
+    if (!arguments.length) return labelOffset;
+    labelOffset = +_;
+    return legend;
+  };
+
+  legend.labelDelimiter = function(_) {
+    if (!arguments.length) return labelDelimiter;
+    labelDelimiter = _;
+    return legend;
+  };
+
+  legend.orient = function(_){
+    if (!arguments.length) return orient;
+    _ = _.toLowerCase();
+    if (_ == "horizontal" || _ == "vertical") {
+      orient = _;
+    }
+    return legend;
+  };
+
+  legend.ascending = function(_) {
+    if (!arguments.length) return ascending;
+    ascending = !!_;
+    return legend;
+  };
+
+  legend.classPrefix = function(_) {
+    if (!arguments.length) return classPrefix;
+    classPrefix = _;
+    return legend;
+  };
+
+  legend.title = function(_) {
+    if (!arguments.length) return title;
+    title = _;
+    return legend;
+  };
+
+  d3.rebind(legend, legendDispatcher, "on");
+
+  return legend;
+
+};
+
+},{"./legend":2}],4:[function(require,module,exports){
+var helper = require('./legend');
+
+module.exports = function(){
+
+  var scale = d3.scale.linear(),
+    shape = "path",
+    shapeWidth = 15,
+    shapeHeight = 15,
+    shapeRadius = 10,
+    shapePadding = 5,
+    cells = [5],
+    labels = [],
+    classPrefix = "",
+    useClass = false,
+    title = "",
+    labelFormat = d3.format(".01f"),
+    labelAlign = "middle",
+    labelOffset = 10,
+    labelDelimiter = "to",
+    orient = "vertical",
+    ascending = false,
+    legendDispatcher = d3.dispatch("cellover", "cellout", "cellclick");
+
+    function legend(svg){
+
+      var type = helper.d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter),
+        legendG = svg.selectAll('g').data([scale]);
+
+      legendG.enter().append('g').attr('class', classPrefix + 'legendCells');
+
+      var cell = legendG.selectAll("." + classPrefix + "cell").data(type.data),
+        cellEnter = cell.enter().append("g", ".cell").attr("class", classPrefix + "cell").style("opacity", 1e-6),
+        shapeEnter = cellEnter.append(shape).attr("class", classPrefix + "swatch"),
+        shapes = cell.select("g." + classPrefix + "cell " + shape);
+
+      //add event handlers
+      helper.d3_addEvents(cellEnter, legendDispatcher);
+
+      //remove old shapes
+      cell.exit().transition().style("opacity", 0).remove();
+
+      helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, type.feature);
+      helper.d3_addText(legendG, cellEnter, type.labels, classPrefix)
+
+      // sets placement
+      var text = cell.select("text"),
+        shapeSize = shapes[0].map( function(d){ return d.getBBox(); });
+
+      var maxH = d3.max(shapeSize, function(d){ return d.height; }),
+      maxW = d3.max(shapeSize, function(d){ return d.width; });
+
+      var cellTrans,
+      textTrans,
+      textAlign = (labelAlign == "start") ? 0 : (labelAlign == "middle") ? 0.5 : 1;
+
+      //positions cells and text
+      if (orient === "vertical"){
+        cellTrans = function(d,i) { return "translate(0, " + (i * (maxH + shapePadding)) + ")"; };
+        textTrans = function(d,i) { return "translate(" + (maxW + labelOffset) + "," +
+              (shapeSize[i].y + shapeSize[i].height/2 + 5) + ")"; };
+
+      } else if (orient === "horizontal"){
+        cellTrans = function(d,i) { return "translate(" + (i * (maxW + shapePadding)) + ",0)"; };
+        textTrans = function(d,i) { return "translate(" + (shapeSize[i].width*textAlign  + shapeSize[i].x) + "," +
+              (maxH + labelOffset ) + ")"; };
+      }
+
+      helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
+      helper.d3_title(svg, legendG, title, classPrefix);
+      cell.transition().style("opacity", 1);
+
+    }
+
+
+  legend.scale = function(_) {
+    if (!arguments.length) return scale;
+    scale = _;
+    return legend;
+  };
+
+  legend.cells = function(_) {
+    if (!arguments.length) return cells;
+    if (_.length > 1 || _ >= 2 ){
+      cells = _;
+    }
+    return legend;
+  };
+
+  legend.shapePadding = function(_) {
+    if (!arguments.length) return shapePadding;
+    shapePadding = +_;
+    return legend;
+  };
+
+  legend.labels = function(_) {
+    if (!arguments.length) return labels;
+    labels = _;
+    return legend;
+  };
+
+  legend.labelAlign = function(_) {
+    if (!arguments.length) return labelAlign;
+    if (_ == "start" || _ == "end" || _ == "middle") {
+      labelAlign = _;
+    }
+    return legend;
+  };
+
+  legend.labelFormat = function(_) {
+    if (!arguments.length) return labelFormat;
+    labelFormat = _;
+    return legend;
+  };
+
+  legend.labelOffset = function(_) {
+    if (!arguments.length) return labelOffset;
+    labelOffset = +_;
+    return legend;
+  };
+
+  legend.labelDelimiter = function(_) {
+    if (!arguments.length) return labelDelimiter;
+    labelDelimiter = _;
+    return legend;
+  };
+
+  legend.orient = function(_){
+    if (!arguments.length) return orient;
+    _ = _.toLowerCase();
+    if (_ == "horizontal" || _ == "vertical") {
+      orient = _;
+    }
+    return legend;
+  };
+
+  legend.ascending = function(_) {
+    if (!arguments.length) return ascending;
+    ascending = !!_;
+    return legend;
+  };
+
+  legend.classPrefix = function(_) {
+    if (!arguments.length) return classPrefix;
+    classPrefix = _;
+    return legend;
+  };
+
+  legend.title = function(_) {
+    if (!arguments.length) return title;
+    title = _;
+    return legend;
+  };
+
+  d3.rebind(legend, legendDispatcher, "on");
+
+  return legend;
+
+};
+
+},{"./legend":2}],5:[function(require,module,exports){
+d3.legend = {
+  color: require('./color'),
+  size: require('./size'),
+  symbol: require('./symbol')
+};
+},{"./color":1,"./size":3,"./symbol":4}]},{},[5]);
diff --git a/debian/js/d3-legend.min.js b/debian/js/d3-legend.min.js
new file mode 100644
index 0000000..08ba713
--- /dev/null
+++ b/debian/js/d3-legend.min.js
@@ -0,0 +1 @@
+(function e(b,g,d){function c(m,j){if(!g[m]){if(!b[m]){var i=typeof require=="function"&&require;if(!j&&i){return i(m,!0)}if(a){return a(m,!0)}var k=new Error("Cannot find module '"+m+"'");throw k.code="MODULE_NOT_FOUND",k}var h=g[m]={exports:{}};b[m][0].call(h.exports,function(l){var o=b[m][1][l];return c(o?o:l)},h,h.exports,e,b,g,d)}return g[m].exports}var a=typeof require=="function"&&require;for(var f=0;f<d.length;f++){c(d[f])}return c})({1:[function(b,c,a){var d=b("./legend");c.expo [...]
\ No newline at end of file
diff --git a/debian/patches/d3-legend.min.js.patch b/debian/patches/d3-legend.min.js.patch
new file mode 100644
index 0000000..b928f2a
--- /dev/null
+++ b/debian/patches/d3-legend.min.js.patch
@@ -0,0 +1,8 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Tue, 28 Jun 2016 17:09:05 +0200
+Description: Re-inject minimized d3-legend.min.js into source tree
+
+--- /dev/null
++++ b/inst/htmlwidgets/lib/d3-legend.min.js
+@@ -0,0 +1 @@
++(function e(b,g,d){function c(m,j){if(!g[m]){if(!b[m]){var i=typeof require=="function"&&require;if(!j&&i){return i(m,!0)}if(a){return a(m,!0)}var k=new Error("Cannot find module '"+m+"'");throw k.code="MODULE_NOT_FOUND",k}var h=g[m]={exports:{}};b[m][0].call(h.exports,function(l){var o=b[m][1][l];return c(o?o:l)},h,h.exports,e,b,g,d)}return g[m].exports}var a=typeof require=="function"&&require;for(var f=0;f<d.length;f++){c(d[f])}return c})({1:[function(b,c,a){var d=b("./legend");c.exp [...]
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..7fd8423
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+d3-legend.min.js.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..abe4a03
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+include /usr/share/R/debian/r-cran.mk
+
+install/$(package)::
+	ln -s /usr/share/javascript/d3/d3.min.js $(debRlib)/$(cranName)/htmlwidgets/lib/d3-3.5.6.min.js
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..6fa1d44
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts="repacksuffix=+dfsg,dversionmangle=s/\+dfsg//g,repack,compression=xz" \
+   http://cran.r-project.org/src/contrib/scatterD3_([-\d.]*)\.tar\.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-scatterd3.git



More information about the debian-med-commit mailing list