Skip to content

Commit

Permalink
multi-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
stevewirts committed Dec 8, 2014
1 parent 926291b commit 21ac300
Show file tree
Hide file tree
Showing 13 changed files with 453 additions and 268 deletions.
7 changes: 4 additions & 3 deletions allInOne.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!doctype html>
<html>
<head>
<link rel="import" href="fin-hypergrid-behavior-default.html">
<link rel="import" href="fin-hypergrid-behavior-in-memory.html">
<link rel="import" href="fin-hypergrid-behavior-q.html">
<link rel="import" href="behaviors/fin-hypergrid-behavior-default.html">
<link rel="import" href="behaviors/fin-hypergrid-behavior-in-memory.html">
<link rel="import" href="behaviors/fin-hypergrid-behavior-json.html">
<link rel="import" href="behaviors/fin-hypergrid-behavior-q.html">
<link rel="import" href="fin-hypergrid-excel.html">
<link rel="import" href="fin-hypergrid.html">
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
@homepage http://github.com/openfin/fin-hypergrid
-->

<link rel="import" href="fin-hypergrid-constants.html">
<link rel="import" href="fin-hypergrid-cell-provider.html">
<link rel="import" href="../fin-hypergrid-constants.html">
<link rel="import" href="../fin-hypergrid-cell-provider.html">
<polymer-element name="fin-hypergrid-behavior-default">
<template></template>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
@homepage http://github.com/openfin/fin-hypergrid
-->

<link rel="import" href="fin-hypergrid-cell-provider.html">
<link rel="import" href="fin-hypergrid-behavior-default.html">
<polymer-element name="fin-hypergrid-behavior-in-memory" extends="fin-hypergrid-behavior-default">
<template></template>
<script>
Expand Down Expand Up @@ -58,8 +56,8 @@
this.createSort(0, 22);
this.initOrder();
this.initialize();
//this.permute();
//this.reorder();
this.permute();
this.reorder();
},

//default to left halign for rendering performance improvement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
@homepage http://github.com/openfin/fin-hypergrid
-->

<link rel="import" href="fin-hypergrid-cell-provider.html">
<link rel="import" href="fin-hypergrid-behavior-default.html">
<polymer-element name="fin-hypergrid-behavior-json" extends="fin-hypergrid-behavior-default">
<template></template>
<script>
Expand Down Expand Up @@ -72,21 +70,35 @@
return quickSort(less, key).concat([pivot], quickSort(greater, key));
};

var names = ['Olivia', 'Sophia', 'Ava', 'Isabella', 'Boy', 'Liam', 'Noah', 'Ethan', 'Mason', 'Logan', 'Moe', 'Larry', 'Curly', 'Shemp', 'Groucho', 'Harpo', 'Chico', 'Zeppo', 'Stanely', 'Hardy'];
var months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
var days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'];
var numRows = 5000;

var firstNames = ['Olivia', 'Sophia', 'Ava', 'Isabella', 'Boy', 'Liam', 'Noah', 'Ethan', 'Mason', 'Logan', 'Moe', 'Larry', 'Curly', 'Shemp', 'Groucho', 'Harpo', 'Chico', 'Zeppo', 'Stanely', 'Hardy'];
var lastNames = ['Wirts', 'Oneil', 'Smith', 'Barbarosa', 'Soprano', 'Gotti', 'Columbo', 'Luciano', 'Doerre', 'DePena'];
var months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
var days = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'];
var states = ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming'];

var randomPerson = function() {
var name = Math.round((names.length - 1) * Math.random());
var firstName = Math.round((firstNames.length - 1) * Math.random());
var lastName = Math.round((lastNames.length - 1) * Math.random());
var pets = Math.round(10 * Math.random());
var birthyear = 1900 + Math.round(Math.random() * 113);
var birthyear = 1900 + Math.round(Math.random() * 114);
var birthmonth = Math.round(Math.random() * 11);
var birthday = Math.round(Math.random() * 29);
var score = Math.random() * 1000;
var birthstate = Math.round(Math.random() * 49);
var residencestate = Math.round(Math.random() * 49);
var score = Math.round(Math.random() * 1000000)/1000;
var income = Math.round(Math.random() * 10000000)/100;
var employed = Math.round(Math.random());
var person = {
name: names[name],
last: lastNames[lastName],
first: firstNames[firstName],
pets: pets,
birthdate: birthyear + '-' + months[birthmonth] + '-' + days[birthday],
birthstate: states[birthstate],
residencestate: states[residencestate],
employed: employed === 1,
income: income,
score: score
};
return person;
Expand All @@ -97,14 +109,32 @@

var headers =
[
'name',
'last',
'first',
'pets',
'birth date',
'birth state',
'residence state',
'employed',
'income',
'score'
];

var fields =
[
'last',
'first',
'pets',
'birthdate',
'birthstate',
'residencestate',
'employed',
'income',
'score'
];

var data = [];
for (var i = 0; i < 20; i ++) {
for (var i = 0; i < numRows; i ++) {
data.push(randomPerson());
}

Expand All @@ -114,9 +144,10 @@
sortStates: [' ', ' ^', ' v'],
data: data,
headers: headers,
fields: fields,

getValue: function(x, y) {
return this.data[y][this.headers[x]];
return this.data[y][this.fields[x]];
},

getFixedColValue: function(x, y) {
Expand All @@ -129,15 +160,15 @@
},

getFixedColCount: function() {
return 0;
return 1;
},

getRowCount: function() {
return this.data.length;
},

getColCount: function() {
return this.headers.length;
return this.fields.length;
},

fixedRowClicked: function(grid, mouse) {
Expand All @@ -146,21 +177,21 @@
},

toggleSort: function(colIndex) {
if (colIndex >= this.headers.length) {
if (colIndex >= this.fields.length) {
return;
}
var current = this.sorted[colIndex] || 0;
var stateCount = this.sortStates.length;
var sortStateIndex = (current + 1) % stateCount;

for (var i = 0; i < this.headers.length; i++) {
for (var i = 0; i < this.fields.length; i++) {
this.sorted[i] = 0;
}

this.sorted[colIndex] = sortStateIndex;


var colName = this.headers[colIndex];
var colName = this.fields[colIndex];
if (sortStateIndex === 0) {

} else if (sortStateIndex === 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
@homepage http://github.com/openfin/fin-hypergrid
-->

<link rel="import" href="fin-hypergrid-cell-provider.html">
<link rel="import" href="fin-hypergrid-behavior-default.html">
<polymer-element name="fin-hypergrid-behavior-q" extends="fin-hypergrid-behavior-default" attributes="url">
<template></template>
<script>
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"polymer": "Polymer/polymer#master",
"fin-canvas": "#master",
"fin-rectangle": "#master",
"fin-vampire-bar": "#master"
"fin-vampire-bar": "#master",
"paper-elements": "Polymer/paper-elements#~0.5.1"
}
}
Loading

0 comments on commit 21ac300

Please sign in to comment.