Skip to content

Instantly share code, notes, and snippets.

@ericf
Created November 15, 2011 18:01
Show Gist options
  • Select an option

  • Save ericf/1367804 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/1367804 to your computer and use it in GitHub Desktop.
YUI().use('charts', 'app-base', function (Y) {
var ChartView, StatsView, app;
ChartView = Y.Base.create('chartView', Y.View, [], {
render: function () {
this.chart = new Y.Chart({
dataProvider: [],
render : this.get('container')
});
return this;
}
});
StatsView = Y.Base.create('statsView', Y.View, [], {
render: function () {
// Render stats.
return this;
}
});
app = new Y.App({
serverRouting: false,
views: {
chart: {
type : ChartView,
preserve: true
},
stats: {
type : StatsView,
preserve: true
}
}
});
app.route('/charts/', function () {
app.showView('chart', function (chartView) {
// chartView.chart ponts to the Y.Chart instance.
});
});
app.route('/stats/', function () {
app.showView('stats')
});
app.dispatch().render();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment