Skip to content

Instantly share code, notes, and snippets.

@vikrammirla
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save vikrammirla/323367f62161e9d631b6 to your computer and use it in GitHub Desktop.

Select an option

Save vikrammirla/323367f62161e9d631b6 to your computer and use it in GitHub Desktop.
grid
{"description":"grid","endpoint":"","display":"svg","public":true,"require":[{"name":"jquery","url":"http://code.jquery.com/jquery-2.1.4.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"dataset.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"newData.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"ajax-caching":true,"inline-console":true,"thumbnail":"http://i.imgur.com/9WF8QDV.png"}
var values = d3.range(1000).map(d3.random.bates(10));
console.log(values)
d3.layout.grid = function() {
gridSize = [10,10];
var gridXScale = d3.scale.linear();
var gridYScale = d3.scale.linear();
function processGrid(data) {
var rows = Math.ceil(Math.sqrt(data.length));
var columns = rows;
gridXScale.domain([1,columns]).range([0,600])
gridYScale.domain([1,rows]).range([0,500])
var cell=0;
for (var i = 1; i <= rows; i++) {
for (var j = 1; i <= columns; j++) {
if(data[cell]) {
data[cell].x = gridXScale(j) ;
data[cell].y = gridYScale(i) ;
cell++;
}
else {
break;
}
}//close j loop
}//close i loop
return data;
}
processGrid.size = function(newSize) {
if(!arguments.length) return gridSize
gridSize = newSize
return this;
}
return processGrid;
}
function makeAGrid(d) {
var min = d3.min(_.pluck(d,'value'));
var max = d3.max(_.pluck(d,'value'));
var scale = d3.scale.linear().domain([min,max]).range([10,300]);
var grid = d3.layout.grid();
grid.size(400,400);
var griddedData = grid(d);
d3.select("svg").selectAll("circle")
.data(griddedData)
.enter()
.append("circle")
.attr("cx", function(d) {
return (d.x)
})
.attr("cy",function(d) { return (d.y) })
.attr("r",5)
.style('fill','pink')
}
var margin = {top: 10, right: 30, bottom: 30, left: 30},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var svg = d3.select("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("rect")
.attr({
x: tributary.anim(100, 400),
y: tributary.anim(100, 400),
width: tributary.anim(100, 200),
height: tributary.anim(100, 200, {ease: d3.ease("bounce")}),
rx: 5,
ry: 5
})
.style({
fill: tributary.anim("#F8025B", "#38F514", {interpolate: d3.interpolateHsl}),
stroke: "#000"
})
var myData = tributary.newData
console.log(myData.length)
icker SecurityName Port_AverageWeight Port_TotalReturn Port_Contrib_ToReturn Bench_AverageWeight Bench_TotalReturn Bench_Contrib_ToReturn AverageWeightDifference TotalReturnDifference Contrib_ToReturnDifference AllocationEffect SelectionEffect TotalEffect GICSINDUSTRY GICSIndustryGroup GICSSECTOR
AMZN Amazon.com, Inc. 7.99 -16.82 -1.38 0.59 -16.82 -0.14 7.4 0 -1.24 -2.36 0 -2.36 Internet & Catalog Retail Retailing Consumer Discretionary
RATE Bankrate, Inc. 3.11 -33.85 -1.11 0 -33.85 0 3.11 0 -1.11 -1.57 0 -1.57 Internet Software & Services Software & Services Information Technology
NILE Blue Nile, Inc. 0.7 -39.06 -0.6 0 -28.01 0 0.7 -11.05 -0.6 -0.71 0 -0.71 Internet & Catalog Retail Retailing Consumer Discretionary
COG Cabot Oil & Gas Corporation 1.42 -17.8 -0.29 0.07 -9.19 -0.01 1.35 -8.6 -0.28 -0.49 0 -0.49 Oil Gas & Consumable Fuels Energy Energy
THRX Theravance, Inc. 0.22 -18.74 -0.27 0.01 -54.47 -0.01 0.21 35.73 -0.26 -0.37 0 -0.37 Pharmaceuticals Pharmaceuticals Biotechnology & Life Sciences Health Care
RRC Range Resources Corporation 0.96 -23.26 -0.26 0.06 -16.39 -0.01 0.9 -6.88 -0.25 -0.38 0 -0.38 Oil Gas & Consumable Fuels Energy Energy
FDS FactSet Research Systems Inc. 0.42 -7.55 -0.21 0.02 23.26 0.01 0.39 -30.81 -0.21 -0.31 0 -0.31 Software Software & Services Information Technology
APA Apache Corporation 0.33 -12.6 -0.22 0.16 -30.02 -0.05 0.17 17.42 -0.17 -0.24 0 -0.24 Oil Gas & Consumable Fuels Energy Energy
AMGN Amgen Inc. 0.06 4.08 0.08 0.45 50.73 0.21 -0.39 -46.64 -0.13 -0.07 0 -0.07 Biotechnology Pharmaceuticals Biotechnology & Life Sciences Health Care
GOOG Google Inc. Class C 1.07 -6.32 -0.12 0.48 -5.86 -0.05 0.59 -0.45 -0.07 -0.14 0 -0.14 Internet Software & Services Software & Services Information Technology
NOV National Oilwell Varco, Inc. 1.04 -7.93 -0.05 0.16 -7.93 -0.01 0.88 0 -0.04 -0.17 0 -0.17 Energy Equipment & Services Energy Energy
CIT CIT Group Inc. 1.11 -4.06 -0.04 0.04 -4.06 0 1.07 0 -0.04 -0.2 0 -0.2 Banks Banks Financials
DNOW NOW Inc 0 -7.83 -0.01 0.01 -22.97 0 -0.01 15.14 -0.01 -0.01 0 -0.01 Trading Companies & Distributors Capital Goods Industrials
690580 Tsingtao Brewery Co., Ltd. Class H 0.02 -0.72 -0.01 0 0 0 0.02 -0.72 -0.01 0 0 0 Beverages Food Beverage & Tobacco Consumer Staples
SC Santander Consumer USA Holdings, Inc. 0.03 -2.15 -0.01 0.01 -23.78 0 0.03 21.63 -0.01 -0.01 0 -0.01 Consumer Finance Diversified Financials Financials
HLT Hilton Worldwide Holdings, Inc. 0 0.05 0 0.01 14.7 0 -0.01 -14.66 0 -0.01 0 -0.01 Hotels Restaurants & Leisure Consumer Services Consumer Discretionary
CASH_CAD_7 Canadian Dollar Cash 0.01 -5.41 0 0 0 0 0.01 -5.41 0 0 0 0 @NA @NA Cash
CASH_EUR_13 Euro Cash 0.01 -8.33 0 0 0 0 0.01 -8.33 0 0 0 0 @NA @NA Cash
CASH_HKD_17 Hong Kong Dollar Cash 0.01 0.07 0 0 0 0 0.01 0.07 0 0 0 0 @NA @NA @NA
CASH_GBP_16 Great British Pound Cash 0.02 -3.84 0 0 0 0 0.02 -3.84 0 0 0 0 @NA @NA Cash
BR Broadridge Financial Solutions, Inc. 0.07 -4.82 0 0.02 20.73 0 0.05 -25.56 0 -0.01 0 -0.01 It Services Software & Services Information Technology
CASH_USD_2 United States Dollar Cash 0.13 0.03 0 0 0 0 0.13 0.03 0 0.45 0 0.45 @NA @NA Cash
CASH_USD_33 DST Unsettled Cash 0.15 0.03 0 0 0 0 0.15 0.03 0 -0.07 0 -0.07 @NA @NA @NA
B0CCH4 Heineken Holding N.V. 0.21 -1.35 0 0 0 0 0.21 -1.35 0 -0.04 0 -0.04 Beverages Food Beverage & Tobacco Consumer Staples
BBBY Bed Bath & Beyond Inc. 0 -1.04 0 0.07 -6.47 -0.01 -0.06 5.44 0.01 0.02 0 0.02 Specialty Retail Retailing Consumer Discretionary
DEO Diageo plc Sponsored ADR 0.98 0.59 0.01 0 0 0 0.98 0.59 0.01 -0.15 0 -0.15 Beverages Food Beverage & Tobacco Consumer Staples
NTAP NetApp, Inc. 1.52 4.17 0.02 0.06 4.17 0 1.46 0 0.02 -0.2 0 -0.2 Technology Hardware Storage & Peripherals Technology Hardware & Equipment Information Technology
OXY Occidental Petroleum Corporation 0.31 1.1 0.01 0.36 -8.81 -0.02 -0.04 9.91 0.03 0.05 0 0.05 Oil Gas & Consumable Fuels Energy Energy
CSLT Castlight Health, Inc. Class B 0.03 12.02 0.03 0 -16.8 0 0.03 28.82 0.03 0.02 0 0.02 Health Care Technology Health Care Equipment & Services Health Care
AAPL Apple Inc. 3.87 26.09 1.16 2.61 48.63 1.12 1.25 -22.53 0.03 0.03 0 0.03 Technology Hardware Storage & Peripherals Technology Hardware & Equipment Information Technology
JPM JPMorgan Chase & Co. 2.64 10.07 0.12 1.03 10.07 0.09 1.61 0 0.03 -0.14 0 -0.14 Banks Banks Financials
EBAY eBay Inc. 0.4 1.07 0.06 0.32 7.15 0.02 0.08 -6.08 0.04 -0.07 0 -0.07 Internet Software & Services Software & Services Information Technology
SLB Schlumberger NV 0.99 -1.09 0.06 0.61 -1.09 0.02 0.38 0 0.04 -0.02 0 -0.02 Energy Equipment & Services Energy Energy
SBUX Starbucks Corporation 1.36 0.62 0.05 0.27 0.62 0 1.1 0 0.06 -0.13 0 -0.13 Hotels Restaurants & Leisure Consumer Services Consumer Discretionary
AVY Avery Dennison Corporation 2.13 3.92 0.07 0.02 3.92 0 2.11 0 0.06 -0.26 0 -0.26 Containers & Packaging Materials Materials
403197 adidas AG 0.43 4.08 0.07 0 0 0 0.43 4.08 0.07 0 0 0 Textiles Apparel & Luxury Goods Consumer Durables & Apparel Consumer Discretionary
BABA Alibaba Group Holding Ltd. Sponsored ADR 0.06 61.6 0.11 0 0 0 0.06 61.6 0.11 0.1 0 0.1 Internet Software & Services Software & Services Information Technology
IHS IHS Inc. Class A 1.14 8.41 0.11 0.04 8.41 0 1.1 0 0.11 -0.06 0 -0.06 Professional Services Commercial & Professional Services Industrials
LLL L-3 Communications Holdings, Inc. 0.43 10.45 0.13 0.05 22.25 0.01 0.38 -11.8 0.12 0.07 0 0.07 Aerospace & Defense Capital Goods Industrials
GOOGL Google Inc. Class A 2.26 2.05 0.2 0.98 2.05 0.08 1.28 0 0.12 -0.07 0 -0.07 Internet Software & Services Software & Services Information Technology
TROW T. Rowe Price Group 2.36 5.37 0.12 0.1 5.37 0.01 2.26 0 0.12 -0.22 0 -0.22 Capital Markets Diversified Financials Financials
QCOM QUALCOMM Incorporated 4.6 1.98 0.18 0.61 1.98 0.02 3.98 0 0.16 -0.44 0 -0.44 Communications Equipment Technology Hardware & Equipment Information Technology
48354 SABMiller plc 1.42 7.94 0.17 0 0 0 1.42 7.94 0.17 -0.05 0 -0.05 Beverages Food Beverage & Tobacco Consumer Staples
WDAY Workday, Inc. Class A 0.83 14.36 0.18 0.03 3.8 0 0.8 10.55 0.18 0.04 0 0.04 Software Software & Services Information Technology
LPX Louisiana-Pacific Corporation 0.83 8.79 0.18 0.01 -5.94 0 0.82 14.73 0.18 0.06 0 0.06 Paper & Forest Products Materials Materials
NTRS Northern Trust Corporation 1.2 17.77 0.2 0.07 17.66 0.01 1.13 0.1 0.19 0.02 0 0.02 Capital Markets Diversified Financials Financials
TPX Tempur Sealy International Inc 1.84 8.55 0.2 0.02 8.55 0 1.83 0 0.2 -0.09 0 -0.09 Household Durables Consumer Durables & Apparel Consumer Discretionary
MS Morgan Stanley 2.86 15.06 0.38 0.23 15.06 0.03 2.63 0 0.34 -0.05 0 -0.05 Capital Markets Diversified Financials Financials
AHS AMN Healthcare Services, Inc. 1.55 27.09 0.35 0 27.09 0 1.55 0 0.35 0.11 0 0.11 Health Care Providers & Services Health Care Equipment & Services Health Care
GS Goldman Sachs Group, Inc. 3.48 13.53 0.4 0.37 13.53 0.04 3.11 0 0.35 -0.11 0 -0.11 Capital Markets Diversified Financials Financials
BAC Bank of America Corporation 4.8 9.57 0.44 0.81 9.57 0.07 3.98 0 0.37 -0.2 0 -0.2 Banks Banks Financials
GPI Group 1 Automotive, Inc. 0.23 19.74 0.38 0.01 32.8 0 0.22 -13.06 0.38 0.22 0 0.22 Specialty Retail Retailing Consumer Discretionary
LOW Lowe's Companies, Inc. 1.37 38.91 0.46 0.24 38.91 0.09 1.13 0 0.38 0.2 0 0.2 Specialty Retail Retailing Consumer Discretionary
AIG American International Group, Inc. 3.38 11.86 0.42 0.36 11.86 0.05 3.02 0 0.38 -0.07 0 -0.07 Insurance Insurance Financials
APOL Apollo Education Group, Inc. Class A 0.68 9.05 0.4 0.01 22.24 0 0.67 -13.19 0.4 0.32 0 0.32 Diversified Consumer Services Consumer Services Consumer Discretionary
C Citigroup Inc. 1.74 8.44 0.41 0.72 3.39 0.01 1.03 5.05 0.4 0.23 0 0.23 Banks Banks Financials
KMX CarMax, Inc. 0.93 30.72 0.41 0.05 10.85 0.01 0.88 19.87 0.41 0.25 0 0.25 Specialty Retail Retailing Consumer Discretionary
FB Facebook, Inc. Class A 4.28 12.07 0.72 0.57 60.35 0.27 3.71 -48.27 0.45 -0.07 0 -0.07 Internet Software & Services Software & Services Information Technology
AB AllianceBernstein Holding L.P. 2.6 24.78 0.46 0 0 0 2.6 24.78 0.46 0.06 0 0.06 Capital Markets Diversified Financials Financials
HAWKB Blackhawk Network Holdings Inc Class B 0.64 49.58 0.47 0 0 0 0.64 49.58 0.47 0.36 0 0.36 It Services Software & Services Information Technology
ST Sensata Technologies Holding NV 1.73 28.85 0.48 0 0 0 1.73 28.85 0.48 0.22 0 0.22 Electrical Equipment Capital Goods Industrials
URI United Rentals, Inc. 1.38 34.91 0.52 0.04 55.41 0.02 1.33 -20.5 0.5 0.28 0 0.28 Trading Companies & Distributors Capital Goods Industrials
NVR NVR, Inc. 1.85 32.17 0.59 0.02 32.17 0.01 1.82 0 0.58 0.28 0 0.28 Household Durables Consumer Durables & Apparel Consumer Discretionary
TDG TransDigm Group Incorporated 1.56 44.29 0.62 0.04 44.29 0.02 1.52 0 0.6 0.36 0 0.36 Aerospace & Defense Capital Goods Industrials
EMC EMC Corporation 2.74 29.41 0.72 0.26 29.41 0.07 2.48 0 0.65 0.26 0 0.26 Technology Hardware Storage & Peripherals Technology Hardware & Equipment Information Technology
LNKD LinkedIn Corporation Class A 1.04 45.22 0.66 0.09 -2.44 0 0.95 47.66 0.66 0.49 0 0.49 Internet Software & Services Software & Services Information Technology
PAY VeriFone Systems, Inc. 0.87 28.02 0.7 0.02 39.21 0.01 0.85 -11.19 0.69 0.59 0 0.59 It Services Software & Services Information Technology
AAP Advance Auto Parts, Inc. 2.07 34 0.95 0.04 44.37 0.02 2.03 -10.37 0.93 0.57 0 0.57 Specialty Retail Retailing Consumer Discretionary
WFT Weatherford International plc 1.39 38.8 0.97 0 0 0 1.39 38.8 0.97 0.79 0 0.79 Energy Equipment & Services Energy Energy
LEN Lennar Corporation Class A 4.58 33.17 1.5 0.03 33.17 0.01 4.54 0 1.49 0.75 0 0.75 Household Durables Consumer Durables & Apparel Consumer Discretionary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment