File tree Expand file tree Collapse file tree 4 files changed +36063
-8
lines changed
public/broccoli-viz-files Expand file tree Collapse file tree 4 files changed +36063
-8
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,10 @@ export default Ember.Component.extend({
53
53
} ,
54
54
55
55
drawTree ( data ) {
56
- let svg = select ( this . element . querySelector ( '.svg-container' ) )
56
+ let svgContainer = this . element . querySelector ( '.svg-container' ) ;
57
+ svgContainer . innerHTML = '' ;
58
+
59
+ let svg = select ( svgContainer )
57
60
. append ( "svg" )
58
61
. attr ( "preserveAspectRatio" , "xMinYMin meet" )
59
62
. attr ( "viewBox" , "0 0 300 300" )
@@ -199,7 +202,6 @@ export default Ember.Component.extend({
199
202
update ( root ) ;
200
203
201
204
let zoomHandler = zoom ( )
202
- . scaleExtent ( [ 0.05 , 3 ] )
203
205
. on ( "zoom" , ( ) => {
204
206
g . attr ( "transform" , event . transform ) ;
205
207
} ) ;
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import Ember from 'ember';
2
2
import fetch from "ember-network/fetch" ;
3
3
import config from '../config/environment' ;
4
4
5
- const SAMPLE_DATA = config . rootURL + 'broccoli-viz-files/initial-build-canary-20161220.json' ;
6
-
7
5
export default Ember . Controller . extend ( {
8
6
init ( ) {
9
7
this . _super ( ...arguments ) ;
@@ -16,14 +14,14 @@ export default Ember.Controller.extend({
16
14
let reader = new FileReader ( ) ;
17
15
reader . onload = ( e ) => {
18
16
var contents = e . target . result ;
19
- this . set ( 'graphData' , contents ) ;
17
+ this . set ( 'graphData' , JSON . parse ( contents ) ) ;
20
18
} ;
21
19
22
20
reader . readAsText ( event . target . files [ 0 ] ) ;
23
21
} ,
24
22
25
- useSample ( ) {
26
- fetch ( SAMPLE_DATA )
23
+ useSample ( url ) {
24
+ fetch ( url )
27
25
. then ( ( response ) => {
28
26
return response . json ( ) ;
29
27
} )
Original file line number Diff line number Diff line change 4
4
<input name =" file-upload" type =" file" onchange ={{ action ' parseFile' }} >
5
5
</div >
6
6
<div >
7
- <button {{ action ' useSample' }} >Display sample</button >
7
+ <select onchange ={{ action ' useSample' value =" target.value" }} >
8
+ <option selected disabled>Choose sample file</option >
9
+ <option value =" ./broccoli-viz-files/initial-build-canary-20161220.json" >Empty Project - 2016-12-20</option >
10
+ <option value =" ./broccoli-viz-files/ghost-initial-build-canary-ember-cli-20161222.json" >Ghost Admin Client - 2016-12-22</option >
11
+ </select >
8
12
</div >
9
13
</form >
10
14
You can’t perform that action at this time.
0 commit comments