Last active
August 29, 2015 14:21
-
-
Save klaemo/d9e1d38c32a187543de6 to your computer and use it in GitHub Desktop.
starplot.js
This file contains hidden or 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
AppView.renderSubview(starplot) | |
-> starplot.initialize() | |
-> starplot.render() (automatisch aufgerufen durch AppView.rendersubview) | |
-> starplot.renderWithTemplate() (aufgerufen in starplot.render()) | |
// jetzt exisitert das HTML element starplot.el inklusive svg | |
-> d3.select()... | |
This file contains hidden or 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
var View = require('ampersand-view') | |
var d3 = require('d3') | |
var template = require('../templates/routes.jade') | |
// make this the general app view | |
var routes = View.extend({ | |
template: template, | |
events: { | |
'click button': 'render' | |
}, | |
initialize: function () { | |
console.log('hello') | |
}, | |
render: function () { | |
this.renderWithTemplate(this) | |
var svg = d3.select(this.query('svg')) | |
svg.append('circle') | |
.attr('cx', 20) | |
.attr('cy', 20) | |
.attr('r', 10) | |
console.log('hi') | |
return this | |
} | |
}) | |
module.exports = routes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment