rails-erd-d3 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4167a9ef1a6c9542b3b67193339ac34c3c736ac
4
- data.tar.gz: 4e6e16268002fc386176ec603f0615e3f4bb7b51
3
+ metadata.gz: 704736ce145ff612e50f77c38bc0e658656ee5c4
4
+ data.tar.gz: '01752789b2dc6f794f46f64c81975d872f80b344'
5
5
  SHA512:
6
- metadata.gz: 1579ceeb2b19a3fd85e9b11e41e981a84f659cef8bad09e16a2be3a5b0056a26bb27669887c0216e87e11979043fcd0477a4e0fc1c99c4a4296426425c1ce9bd
7
- data.tar.gz: 570db03160622b0deba0e620b52b7407f82fe2f36a15d3713d5d23af90c50348048320d6ccebb1d98a2ce41440500eaaaacae7db2b17ea90ab366dde29a1159d
6
+ metadata.gz: c387b7365fce7c68eed9c169ef4cf1b66292e642462afe0f912143c2a19c7fc08b32aa699ec1830adcdd056d80984dd1a0d71ec5c9351a0ea44a1de50a91ea0c
7
+ data.tar.gz: a9ee087004453183c43e7d86d38ad30649c915f0812dd7ba15782d3221721e9714add32a5411afb5643399ab599062d649d3de873d3287a025c8e4ea9cb5bfda
data/README.md CHANGED
@@ -47,28 +47,61 @@ $ bundle exec rails-erd-d3
47
47
  ```
48
48
 
49
49
  ## Todo
50
+ - Add zoom
51
+ ```
52
+ // https://jsfiddle.net/owen_rodda/55zk55ut/16/
53
+ var svg = d3.select('#erd')
54
+ .call(d3.zoom().on("zoom", zoomed))
55
+
56
+ function zoomed() {
57
+ svg.attr("transform",
58
+ "translate("
59
+ + d3.event.transform.x + ","
60
+ + d3.event.transform.y + ")"
61
+ + " scale(" + d3.event.transform.k
62
+ + ")"
63
+ );
64
+ ```
65
+ - Add arrows
66
+ ```
67
+ svg.append("defs").append("marker")
68
+ .attr("id", "arrow")
69
+ .attr("viewBox", "0 -5 10 10")
70
+ .attr("refX", 32)
71
+ .attr("refY", 0)
72
+ .attr("markerWidth", 7)
73
+ .attr("markerHeight", 7)
74
+ .attr("orient", "auto")
75
+ .append("svg:path")
76
+ .attr("d", "M0,-5L10,0L0,5");
77
+
78
+ var link = svg.append('g')
79
+ .attr("marker-end", "url(#arrow)");
80
+ ```
81
+ - Add
82
+ ```
83
+ var link = svg.append('g')
84
+ .attr('stroke-width', 2)
85
+ ```
86
+ - Add
87
+ ```
88
+ node.append('circle')
89
+ .attr('stroke', 'white')
90
+ .attr('stroke-width', 3)
91
+ ```
50
92
  - Freeze
51
93
  - On
52
94
  ```
53
95
  node.call(d3.drag()
54
96
  .on('start', dragstarted)
55
97
  .on('drag', dragged)
56
- .on('end', dragended));
98
+ .on('end', dragended));
57
99
  ```
58
100
  - Off
59
101
  ```
60
102
  node.call(d3.drag().on('drag', null))
61
103
  ```
62
- - Add to link
63
- ```
64
- .attr('stroke-width', 2);
65
- ```
66
104
  - Add link to another model in model window
67
- - Add rotation
68
- ```
69
- simulation.alphaTarget(0.4).restart();
70
- simulation.alphaTarget(0);
71
- ```
72
105
  - Add tests
73
106
  - ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
74
107
  - Sort nodes by label
@@ -15,6 +15,18 @@
15
15
  .attr('width', width)
16
16
  .style('background', 'white');
17
17
 
18
+ svg.append("defs")
19
+ .append("marker")
20
+ .attr("id", "arrow")
21
+ .attr("viewBox", "0 -5 10 10")
22
+ .attr("refX", 32)
23
+ .attr("refY", 0)
24
+ .attr("markerWidth", 7)
25
+ .attr("markerHeight", 7)
26
+ .attr("orient", "auto")
27
+ .append("svg:path")
28
+ .attr("d", "M0,-5L10,0L0,5");
29
+
18
30
  var simulation = d3.forceSimulation()
19
31
  .force('link', d3.forceLink().id(function(d) { return d.index }))
20
32
  .force('collide', d3.forceCollide(function(d) { return d.r + 20 }).iterations(30))
@@ -30,7 +42,8 @@
30
42
  .enter()
31
43
  .append('line')
32
44
  .attr('class', function(d, i) { return data.nodes[d.source].label + ' ' + data.nodes[d.target].label })
33
- .attr('stroke', function(d) { return colorScale(d.color) });
45
+ .attr('stroke', function(d) { return colorScale(d.color) })
46
+ .attr('marker-end', 'url(#arrow)');;
34
47
 
35
48
  var node = svg.selectAll('.node')
36
49
  .data(data.nodes)
@@ -48,6 +61,8 @@
48
61
 
49
62
  node.append('circle')
50
63
  .classed('circle', true)
64
+ .attr('stroke', 'white')
65
+ .attr('stroke-width', 3)
51
66
  .attr('r', function(d){ return d.r })
52
67
  .attr('fill', function(d, i) { return colorScale(i) });
53
68
 
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "rails-erd-d3"
7
7
  spec.authors = ["Roman Krasavtsev"]
8
8
  spec.email = ["mr.krasavtsev@gmail.com"]
9
- spec.version = "0.5.4"
9
+ spec.version = "0.6.0"
10
10
  spec.summary = "Entity–relationship diagram with D3.js for Rails application"
11
11
  spec.description = "This gem creates entity–relationship diagram with D3.js for your Rails application"
12
12
  spec.homepage = "https://github.com/RomanKrasavtsev/rails-erd-d3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd-d3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Krasavtsev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-23 00:00:00.000000000 Z
11
+ date: 2016-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler