// some data helpers const dataFilter = Vue.component('data-filter', { data: function() { return { currentKind: 'always-true', kinds: ['month', 'day', 'year', 'always-true'] }; }, computed: { currentKindComponent: function () { return 'filter-' + this.currentKind.toLowerCase() } }, template: `
Help You can select a data filter to apply to the data. The "Always True" filter does nothing. The day, month, year filters let you do your calculations only on dates which match the given criteria. For example, if you choose the month filter with month = 1, the percentile analysis results will show you the trailing returns for days only in January. For example, if you use an averaging period of 20 then for each day in January we would compute the trailing 20 return. Or if you used an averaging period of 1 then you could get the percentile statistics one-day returns in January.
` }); Vue.component('filter-day', { data: function() { return { kind: 'day', value: 1, } }, methods: { calc: function(rows) { var myDay = parseInt(this.value); console.log('filtering by day=: ' + myDay); for (i=0; i = ` }); Vue.component('filter-month', { data: function() { return { kind: 'month', value: 1, } }, methods: { calc: function(rows) { var myMonth = parseInt(this.value); console.log('filtering by month=: ' + myMonth); for (i=0; i = ` }); Vue.component('filter-year', { data: function() { return { kind: 'year', value: 1, } }, methods: { calc: function(rows) { var myYear = parseInt(this.value); console.log('filtering by year=: ' + myYear); for (i=0; i = ` }); Vue.component('filter-always-true', { data: function() { return { 'kind': 'always-true' } }, methods: { calc: function(rows) { for (i=0; iAlways True ` }); // ---------------------------------------------------------------------- // Routing stuff below // ---------------------------------------------------------------------- const About = Vue.component('about', { // Will reference x-template with template: '#about'} // id="about" in HTML file ); const Help = Vue.component('help', { // Will reference x-template with template: '#help'} // id="help" in HTML file ); const Home = Vue.component('home', { // Will reference x-template with template: '#home', // id="home" in HTML file data: function () { return { 'mainInfo': makeMainInfo(), }; }, methods: { simplePlot: function(plotid, plotx, ploty) { return makeSimplePlot(plotid, plotx, ploty); }, doCalc: function(event) { console.log('start doCalc'); var filterComponents = this.$refs.dfilt.$children; var filters = []; for (i=0; i