Last active
February 20, 2017 17:46
-
-
Save onlymejosh/69f9f1b13ee9dbbf1d434c3be686a833 to your computer and use it in GitHub Desktop.
C3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
width: 600, | |
height: 300, | |
data: [ 30, 10, 5, 8, 15, 10 ], | |
color: 'red', | |
yScale: function() { | |
return d3.scale.linear() | |
.domain([0, d3.max(this.props.data)]) | |
.range([0, this.props.height]); | |
}, | |
xScale: function() { | |
return d3.scale.ordinal() | |
.domain(d3.range(this.get('data.length'))) | |
.rangeRoundBands([0, this.get('width')], 0.05); | |
}, | |
d3Data: Ember.computed('data.[]', function() { | |
return this.get('data').map((point, index) => { | |
return { | |
point, | |
color: this.get('color'), | |
width: this.get('xScale').rangeBand(), | |
height: this.get('yScale')(point), | |
x: this.get('xScale')(index), | |
y: this.get('height') - this.get('yScale')(point), | |
} | |
}) | |
}), | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
init() { | |
console.log(d3) | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": true, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"d3":"https://d3js.org/d3.v4.min.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment