[Pkg-javascript-commits] [d3-tip.js] 98/277: move data into bar example to get around crossdomain network error

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:20 UTC 2016


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

bhuvan-guest pushed a commit to branch master
in repository d3-tip.js.

commit a0c8ee56da2b2b8745f1928ce93cd8a11dd983af
Author: Justin Palmer <justin at github.com>
Date:   Sun Apr 21 13:20:41 2013 -0700

    move data into bar example to get around crossdomain network error
---
 examples/bars.html | 63 +++++++++++++++++++++++++++---------------------------
 examples/data.json |  1 -
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/examples/bars.html b/examples/bars.html
index 63932e0..cc87dbb 100644
--- a/examples/bars.html
+++ b/examples/bars.html
@@ -5,7 +5,10 @@
   <meta charset="utf-8" />
   <title>Bar Chart</title>
   <script type="text/javascript" src="../components/d3/d3.js"></script>
-  <script type="text/javascript" src="../src/d3.tip.js"></script>
+  <script type="text/javascript" src="../d3.tip.min.js"></script>
+  <script type="text/javascript">
+    data = [{"total":225,"days":[12,51,60,26,38,31,7]},{"total":279,"days":[42,33,34,72,61,12,25]},{"total":212,"days":[12,59,24,70,36,5,6]},{"total":335,"days":[17,43,38,58,67,72,40]},{"total":329,"days":[40,53,62,48,38,36,52]},{"total":234,"days":[15,25,41,66,35,37,15]},{"total":175,"days":[2,40,23,40,23,34,13]},{"total":308,"days":[20,22,63,55,51,66,31]},{"total":401,"days":[20,64,42,62,88,79,46]},{"total":214,"days":[24,27,25,48,38,28,24]},{"total":332,"days":[26,43,20,109,74,29,31]} [...]
+  </script>
   <style type="text/css">
   body {
     padding: 40px;
@@ -94,36 +97,34 @@
     .append('g')
       .attr('transform', 'translate(' + padl + ',' + padt + ')')
 
-    d3.json('data.json', function (data) {
-      var max = d3.max(data, function(d) { return d.total })
-      x.domain(d3.range(data.length))
-      y.domain([0, max])
-
-      vis.call(tip)
-      vis.append("g")
-        .attr("class", "y axis")
-        .call(yAxis)
-
-      vis.append("g")
-        .attr("class", "x axis")
-        .attr('transform', 'translate(0,' + h + ')')
-        .call(xAxis)
-        .selectAll('.x.axis g')
-          .style('display', function (d, i) { return i % 3 != 0  ? 'none' : 'block' })
-
-      var bars = vis.selectAll('g.bar')
-        .data(data)
-      .enter().append('g')
-        .attr('class', 'bar')
-        .attr('transform', function (d, i) { return "translate(" + x(i) + ", 0)" })
-
-      bars.append('rect')
-        .attr('width', function() { return x.rangeBand() })
-        .attr('height', function(d) { return h - y(d.total) })
-        .attr('y', function(d) { return y(d.total) })
-        .on('mouseover', tip.show)
-        .on('mouseout', tip.hide)
-    })
+    var max = d3.max(data, function(d) { return d.total })
+    x.domain(d3.range(data.length))
+    y.domain([0, max])
+
+    vis.call(tip)
+    vis.append("g")
+      .attr("class", "y axis")
+      .call(yAxis)
+
+    vis.append("g")
+      .attr("class", "x axis")
+      .attr('transform', 'translate(0,' + h + ')')
+      .call(xAxis)
+      .selectAll('.x.axis g')
+        .style('display', function (d, i) { return i % 3 != 0  ? 'none' : 'block' })
+
+    var bars = vis.selectAll('g.bar')
+      .data(data)
+    .enter().append('g')
+      .attr('class', 'bar')
+      .attr('transform', function (d, i) { return "translate(" + x(i) + ", 0)" })
+
+    bars.append('rect')
+      .attr('width', function() { return x.rangeBand() })
+      .attr('height', function(d) { return h - y(d.total) })
+      .attr('y', function(d) { return y(d.total) })
+      .on('mouseover', tip.show)
+      .on('mouseout', tip.hide)
   </script>
 </body>
 </html>
\ No newline at end of file
diff --git a/examples/data.json b/examples/data.json
deleted file mode 100644
index 40ade1a..0000000
--- a/examples/data.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"total":225,"days":[12,51,60,26,38,31,7]},{"total":279,"days":[42,33,34,72,61,12,25]},{"total":212,"days":[12,59,24,70,36,5,6]},{"total":335,"days":[17,43,38,58,67,72,40]},{"total":329,"days":[40,53,62,48,38,36,52]},{"total":234,"days":[15,25,41,66,35,37,15]},{"total":175,"days":[2,40,23,40,23,34,13]},{"total":308,"days":[20,22,63,55,51,66,31]},{"total":401,"days":[20,64,42,62,88,79,46]},{"total":214,"days":[24,27,25,48,38,28,24]},{"total":332,"days":[26,43,20,109,74,29,31]},{"total":3 [...]
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/d3-tip.js.git



More information about the Pkg-javascript-commits mailing list