3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
7 //script used to generate data.json
9 function buildData(count) {
10 count = count || 1000;
12 var products = ['Ladder', 'Spanner', 'Chair', 'Hammer'],
13 states = ['CA', 'NY', 'UK', 'AZ', 'TX'],
14 cities = ['San Francisco', 'Palo Alto', 'London', 'Austin'],
15 people = ['Tommy Maintz', 'Abe Elias', 'Ed Spencer', 'Jamie Avins'],
19 for (i = 0; i < count; i++) {
22 product : products[Math.floor(Math.random() * products.length)],
23 city : cities[Math.floor(Math.random() * cities.length)],
24 state : states[Math.floor(Math.random() * states.length)],
25 quantity: Math.floor(Math.random() * 10000),
26 value : Math.floor(Math.random() * 50),
27 month : Math.ceil(Math.random() * 12),
28 quarter : Math.ceil(Math.random() * 4),
29 year : 2010 - Math.floor(Math.random() * 2),
30 person : people[Math.floor(Math.random() * people.length)]
37 function buildPeople(count) {
40 var colors = ['Brown', 'Blue', 'Green'],
41 decades = ['1960s', '1970s', '1980s', '1990s'],
42 hands = ['Left', 'Right'],
43 genders = ['Male', 'Female'],
47 for (i = 0; i < count; i++) {
48 var iq = Math.round(Math.random() * 100);
50 if (iq < 25 && Math.random() > 0.5) {
51 iq += Math.random() * 30;
52 } else if (iq > 75 && Math.random() < 0.9) {
53 iq -= Math.random() * 20;
57 eyeColor : colors[Math.floor(Math.random() * colors.length)],
58 gender : genders[Math.floor(Math.random() * genders.length)],
59 handedness : hands[Math.floor(Math.random() * hands.length)],
60 birthDecade: decades[Math.floor(Math.random() * decades.length)],
61 height : 5 + parseFloat((Math.random() * 2).toFixed(1)),
62 iq : 50 + Math.round(iq)
66 return Ext.encode({rows: records});