From d74a3102cf9c50fce118e2b812138fdaf7d3dfa0 Mon Sep 17 00:00:00 2001 From: Bob Monteverde Date: Wed, 14 Nov 2012 17:17:59 -0500 Subject: [PATCH 1/2] Issue #322: Disable cumulative series when they go bellow 95% to prevent scale distortion and calculation errors when a series loses 100% or more --- examples/cumulativeLineChart.html | 26 +++++++++++++++++++++++ nv.d3.js | 34 +++++++++++++++++++++++-------- nv.d3.min.js | 10 ++++----- src/models/cumulativeLineChart.js | 34 +++++++++++++++++++++++-------- 4 files changed, 83 insertions(+), 21 deletions(-) diff --git a/examples/cumulativeLineChart.html b/examples/cumulativeLineChart.html index 2070ef5..9c420bc 100644 --- a/examples/cumulativeLineChart.html +++ b/examples/cumulativeLineChart.html @@ -79,6 +79,32 @@ nv.addGraph(function() { function cumulativeTestData() { + + + + return [ + { + key: "Long", + values: [ [ 1083297600000 , -2.974623048543] , [ 1085976000000 , -1.7740300785979] , [ 1088568000000 , 4.4681318138177] , [ 1091246400000 , 7.0242541001353] , [ 1093924800000 , 7.5709603667586] , [ 1096516800000 , 20.612245065736] , [ 1099195200000 , 21.698065237316] , [ 1101790800000 , 40.501189458018] , [ 1104469200000 , 50.464679413194] , [ 1107147600000 , 48.917421973355] , [ 1109566800000 , 63.750936549160] , [ 1112245200000 , 59.072499126460] , [ 1114833600000 , 43.373158880492] , [ 1117512000000 , 54.490918947556] , [ 1120104000000 , 56.661178852079] , [ 1122782400000 , 73.450103545496] , [ 1125460800000 , 71.714526354907] , [ 1128052800000 , 85.221664349607] , [ 1130734800000 , 77.769261392481] , [ 1133326800000 , 95.966528716500] , [ 1136005200000 , 107.59132116397] , [ 1138683600000 , 127.25740096723] , [ 1141102800000 , 122.13917498830] , [ 1143781200000 , 126.53657279774] , [ 1146369600000 , 132.39300992970] , [ 1149048000000 , 120.11238242904] , [ 1151640000000 , 118.41408917750] , [ 1154318400000 , 107.92918924621] , [ 1156996800000 , 110.28057249569] , [ 1159588800000 , 117.20485334692] , [ 1162270800000 , 141.33556756948] , [ 1164862800000 , 159.59452727893] , [ 1167541200000 , 167.09801853304] , [ 1170219600000 , 185.46849659215] , [ 1172638800000 , 184.82474099990] , [ 1175313600000 , 195.63155213887] , [ 1177905600000 , 207.40597044171] , [ 1180584000000 , 230.55966698196] , [ 1183176000000 , 239.55649035292] , [ 1185854400000 , 241.35915085208] , [ 1188532800000 , 239.89428956243] , [ 1191124800000 , 260.47781917715] , [ 1193803200000 , 276.39457482225] , [ 1196398800000 , 258.66530682672] , [ 1199077200000 , 250.98846121893] , [ 1201755600000 , 226.89902618127] , [ 1204261200000 , 227.29009273807] , [ 1206936000000 , 218.66476654350] , [ 1209528000000 , 232.46605902918] , [ 1212206400000 , 253.25667081117] , [ 1214798400000 , 235.82505363925] , [ 1217476800000 , 229.70112774254] , [ 1220155200000 , 225.18472705952] , [ 1222747200000 , 189.13661746552] , [ 1225425600000 , 149.46533007301] , [ 1228021200000 , 131.00340772114] , [ 1230699600000 , 135.18341728866] , [ 1233378000000 , 109.15296887173] , [ 1235797200000 , 84.614772549760] , [ 1238472000000 , 100.60810015326] , [ 1241064000000 , 141.50134895610] , [ 1243742400000 , 142.50405083675] , [ 1246334400000 , 139.81192372672] , [ 1249012800000 , 177.78205544583] , [ 1251691200000 , 194.73691933074] , [ 1254283200000 , 209.00838460225] , [ 1256961600000 , 198.19855877420] , [ 1259557200000 , 222.37102417812] , [ 1262235600000 , 234.24581081250] , [ 1264914000000 , 228.26087689346] , [ 1267333200000 , 248.81895126250] , [ 1270008000000 , 270.57301075186] , [ 1272600000000 , 292.64604322550] , [ 1275278400000 , 265.94088520518] , [ 1277870400000 , 237.82887467569] , [ 1280548800000 , 265.55973314204] , [ 1283227200000 , 248.30877330928] , [ 1285819200000 , 278.14870066912] , [ 1288497600000 , 292.69260960288] , [ 1291093200000 , 300.84263809599] , [ 1293771600000 , 326.17253914628] , [ 1296450000000 , 337.69335966505] , [ 1298869200000 , 339.73260965121] , [ 1301544000000 , 346.87865120765] , [ 1304136000000 , 347.92991526628] , [ 1306814400000 , 342.04627502669] , [ 1309406400000 , 333.45386231233] , [ 1312084800000 , 323.15034181243] , [ 1314763200000 , 295.66126882331] , [ 1317355200000 , 251.48014579253] , [ 1320033600000 , 295.15424257905] , [ 1322629200000 , 294.54766764397] , [ 1325307600000 , 295.72906119051] , [ 1327986000000 , 325.73351347613] , [ 1330491600000 , 340.16106061186] , [ 1333166400000 , 345.15514071490] , [ 1335758400000 , 337.10259395679] , [ 1338436800000 , 318.68216333837] , [ 1341028800000 , 317.03683945246] , [ 1343707200000 , 318.53549659997] , [ 1346385600000 , 332.85381464104] , [ 1348977600000 , 337.36534373477] , [ 1351656000000 , 350.27872156161] , [ 1354251600000 , 349.45128876100]] + }, + { + key: "Short", + values: [ [ 1083297600000 , -0.77078283705125] , [ 1085976000000 , -1.8356366650335] , [ 1088568000000 , -5.3121322073127] , [ 1091246400000 , -4.9320975829662] , [ 1093924800000 , -3.9835408823225] , [ 1096516800000 , -6.8694685316805] , [ 1099195200000 , -8.4854877428545] , [ 1101790800000 , -15.933627197384] , [ 1104469200000 , -15.920980069544] , [ 1107147600000 , -12.478685045651] , [ 1109566800000 , -17.297761889305] , [ 1112245200000 , -15.247129891020] , [ 1114833600000 , -11.336459046839] , [ 1117512000000 , -13.298990907415] , [ 1120104000000 , -16.360027000056] , [ 1122782400000 , -18.527929522030] , [ 1125460800000 , -22.176516738685] , [ 1128052800000 , -23.309665368330] , [ 1130734800000 , -21.629973409748] , [ 1133326800000 , -24.186429093486] , [ 1136005200000 , -29.116707312531] , [ 1138683600000 , -37.188037874864] , [ 1141102800000 , -34.689264821198] , [ 1143781200000 , -39.505932105359] , [ 1146369600000 , -45.339572492759] , [ 1149048000000 , -43.849353192764] , [ 1151640000000 , -45.418353922571] , [ 1154318400000 , -44.579281059919] , [ 1156996800000 , -44.027098363370] , [ 1159588800000 , -41.261306759439] , [ 1162270800000 , -47.446018534027] , [ 1164862800000 , -53.413782948909] , [ 1167541200000 , -50.700723647419] , [ 1170219600000 , -56.374090913296] , [ 1172638800000 , -61.754245220322] , [ 1175313600000 , -66.246241587629] , [ 1177905600000 , -75.351650899999] , [ 1180584000000 , -81.699058262032] , [ 1183176000000 , -82.487023368081] , [ 1185854400000 , -86.230055113277] , [ 1188532800000 , -84.746914818507] , [ 1191124800000 , -100.77134971977] , [ 1193803200000 , -109.95435565947] , [ 1196398800000 , -99.605672965057] , [ 1199077200000 , -99.607249394382] , [ 1201755600000 , -94.874614950188] , [ 1204261200000 , -105.35899063105] , [ 1206936000000 , -106.01931193802] , [ 1209528000000 , -110.28883571771] , [ 1212206400000 , -119.60256203030] , [ 1214798400000 , -115.62201315802] , [ 1217476800000 , -106.63824185202] , [ 1220155200000 , -99.848746318951] , [ 1222747200000 , -85.631219602987] , [ 1225425600000 , -63.547909262067] , [ 1228021200000 , -59.753275364457] , [ 1230699600000 , -63.874977883542] , [ 1233378000000 , -56.865697387488] , [ 1235797200000 , -54.285579501988] , [ 1238472000000 , -56.474659581885] , [ 1241064000000 , -63.847137745644] , [ 1243742400000 , -68.754247867325] , [ 1246334400000 , -69.474257009155] , [ 1249012800000 , -75.084828197067] , [ 1251691200000 , -77.101028237237] , [ 1254283200000 , -80.454866854387] , [ 1256961600000 , -78.984349952220] , [ 1259557200000 , -83.041230807854] , [ 1262235600000 , -84.529748348935] , [ 1264914000000 , -83.837470195508] , [ 1267333200000 , -87.174487671969] , [ 1270008000000 , -90.342293007487] , [ 1272600000000 , -93.550928464991] , [ 1275278400000 , -85.833102140765] , [ 1277870400000 , -79.326501831592] , [ 1280548800000 , -87.986196903537] , [ 1283227200000 , -85.397862121771] , [ 1285819200000 , -94.738167050020] , [ 1288497600000 , -98.661952897151] , [ 1291093200000 , -99.609665952708] , [ 1293771600000 , -103.57099836183] , [ 1296450000000 , -104.04353411322] , [ 1298869200000 , -108.21382792587] , [ 1301544000000 , -108.74006900920] , [ 1304136000000 , -112.07766650960] , [ 1306814400000 , -109.63328199118] , [ 1309406400000 , -106.53578966772] , [ 1312084800000 , -103.16480871469] , [ 1314763200000 , -95.945078001828] , [ 1317355200000 , -81.226687340874] , [ 1320033600000 , -90.782206596168] , [ 1322629200000 , -89.484445370113] , [ 1325307600000 , -88.514723135326] , [ 1327986000000 , -93.381292724320] , [ 1330491600000 , -97.529705609172] , [ 1333166400000 , -99.520481439189] , [ 1335758400000 , -99.430184898669] , [ 1338436800000 , -93.349934521973] , [ 1341028800000 , -95.858475286491] , [ 1343707200000 , -95.522755836605] , [ 1346385600000 , -98.503848862036] , [ 1348977600000 , -101.49415251896] , [ 1351656000000 , -101.50099325672] , [ 1354251600000 , -99.487094927489]] + }, + { + key: "Gross", + values: [ [ 1083297600000 , -3.7454058855943] , [ 1085976000000 , -3.6096667436314] , [ 1088568000000 , -0.8440003934950] , [ 1091246400000 , 2.0921565171691] , [ 1093924800000 , 3.5874194844361] , [ 1096516800000 , 13.742776534056] , [ 1099195200000 , 13.212577494462] , [ 1101790800000 , 24.567562260634] , [ 1104469200000 , 34.543699343650] , [ 1107147600000 , 36.438736927704] , [ 1109566800000 , 46.453174659855] , [ 1112245200000 , 43.825369235440] , [ 1114833600000 , 32.036699833653] , [ 1117512000000 , 41.191928040141] , [ 1120104000000 , 40.301151852023] , [ 1122782400000 , 54.922174023466] , [ 1125460800000 , 49.538009616222] , [ 1128052800000 , 61.911998981277] , [ 1130734800000 , 56.139287982733] , [ 1133326800000 , 71.780099623014] , [ 1136005200000 , 78.474613851439] , [ 1138683600000 , 90.069363092366] , [ 1141102800000 , 87.449910167102] , [ 1143781200000 , 87.030640692381] , [ 1146369600000 , 87.053437436941] , [ 1149048000000 , 76.263029236276] , [ 1151640000000 , 72.995735254929] , [ 1154318400000 , 63.349908186291] , [ 1156996800000 , 66.253474132320] , [ 1159588800000 , 75.943546587481] , [ 1162270800000 , 93.889549035453] , [ 1164862800000 , 106.18074433002] , [ 1167541200000 , 116.39729488562] , [ 1170219600000 , 129.09440567885] , [ 1172638800000 , 123.07049577958] , [ 1175313600000 , 129.38531055124] , [ 1177905600000 , 132.05431954171] , [ 1180584000000 , 148.86060871993] , [ 1183176000000 , 157.06946698484] , [ 1185854400000 , 155.12909573880] , [ 1188532800000 , 155.14737474392] , [ 1191124800000 , 159.70646945738] , [ 1193803200000 , 166.44021916278] , [ 1196398800000 , 159.05963386166] , [ 1199077200000 , 151.38121182455] , [ 1201755600000 , 132.02441123108] , [ 1204261200000 , 121.93110210702] , [ 1206936000000 , 112.64545460548] , [ 1209528000000 , 122.17722331147] , [ 1212206400000 , 133.65410878087] , [ 1214798400000 , 120.20304048123] , [ 1217476800000 , 123.06288589052] , [ 1220155200000 , 125.33598074057] , [ 1222747200000 , 103.50539786253] , [ 1225425600000 , 85.917420810943] , [ 1228021200000 , 71.250132356683] , [ 1230699600000 , 71.308439405118] , [ 1233378000000 , 52.287271484242] , [ 1235797200000 , 30.329193047772] , [ 1238472000000 , 44.133440571375] , [ 1241064000000 , 77.654211210456] , [ 1243742400000 , 73.749802969425] , [ 1246334400000 , 70.337666717565] , [ 1249012800000 , 102.69722724876] , [ 1251691200000 , 117.63589109350] , [ 1254283200000 , 128.55351774786] , [ 1256961600000 , 119.21420882198] , [ 1259557200000 , 139.32979337027] , [ 1262235600000 , 149.71606246357] , [ 1264914000000 , 144.42340669795] , [ 1267333200000 , 161.64446359053] , [ 1270008000000 , 180.23071774437] , [ 1272600000000 , 199.09511476051] , [ 1275278400000 , 180.10778306442] , [ 1277870400000 , 158.50237284410] , [ 1280548800000 , 177.57353623850] , [ 1283227200000 , 162.91091118751] , [ 1285819200000 , 183.41053361910] , [ 1288497600000 , 194.03065670573] , [ 1291093200000 , 201.23297214328] , [ 1293771600000 , 222.60154078445] , [ 1296450000000 , 233.35556801977] , [ 1298869200000 , 231.22452435045] , [ 1301544000000 , 237.84432503045] , [ 1304136000000 , 235.55799131184] , [ 1306814400000 , 232.11873570751] , [ 1309406400000 , 226.62381538123] , [ 1312084800000 , 219.34811113539] , [ 1314763200000 , 198.69242285581] , [ 1317355200000 , 168.90235629066] , [ 1320033600000 , 202.64725756733] , [ 1322629200000 , 203.05389378105] , [ 1325307600000 , 204.85986680865] , [ 1327986000000 , 229.77085616585] , [ 1330491600000 , 239.65202435959] , [ 1333166400000 , 242.33012622734] , [ 1335758400000 , 234.11773262149] , [ 1338436800000 , 221.47846307887] , [ 1341028800000 , 216.98308827912] , [ 1343707200000 , 218.37781386755] , [ 1346385600000 , 229.39368622736] , [ 1348977600000 , 230.54656412916] , [ 1351656000000 , 243.06087025523] , [ 1354251600000 , 244.24733578385]] + }, + { + key: "S&P 1500", + values: [ [ 1083297600000 , -1.7798428181819] , [ 1085976000000 , -0.36883324836999] , [ 1088568000000 , 1.7312581046040] , [ 1091246400000 , -1.8356125950460] , [ 1093924800000 , -1.5396564170877] , [ 1096516800000 , -0.16867791409247] , [ 1099195200000 , 1.3754263993413] , [ 1101790800000 , 5.8171640898041] , [ 1104469200000 , 9.4350145241608] , [ 1107147600000 , 6.7649081510160] , [ 1109566800000 , 9.1568499314776] , [ 1112245200000 , 7.2485090994419] , [ 1114833600000 , 4.8762222306595] , [ 1117512000000 , 8.5992339354652] , [ 1120104000000 , 9.0896517982086] , [ 1122782400000 , 13.394644048577] , [ 1125460800000 , 12.311842010760] , [ 1128052800000 , 13.221003650717] , [ 1130734800000 , 11.218481009206] , [ 1133326800000 , 15.565352598445] , [ 1136005200000 , 15.623703865926] , [ 1138683600000 , 19.275255326383] , [ 1141102800000 , 19.432433717836] , [ 1143781200000 , 21.232881244655] , [ 1146369600000 , 22.798299192958] , [ 1149048000000 , 19.006125095476] , [ 1151640000000 , 19.151889158536] , [ 1154318400000 , 19.340022855452] , [ 1156996800000 , 22.027934841859] , [ 1159588800000 , 24.903300681329] , [ 1162270800000 , 29.146492833877] , [ 1164862800000 , 31.781626082589] , [ 1167541200000 , 33.358770738428] , [ 1170219600000 , 35.622684613497] , [ 1172638800000 , 33.332821711366] , [ 1175313600000 , 34.878748635832] , [ 1177905600000 , 40.582332613844] , [ 1180584000000 , 45.719535502920] , [ 1183176000000 , 43.239344722386] , [ 1185854400000 , 38.550955100342] , [ 1188532800000 , 40.585368816283] , [ 1191124800000 , 45.601374057981] , [ 1193803200000 , 48.051404337892] , [ 1196398800000 , 41.582581696032] , [ 1199077200000 , 40.650580792748] , [ 1201755600000 , 32.252222066493] , [ 1204261200000 , 28.106390258553] , [ 1206936000000 , 27.532698196687] , [ 1209528000000 , 33.986390463852] , [ 1212206400000 , 36.302660526438] , [ 1214798400000 , 25.015574480172] , [ 1217476800000 , 23.989494069029] , [ 1220155200000 , 25.934351445531] , [ 1222747200000 , 14.627592011699] , [ 1225425600000 , -5.2249403809749] , [ 1228021200000 , -12.330933408050] , [ 1230699600000 , -11.000291508188] , [ 1233378000000 , -18.563864948088] , [ 1235797200000 , -27.213097001687] , [ 1238472000000 , -20.834133840523] , [ 1241064000000 , -12.717886701719] , [ 1243742400000 , -8.1644613083526] , [ 1246334400000 , -7.9108408918201] , [ 1249012800000 , -0.77002391591209] , [ 1251691200000 , 2.8243816569672] , [ 1254283200000 , 6.8761411421070] , [ 1256961600000 , 4.5060912230294] , [ 1259557200000 , 10.487179794349] , [ 1262235600000 , 13.251375597594] , [ 1264914000000 , 9.2207594803415] , [ 1267333200000 , 12.836276936538] , [ 1270008000000 , 19.816793904978] , [ 1272600000000 , 22.156787167211] , [ 1275278400000 , 12.518039090576] , [ 1277870400000 , 6.4253587440854] , [ 1280548800000 , 13.847372028409] , [ 1283227200000 , 8.5454736090364] , [ 1285819200000 , 18.542801953304] , [ 1288497600000 , 23.037064683183] , [ 1291093200000 , 23.517422401888] , [ 1293771600000 , 31.804723416068] , [ 1296450000000 , 34.778247386072] , [ 1298869200000 , 39.584883855230] , [ 1301544000000 , 40.080647664875] , [ 1304136000000 , 44.180050667889] , [ 1306814400000 , 42.533535927221] , [ 1309406400000 , 40.105374449011] , [ 1312084800000 , 37.014659267156] , [ 1314763200000 , 29.263745084262] , [ 1317355200000 , 19.637463417584] , [ 1320033600000 , 33.157645345770] , [ 1322629200000 , 32.895053150988] , [ 1325307600000 , 34.111544824647] , [ 1327986000000 , 40.453985817473] , [ 1330491600000 , 46.435700783313] , [ 1333166400000 , 51.062385488671] , [ 1335758400000 , 50.130448220658] , [ 1338436800000 , 41.035476682018] , [ 1341028800000 , 46.591932296457] , [ 1343707200000 , 48.349391180634] , [ 1346385600000 , 51.913011286919] , [ 1348977600000 , 55.747238313752] , [ 1351656000000 , 52.991824077209] , [ 1354251600000 , 49.556311883284]] + } + ]; + + + + + return [ { key: "Series 1", diff --git a/nv.d3.js b/nv.d3.js index 0658358..76d5f46 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -1875,6 +1875,20 @@ nv.models.cumulativeLineChart = function() { wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + // Show error if series goes below 100% + var tempDisabled = data.filter(function(d) { return d.tempDisabled }); + + wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates + if (tempDisabled.length) { + wrap.append('text').attr('class', 'tempDisabled') + .attr('x', availableWidth / 2) + .attr('y', '-.71em') + .style('text-anchor', 'end') + .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); + } + + + //------------------------------------------------------------ // Main Chart Component(s) @@ -1892,12 +1906,12 @@ nv.models.cumulativeLineChart = function() { .height(availableHeight) .color(data.map(function(d,i) { return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); + }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled })); var linesWrap = g.select('.nv-linesWrap') - .datum(data.filter(function(d) { return !d.disabled })) + .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); //d3.transition(linesWrap).call(lines); linesWrap.call(lines); @@ -2124,16 +2138,20 @@ nv.models.cumulativeLineChart = function() { return data.map(function(line, i) { var v = lines.y()(line.values[idx], idx); + //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue + if (v < -.95) { + //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100) + line.tempDisabled = true; + return line; + } + + line.tempDisabled = false; + line.values = line.values.map(function(point, pointIndex) { point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) }; return point; }) - /* - TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue - if (v < -.9) { - //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100) - } - */ + return line; }) } diff --git a/nv.d3.min.js b/nv.d3.min.js index 4b1c596..2b9d983 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,5 +1,5 @@ -(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(g=document.body.scrollWidth?m:m-16,l=window.innerHeight>=document.body.scrollHeight?l:l-16;var r=function(a){var b=q;do isNaN(a.offsetTop)||(b+=a.offsetTop);while(a=a.offsetParent);return b},s=function(a){var b=p;do isNaN(a.offsetLeft)||(b+=a.offsetLeft);while(a=a.offsetParent);return b};switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2;var t=s(h),u=r(h);to?b[0]+e:o-t+p),un+m&&(q=n+m-u+q-j);break;case"w":p=b[0]+e,q=b[1]-j/2,t+k>l&&(p=b[0]-k-e),un+m&&(q=n-j-5);break;case"n":p=b[0]-k/2-5,q=b[1]+e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),u+j>n+m&&(q=n+m-u+q-j);break;case"s":p=b[0]-k/2,q=b[1]-j-e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),n>u&&(q=n)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(b){if(!arguments.length)return a.utils.defaultColor();return Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);d||(d=c.length);return typeof a[g]!="undefined"?typeof a[g]=="function"?a[g]():a[g]:c[--d]}},a.utils.pjax=function(b,c){function d(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})}d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.models.axis=function(){function o(d){d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),r=q.append("g"),s=p.select("g");m!==null?a.ticks(m):(a.orient()=="top"||a.orient()=="bottom")&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();t==null&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);u.exit().remove();switch(a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)-12:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"end").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+12:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+n(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}u.text(function(a){return a}),g&&(a.orient()==="left"||a.orient()==="right")&&(s.selectAll("g").each(function(a,b){if(e(a)e.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),e.domain()[0]==e.domain()[1]&&e.domain()[0]==0&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1}));if(g&&(a.orient()==="top"||a.orient()==="bottom")){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a,b){if(e(a)B[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),n=e.copy()});return o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!0,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.ticks=function(a){if(!arguments.length)return m;m=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.axisLabel=function(a){if(!arguments.length)return f;f=a;return o},o.showMaxMin=function(a){if(!arguments.length)return g;g=a;return o},o.highlightZero=function(a){if(!arguments.length)return h;h=a;return o},o.scale=function(b){if(!arguments.length)return e;e=b,a.scale(e),l=typeof e.rangeBands=="function",d3.rebind(o,e,"domain","range","rangeBand","rangeBands");return o},o.rotateYLabel=function(a){if(!arguments.length)return j;j=a;return o},o.rotateLabels=function(a){if(!arguments.length)return i;i=a;return o},o.staggerLabels=function(a){if(!arguments.length)return k;k=a;return o};return o},a.models.historicalBar=function(){function q(a){a.each(function(a){var q=c-b.left-b.right,r=d-b.top-b.bottom,s=d3.select(this);f.domain(n||d3.extent(a[0].values.map(h).concat(j))).range([0,q]),g.domain(o||d3.extent(a[0].values.map(i).concat(k))).range([r,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var t=s.selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-bars"),t.attr("transform","translate("+b.left+","+b.top+")"),s.on("click",function(a,b){p.chartClick({data:a,index:b,pos:d3.event,id:e})}),v.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",r),z.attr("clip-path",l?"url(#nv-chart-clip-path-"+e+")":"");var A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("x",0).attr("y",function(a,b){return g(Math.max(0,i(a,b)))}).attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("fill",function(a,b){return m(a,b)}).attr("class",function(a,b,c){return(i(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(f(h(b,c))-q/a[0].values.length*.5)+",0)"}).attr("width",q/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)})});return q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[],k=[0],l=!0,m=a.utils.defaultColor(),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");q.dispatch=p,q.x=function(a){if(!arguments.length)return h;h=a;return q},q.y=function(a){if(!arguments.length)return i;i=a;return q},q.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return q},q.width=function(a){if(!arguments.length)return c;c=a;return q},q.height=function(a){if(!arguments.length)return d;d=a;return q},q.xScale=function(a){if(!arguments.length)return f;f=a;return q},q.yScale=function(a){if(!arguments.length)return g;g=a;return q},q.xDomain=function(a){if(!arguments.length)return n;n=a;return q},q.yDomain=function(a){if(!arguments.length)return o;o=a;return q},q.forceX=function(a){if(!arguments.length)return j;j=a;return q},q.forceY=function(a){if(!arguments.length)return k;k=a;return q},q.clipEdge=function(a){if(!arguments.length)return l;l=a;return q},q.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return q},q.id=function(a){if(!arguments.length)return e;e=a;return q};return q},a.models.bullet=function(){function n(a){a.each(function(a,c){var h=i-b.left-b.right,k=j-b.top-b.bottom,n=d3.select(this),o=e.call(this,a,c).slice().sort(d3.descending),p=f.call(this,a,c).slice().sort(d3.descending),q=g.call(this,a,c).slice().sort(d3.descending),r=d3.scale.linear().domain([0,Math.max(o[0],p[0],q[0])]).range(d?[h,0]:[0,h]),s=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(r.range());this.__chart__=r;var t=n.selectAll("g.nv-wrap.nv-bullet").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),v=u.append("g"),w=t.select("g");t.attr("transform","translate("+b.left+","+b.top+")");var x=function(a){return Math.abs(s(a)-s(0))},y=function(a){return Math.abs(r(a)-r(0))},z=w.selectAll("rect.nv-range").data(o);z.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",x).attr("height",k).attr("x",d?s:0).on("mouseover",function(a,b){m.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(z).attr("x",d?r:0).attr("width",y).attr("height",k);var A=w.selectAll("rect.nv-measure").data(q);A.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).style("fill",function(a,b){return l(a,b)}).attr("width",x).attr("height",k/3).attr("x",d?s:0).attr("y",k/3).on("mouseover",function(a){m.elementMouseover({value:a,label:"Current",pos:[r(a),k/2]})}).on("mouseout",function(a){m.elementMouseout({value:a,label:"Current"})}),d3.transition(A).attr("width",y).attr("height",k/3).attr("x",d?r:0).attr("y",k/3);var B=w.selectAll("path.nv-markerTriangle").data(p),C=k/6;B.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+s(a)+","+k/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(a,b){m.elementMouseover({value:a,label:"Previous",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:"Previous"})}),d3.transition(B).attr("transform",function(a){return"translate("+r(a)+","+k/2+")"}),B.exit().remove()}),d3.timer.flush();return n}var b={top:0,right:0,bottom:0,left:0},c="left",d=!1,e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=[0],i=380,j=30,k=null,l=a.utils.getColor(["#1f77b4"]),m=d3.dispatch("elementMouseover","elementMouseout");n.dispatch=m,n.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return n},n.ranges=function(a){if(!arguments.length)return e;e=a;return n},n.markers=function(a){if(!arguments.length)return f;f=a;return n},n.measures=function(a){if(!arguments.length)return g;g=a;return n},n.forceX=function(a){if(!arguments.length)return h;h=a;return n},n.width=function(a){if(!arguments.length)return i;i=a;return n},n.height=function(a){if(!arguments.length)return j;j=a;return n},n.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return n},n.tickFormat=function(a){if(!arguments.length)return k;k=a;return n},n.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b);return n};return n},a.models.bulletChart=function(){function q(a){a.each(function(c,m){var r=d3.select(this),s=(i||parseInt(r.style("width"))||960)-e.left-e.right,t=j-e.top-e.bottom,u=this;q.update=function(){q(a)},q.container=this;if(!c||!f.call(this,c,m)){var v=r.selectAll(".nv-noData").data([n]);v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",e.left+s/2).attr("y",18+e.top+t/2).text(function(a){return a});return q}r.selectAll(".nv-noData").remove();var w=f.call(this,c,m).slice().sort(d3.descending),x=g.call(this,c,m).slice().sort(d3.descending),y=h.call(this,c,m).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([c]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+e.left+","+e.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(d?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(D.range());this.__chart__=D;var F=function(a){return Math.abs(E(a)-E(0))},G=function(a){return Math.abs(D(a)-D(0))},H=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(j-e.top-e.bottom)/2+")");H.append("text").attr("class","nv-title").text(function(a){return a.title}),H.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var I=C.select(".nv-bulletWrap");d3.transition(I).call(b);var J=k||D.tickFormat(s/100),K=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||J(a)}),L=K.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",t).attr("y2",t*7/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",t*7/6).text(J);var M=d3.transition(K).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);M.select("line").attr("y1",t).attr("y2",t*7/6),M.select("text").attr("y",t*7/6),d3.transition(K.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),o.on("tooltipShow",function(a){a.key=data[0].title,l&&p(a,u.parentNode)})}),d3.timer.flush();return q}var b=a.models.bullet(),c="left",d=!1,e={top:5,right:40,bottom:20,left:120},f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=null,j=55,k=null,l=!0,m=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0)+e.left,f=b.pos[1]+(c.offsetTop||0)+e.top,g=m(b.key,b.label,b.value,b,q);a.tooltip.show([d,f],g,b.value<0?"e":"w",null,c)};b.dispatch.on("elementMouseover.tooltip",function(a){o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),q.dispatch=o,q.bullet=b,d3.rebind(q,b,"color"),q.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return q},q.ranges=function(a){if(!arguments.length)return f;f=a;return q},q.markers=function(a){if(!arguments.length)return g;g=a;return q},q.measures=function(a){if(!arguments.length)return h;h=a;return q},q.width=function(a){if(!arguments.length)return i;i=a;return q},q.height=function(a){if(!arguments.length)return j;j=a;return q},q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.tickFormat=function(a){if(!arguments.length)return k;k=a;return q},q.tooltips=function(a){if(!arguments.length)return l;l=a;return q},q.tooltipContent=function(a){if(!arguments.length)return m;m=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.cumulativeLineChart=function(){function y(a,c){return c.map(function(c,d){var e=b.y()(c.values[a],a);c.values=c.values.map(function(a,c){a.display={y:(b.y()(a,c)-e)/(1+e)};return a});return c})}function x(a){a.each(function(o){function Q(){P.data([v]),x.update()}function G(a,b){d3.select(x.container).style("cursor","auto")}function F(a,b){v.x=d3.event.x,v.i=Math.round(u.invert(v.x)),Q()}function E(a,b){d3.select(x.container).style("cursor","ew-resize")}var z=d3.select(this).classed("nv-chart-"+r,!0),A=this,B=(i||parseInt(z.style("width"))||960)-g.left-g.right,C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom;x.update=function(){x(a)},x.container=this;var D=d3.behavior.drag().on("dragstart",E).on("drag",F).on("dragend",G);if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){var H=z.selectAll(".nv-noData").data([s]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",g.left+B/2).attr("y",g.top+C/2).text(function(a){return a});return x}z.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();if(!n){var I=o.filter(function(a){return!a.disabled}).map(function(a,c){var d=d3.extent(a.values,b.y());return[(d[0]-d[1])/(1+d[1]),(d[1]-d[0])/(1+d[0])]}),J=[d3.min(I,function(a){return a[0]}),d3.max(I,function(a){return a[1]})];b.yDomain(J)}else b.yDomain(null);u.domain([0,o[0].values.length-1]).range([0,B]).clamp(!0);var o=y(v.i,o),K=z.selectAll("g.nv-wrap.nv-cumulativeLine").data([o]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),M=K.select("g");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-background"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-legendWrap"),L.append("g").attr("class","nv-controlsWrap"),k&&(e.width(B),M.select(".nv-legendWrap").datum(o).call(e),g.top!=e.height()&&(g.top=e.height(),C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -g.top+")"));if(m){var N=[{key:"Re-scale y-axis",disabled:!n}];f.width(140).color(["#444","#444","#444"]),M.select(".nv-controlsWrap").datum(N).attr("transform","translate(0,"+ -g.top+")").call(f)}K.attr("transform","translate("+g.left+","+g.top+")"),L.select(".nv-background").append("rect"),M.select(".nv-background rect").attr("width",B).attr("height",C),b.y(function(a){return a.display.y}).width(B).height(C).color(o.map(function(a,b){return a.color||h(a,b)}).filter(function(a,b){return!o[b].disabled}));var O=M.select(".nv-linesWrap").datum(o.filter(function(a){return!a.disabled}));O.call(b);var P=O.selectAll(".nv-indexLine").data([v]);P.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(D),P.attr("transform",function(a){return"translate("+u(a.i)+",0)"}).attr("height",C),c.scale(p).tickSubdivide(o[0].values.length>d3.select("body").select("svg").select(".nv-x").selectAll(".tick")[0].length?!0:!1).ticks(Math.min(o[0].values.length,B/70)).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(M.select(".nv-x.nv-axis")).call(c),d.scale(q).ticks(C/36).tickSize(-B,0),d3.transition(M.select(".nv-y.nv-axis")).call(d),M.select(".nv-background rect").on("click",function(){v.x=d3.mouse(this)[0],v.i=Math.round(u.invert(v.x)),Q()}),b.dispatch.on("elementClick",function(a){v.i=a.pointIndex,v.x=u(v.i),Q()}),f.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,n=!b.disabled,a.call(x)}),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),a.call(x)}),t.on("tooltipShow",function(a){l&&w(a,A.parentNode)})});return x}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:30,bottom:50,left:60},h=a.utils.defaultColor(),i=null,j=null,k=!0,l=!0,m=!0,n=!0,o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p,q,r=b.id(),s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var u=d3.scale.linear(),v={i:0,x:0},w=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,x);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),x.dispatch=t,x.lines=b,x.legend=e,x.xAxis=c,x.yAxis=d,d3.rebind(x,b,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),x.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return x},x.width=function(a){if(!arguments.length)return i;i=a;return x},x.height=function(a){if(!arguments.length)return j;j=a;return x},x.color=function(b){if(!arguments.length)return h;h=a.utils.getColor(b),e.color(h);return x},x.showControls=function(a){if(!arguments.length)return m;m=a;return x},x.showLegend=function(a){if(!arguments.length)return k;k=a;return x},x.tooltips=function(a){if(!arguments.length)return l;l=a;return x},x.tooltipContent=function(a){if(!arguments.length)return o;o=a;return x},x.noData=function(a){if(!arguments.length)return s;s=a;return x};return x},a.models.discreteBar=function(){function t(a){a.each(function(a){var e=c-b.left-b.right,t=d-b.top-b.bottom,u=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var v=n&&o?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(n||d3.merge(v).map(function(a){return a.x})).rangeBands([0,e],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([t-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([t,0]),r=r||f,s=s||g.copy().range([g(0),g(0)]);var w=u.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g"),B=w.select("g");A.append("g").attr("class","nv-groups"),w.attr("transform","translate("+b.left+","+b.top+")");var C=w.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(C.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),C.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.75);var D=C.selectAll("g.nv-bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+(f(h(a,b))+f.rangeBand()*.05)+", "+g(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){p.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){p.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()*.9/a.length),l?(E.append("text").attr("text-anchor","middle"),D.select("text").attr("x",f.rangeBand()*.9/2).attr("y",function(a,b){return i(a,b)<0?g(i(a,b))-g(0)+12:-4}).text(function(a,b){return m(i(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}).select("rect").attr("class",q).attr("width",f.rangeBand()*.9/a.length),d3.transition(D).attr("transform",function(a,b){var c=f(h(a,b))+f.rangeBand()*.05,d=i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0))||1)}),r=f.copy(),s=g.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=d3.format(",.2f"),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q="discreteBar",r,s;t.dispatch=p,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return f;f=a;return t},t.yScale=function(a){if(!arguments.length)return g;g=a;return t},t.xDomain=function(a){if(!arguments.length)return n;n=a;return t},t.yDomain=function(a){if(!arguments.length)return o;o=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return e;e=a;return t},t.showValues=function(a){if(!arguments.length)return l;l=a;return t},t.valueFormat=function(a){if(!arguments.length)return m;m=a; -return t},t.rectClass=function(a){if(!arguments.length)return q;q=a;return t};return t},a.models.discreteBarChart=function(){function q(a){a.each(function(h){var k=d3.select(this),r=this,s=(f||parseInt(k.style("width"))||960)-e.left-e.right,t=(g||parseInt(k.style("height"))||400)-e.top-e.bottom;q.update=function(){a.transition().call(q)},q.container=this;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){var u=k.selectAll(".nv-noData").data([n]);u.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),u.attr("x",e.left+s/2).attr("y",e.top+t/2).text(function(a){return a});return q}k.selectAll(".nv-noData").remove(),l=b.xScale(),m=b.yScale();var v=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),z=w.append("defs"),A=v.select("g");w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis"),w.append("g").attr("class","nv-barsWrap"),A.attr("transform","translate("+e.left+","+e.top+")"),b.width(s).height(t);var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(b),z.append("clipPath").attr("id","nv-x-label-clip-"+b.id()).append("rect"),A.select("#nv-x-label-clip-"+b.id()+" rect").attr("width",l.rangeBand()*(i?2:1)).attr("height",16).attr("x",-l.rangeBand()/(i?1:2)),c.scale(l).ticks(s/100).tickSize(-t,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+(b.showValues()&&m.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(c);var C=A.select(".nv-x.nv-axis").selectAll("g");i?C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"}):C.selectAll("text").attr("transform","translate(0,5)"),d.scale(m).ticks(t/36).tickSize(-s,0),d3.transition(A.select(".nv-y.nv-axis")).call(d),o.on("tooltipShow",function(a){j&&p(a,r.parentNode)})});return q}var b=a.models.discreteBar(),c=a.models.axis(),d=a.models.axis(),e={top:15,right:10,bottom:50,left:60},f=null,g=null,h=a.utils.getColor(),i=!1,j=!0,k=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},l,m,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var p=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),l=k(e.series.key,i,j,e,q);a.tooltip.show([g,h],l,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),q.dispatch=o,q.discretebar=b,q.xAxis=c,q.yAxis=d,d3.rebind(q,b,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.width=function(a){if(!arguments.length)return f;f=a;return q},q.height=function(a){if(!arguments.length)return g;g=a;return q},q.color=function(c){if(!arguments.length)return h;h=a.utils.getColor(c),b.color(h);return q},q.staggerLabels=function(a){if(!arguments.length)return i;i=a;return q},q.tooltips=function(a){if(!arguments.length)return j;j=a;return q},q.tooltipContent=function(a){if(!arguments.length)return k;k=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.distribution=function(){function k(a){a.each(function(a){var i=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x",l=d3.select(this);j=j||h;var m=l.selectAll("g.nv-distribution").data([a]),n=m.enter().append("g").attr("class","nvd3 nv-distribution"),o=n.append("g"),p=m.select("g");m.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var r=q.selectAll("line.nv-dist"+e).data(function(a){return a.values});r.enter().append("line").attr(e+"1",function(a,b){return j(f(a,b))}).attr(e+"2",function(a,b){return j(f(a,b))}),d3.transition(q.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(r).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}),j=h.copy()});return k}var b={top:0,right:0,bottom:0,left:0},c=400,d=8,e="x",f=function(a){return a[e]},g=a.utils.defaultColor(),h=d3.scale.linear(),i,j;k.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return k},k.width=function(a){if(!arguments.length)return c;c=a;return k},k.axis=function(a){if(!arguments.length)return e;e=a;return k},k.size=function(a){if(!arguments.length)return d;d=a;return k},k.getData=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.scale=function(a){if(!arguments.length)return h;h=a;return k},k.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b);return k};return k},a.models.indentedTree=function(){function o(a){a.each(function(b){function C(a){var b=a.values||a._values;return b&&b.length}function B(a){return a._values&&a._values.length}function A(a){return a._values&&a._values.length?l:a.values&&a.values.length?m:""}function z(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c){d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&z(a,0,!0)});return!0}if(!C(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),o.update()}var c=0,e=1,f=d3.layout.tree().children(function(a){return a.values}).size([d,i]);o.update=function(){a.transition().call(o)},o.container=this,b[0]||(b[0]={key:h});var p=f.nodes(b[0]),q=d3.select(this).selectAll("div").data([[p]]),r=q.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),s=r.append("table"),t=q.select("table").attr("width","100%").attr("class",k);if(g){var u=s.append("thead"),v=u.append("tr");j.forEach(function(a){v.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var w=t.selectAll("tbody").data(function(a){return a});w.enter().append("tbody"),e=d3.max(p,function(a){return a.depth}),f.size([d,e*i]);var x=w.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++c});x.exit().remove(),x.select("img.nv-treeicon").attr("src",A).classed("folded",B);var y=x.enter().append("tr");j.forEach(function(a,b){var c=y.append("td").style("padding-left",function(a){return(b?0:a.depth*i+12+(A(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("nv-treeicon",!0).classed("nv-folded",B).attr("src",A).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return A(a)?"inline-block":"none"}).on("click",z),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),x.order().on("click",function(a){n.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){n.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){n.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){n.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})});return o}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=!0,h="No Data Available.",i=20,j=[{key:"key",label:"Name",type:"text"}],k=null,l="images/grey-plus.png",m="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),scatter.color(e);return o},o.id=function(a){if(!arguments.length)return f;f=a;return o},o.header=function(a){if(!arguments.length)return g;g=a;return o},o.noData=function(a){if(!arguments.length)return h;h=a;return o},o.columns=function(a){if(!arguments.length)return j;j=a;return o},o.tableClass=function(a){if(!arguments.length)return k;k=a;return o},o.iconOpen=function(a){if(!arguments.length)return l;l=a;return o},o.iconClose=function(a){if(!arguments.length)return m;m=a;return o};return o},a.models.legend=function(){function i(a){a.each(function(a){var i=c-b.left-b.right,j=d3.select(this),l=j.selectAll("g.nv-legend").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),n=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var o=n.selectAll(".nv-series").data(function(a){return a}),p=o.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){h.legendMouseover(a,b)}).on("mouseout",function(a,b){h.legendMouseout(a,b)}).on("click",function(a,b){h.legendClick(a,b)}).on("dblclick",function(a,b){h.legendDblclick(a,b)});p.append("circle").style("stroke-width",2).attr("r",5),p.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),o.classed("disabled",function(a){return a.disabled}),o.exit().remove(),o.select("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}),o.select("text").text(e);if(g){var q=[];o.each(function(a,b){q.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var r=0,s=0,t=[];while(si&&r>1){t=[],r--;for(k=0;k(t[k%r]||0)&&(t[k%r]=q[k]);s=t.reduce(function(a,b,c,d){return a+b})}var u=[];for(var v=0,w=0;vz&&(z=y);return"translate("+A+","+x+")"}),n.attr("transform","translate("+(c-b.right-z)+","+b.top+")"),d=b.top+b.bottom+x+15}});return i}var b={top:5,right:0,bottom:5,left:0},c=400,d=20,e=function(a){return a.key},f=a.utils.defaultColor(),g=!0,h=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");i.dispatch=h,i.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return i},i.width=function(a){if(!arguments.length)return c;c=a;return i},i.height=function(a){if(!arguments.length)return d;d=a;return i},i.key=function(a){if(!arguments.length)return e;e=a;return i},i.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b);return i},i.align=function(a){if(!arguments.length)return g;g=a;return i};return i},a.models.line=function(){function q(a){a.each(function(a){var q=d-c.left-c.right,r=e-c.top-c.bottom,s=d3.select(this);l=b.xScale(),m=b.yScale(),o=o||l,p=p||m;var t=s.selectAll("g.nv-wrap.nv-line").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-groups"),w.append("g").attr("class","nv-scatterWrap"),t.attr("transform","translate("+c.left+","+c.top+")"),b.width(q).height(r);var A=t.select(".nv-scatterWrap");d3.transition(A).call(b),v.append("clipPath").attr("id","nv-edge-clip-"+b.id()).append("rect"),t.select("#nv-edge-clip-"+b.id()+" rect").attr("width",q).attr("height",r),z.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":""),A.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":"");var B=t.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return f(a,b)}).style("stroke",function(a,b){return f(a,b)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.5);var C=B.selectAll("path.nv-area").data(function(a){return j(a)?[a]:[]});C.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(B.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var D=B.selectAll("path.nv-line").data(function(a){return[a.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y(function(a,b){return p(h(a,b))})),d3.transition(B.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),d3.transition(D).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),o=l.copy(),p=m.copy()});return q}var b=a.models.scatter(),c={top:0,right:0,bottom:0,left:0},d=960,e=500,f=a.utils.defaultColor(),g=function(a){return a.x},h=function(a){return a.y},i=function(a,b){return!isNaN(h(a,b))&&h(a,b)!==null},j=function(a){return a.area},k=!1,l,m,n="linear";b.size(16).sizeDomain([16,256]);var o,p;q.dispatch=b.dispatch,q.scatter=b,d3.rebind(q,b,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){if(!arguments.length)return c;c.top=typeof a.top!="undefined"?a.top:c.top,c.right=typeof a.right!="undefined"?a.right:c.right,c.bottom=typeof a.bottom!="undefined"?a.bottom:c.bottom,c.left=typeof a.left!="undefined"?a.left:c.left;return q},q.width=function(a){if(!arguments.length)return d;d=a;return q},q.height=function(a){if(!arguments.length)return e;e=a;return q},q.x=function(a){if(!arguments.length)return g;g=a,b.x(a);return q},q.y=function(a){if(!arguments.length)return h;h=a,b.y(a);return q},q.clipEdge=function(a){if(!arguments.length)return k;k=a;return q},q.color=function(c){if(!arguments.length)return f;f=a.utils.getColor(c),b.color(f);return q},q.interpolate=function(a){if(!arguments.length)return n;n=a;return q},q.defined=function(a){if(!arguments.length)return i;i=a;return q},q.isArea=function(a){if(!arguments.length)return j;j=d3.functor(a);return q};return q},a.models.lineChart=function(){function r(a){a.each(function(l){var s=d3.select(this),t=this,u=(h||parseInt(s.style("width"))||960)-f.left-f.right,v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom;r.update=function(){r(a)},r.container=this;if(!l||!l.length||!l.filter(function(a){return a.values.length}).length){var w=s.selectAll(".nv-noData").data([o]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",f.left+u/2).attr("y",f.top+v/2).text(function(a){return a});return r}s.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale();var z=s.selectAll("g.nv-wrap.nv-lineChart").data([l]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),B=z.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-linesWrap"),A.append("g").attr("class","nv-legendWrap"),j&&(e.width(u),B.select(".nv-legendWrap").datum(l).call(e),f.top!=e.height()&&(f.top=e.height(),v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom),z.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),z.attr("transform","translate("+f.left+","+f.top+")"),b.width(u).height(v).color(l.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!l[b].disabled}));var C=B.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled}));d3.transition(C).call(b),c.scale(m).ticks(u/100).tickSize(-v,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(B.select(".nv-x.nv-axis")).call(c),d.scale(n).ticks(v/36).tickSize(-u,0),d3.transition(B.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l.filter(function(a){return!a.disabled}).length||l.map(function(a){a.disabled=!1,z.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(r)}),p.on("tooltipShow",function(a){k&&q(a,t.parentNode)})});return r}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f={top:30,right:20,bottom:50,left:60},g=a.utils.defaultColor(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},m,n,o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var q=function(e,f){if(f){var g=d3.select(f).select("svg"),h=g.attr("viewBox");if(h){h=h.split(" ");var i=parseInt(g.style("width"))/h[2];e.pos[0]=e.pos[0]*i,e.pos[1]=e.pos[1]*i}}var j=e.pos[0]+(f.offsetLeft||0),k=e.pos[1]+(f.offsetTop||0),m=c.tickFormat()(b.x()(e.point,e.pointIndex)),n=d.tickFormat()(b.y()(e.point,e.pointIndex)),o=l(e.series.key,m,n,e,r);a.tooltip.show([j,k],o,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){k&&a.tooltip.cleanup()}),r.dispatch=p,r.lines=b,r.legend=e,r.xAxis=c,r.yAxis=d,d3.rebind(r,b,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){if(!arguments.length)return f;f.top=typeof a.top!="undefined"?a.top:f.top,f.right=typeof a.right!="undefined"?a.right:f.right,f.bottom=typeof a.bottom!="undefined"?a.bottom:f.bottom,f.left=typeof a.left!="undefined"?a.left:f.left;return r},r.width=function(a){if(!arguments.length)return h;h=a;return r},r.height=function(a){if(!arguments.length)return i;i=a;return r},r.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b),e.color(g);return r},r.showLegend=function(a){if(!arguments.length)return j;j=a;return r},r.tooltips=function(a){if(!arguments.length)return k;k=a;return r},r.tooltipContent=function(a){if(!arguments.length)return l;l=a;return r},r.noData=function(a){if(!arguments.length)return o;o=a;return r};return r},a.models.linePlusBarChart=function(){function w(a){a.each(function(k){var l=d3.select(this),p=this,y=(i||parseInt(l.style("width"))||960)-h.left-h.right,z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom;w.update=function(){w(a)},w.container=this;if(!k||!k.length||!k.filter(function(a){return a.values.length}).length){var A=l.selectAll(".nv-noData").data([t]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",h.left+y/2).attr("y",h.top+z/2).text(function(a){return a});return w}l.selectAll(".nv-noData").remove(),q=b.xScale(),r=c.yScale(),s=b.yScale();var B=k.filter(function(a){return!a.disabled&&a.bar}),C=k.filter(function(a){return!a.bar}),D=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([k]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y1 nv-axis"),E.append("g").attr("class","nv-y2 nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-linesWrap"),E.append("g").attr("class","nv-legendWrap"),n&&(g.width(y/2),F.select(".nv-legendWrap").datum(k.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)");return a})).call(g),h.top!=g.height()&&(h.top=g.height(),z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom),F.select(".nv-legendWrap").attr("transform","translate("+y/2+","+ -h.top+")")),D.attr("transform","translate("+h.left+","+h.top+")"),b.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&!k[b].bar})),c.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&k[b].bar}));var G=F.select(".nv-barsWrap").datum(B.length?B:[{values:[]}]),H=F.select(".nv-linesWrap").datum(C[0].disabled?[{values:[]}]:C);d3.transition(G).call(c),d3.transition(H).call(b),d.scale(q).ticks(y/100).tickSize(-z,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(d),e.scale(r).ticks(z/36).tickSize(-y,0),d3.transition(F.select(".nv-y1.nv-axis")).style("opacity",B.length?1:0).call(e),f.scale(s).ticks(z/36).tickSize(B.length?0:-y,0),F.select(".nv-y2.nv-axis").style("opacity",C.length?1:0).attr("transform","translate("+q.range()[1]+",0)"),d3.transition(F.select(".nv-y2.nv-axis")).call(f),g.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(w)}),u.on("tooltipShow",function(a){o&&v(a,p.parentNode)})});return w}var b=a.models.line(),c=a.models.historicalBar(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.legend(),h={top:30,right:60,bottom:50,left:60},i=null,j=null,k=function(a){return a.x},l=function(a){return a.y},m=a.utils.defaultColor(),n=!0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},q,r,s,t="No Data Available.",u=d3.dispatch("tooltipShow","tooltipHide");b.clipEdge(!1),d.orient("bottom").tickPadding(7),e.orient("left"),f.orient("right");var v=function(c,g){var h=c.pos[0]+(g.offsetLeft||0),i=c.pos[1]+(g.offsetTop||0),j=d.tickFormat()(b.x()(c.point,c.pointIndex)),k=(c.series.bar?e:f).tickFormat()(b.y()(c.point,c.pointIndex)),l=p(c.series.key,j,k,c,w);a.tooltip.show([h,i],l,c.value<0?"n":"s",null,g)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),c.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),c.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),w.dispatch=u,w.legend=g,w.lines=b,w.bars=c,w.xAxis=d,w.y1Axis=e,w.y2Axis=f,d3.rebind(w,b,"defined","size","clipVoronoi","interpolate"),w.x=function(a){if(!arguments.length)return k;k=a,b.x(a),c.x(a);return w},w.y=function(a){if(!arguments.length)return l;l=a,b.y(a),c.y(a);return w},w.margin=function(a){if(!arguments.length)return h;h.top=typeof a.top!="undefined"?a.top:h.top,h.right=typeof a.right!="undefined"?a.right:h.right,h.bottom=typeof a.bottom!="undefined"?a.bottom:h.bottom,h.left=typeof a.left!="undefined"?a.left:h.left;return w},w.width=function(a){if(!arguments.length)return i;i=a;return w},w.height=function(a){if(!arguments.length)return j;j=a;return w},w.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b),g.color(m);return w},w.showLegend=function(a){if(!arguments.length)return n;n=a;return w},w.tooltips=function(a){if(!arguments.length)return o;o=a;return w},w.tooltipContent=function(a){if(!arguments.length)return p;p=a;return w},w.noData=function(a){if(!arguments.length)return t;t=a;return w};return w},a.models.lineWithFocusChart=function(){function A(a){a.each(function(w){function R(){u=i.empty()?null:i.extent(),extent=i.empty()?r.domain():i.extent(),y.brush({extent:extent,brush:i}),Q();var a=J.select(".nv-focus .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}).map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return b.x()(a,c)>=extent[0]&&b.x()(a,c)<=extent[1]})}}));d3.transition(a).call(b),d3.transition(J.select(".nv-focus .nv-x.nv-axis")).call(d),d3.transition(J.select(".nv-focus .nv-y.nv-axis")).call(e)}function Q(){i.empty()||i.extent(u),N.data([i.empty()?r.domain():u]).each(function(a,b){var c=r(a[0])-p.range()[0],d=p.range()[1]-r(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",r(a[1])).attr("width",d<0?0:d)})}function P(a){var b=+(a=="e"),c=b?1:-1,d=F/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}var B=d3.select(this),C=this,D=(m||parseInt(B.style("width"))||960)-j.left-j.right,E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o,F=o-k.top-k.bottom;A.update=function(){A(a)},A.container=this;if(!w||!w.length||!w.filter(function(a){return a.values.length}).length){var G=B.selectAll(".nv-noData").data([x]);G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),G.attr("x",j.left+D/2).attr("y",j.top+E/2).text(function(a){return a});return A}B.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale(),r=c.xScale(),s=c.yScale();var H=B.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([w]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),J=H.select("g");I.append("g").attr("class","nv-legendWrap");var K=I.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-linesWrap");var L=I.append("g").attr("class","nv-context");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-brushBackground"),L.append("g").attr("class","nv-x nv-brush"),t&&(h.width(D),J.select(".nv-legendWrap").datum(w).call(h),j.top!=h.height()&&(j.top=h.height(),E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -j.top+")")),H.attr("transform","translate("+j.left+","+j.top+")"),b.width(D).height(E).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),c.defined(b.defined()).width(D).height(F).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),J.select(".nv-context").attr("transform","translate(0,"+(E+j.bottom+k.top)+")");var M=J.select(".nv-context .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}));d3.transition(M).call(c),d.scale(p).ticks(D/100).tickSize(-E,0),e.scale(q).ticks(E/36).tickSize(-D,0),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+E+")"),i.x(r).on("brush",R),u&&i.extent(u);var N=J.select(".nv-brushBackground").selectAll("g").data([u||i.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=J.select(".nv-x.nv-brush").call(i),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",P),R(),f.scale(r).ticks(D/100).tickSize(-F,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(f),g.scale(s).ticks(F/36).tickSize(-D,0),d3.transition(J.select(".nv-context .nv-y.nv-axis")).call(g),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),h.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w.filter(function(a){return!a.disabled}).length||w.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(A)}),y.on("tooltipShow",function(a){v&&z(a,C.parentNode)})});return A}var b=a.models.line(),c=a.models.line(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=d3.svg.brush(),j={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},l=a.utils.defaultColor(),m=null,n=null,o=100,p,q,r,s,t=!0,u=null,v=!0,w=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},x="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide","brush");b.clipEdge(!0),c.interactive(!1),d.orient("bottom").tickPadding(5),e.orient("left"),f.orient("bottom").tickPadding(5),g.orient("left");var z=function(c,f){var g=c.pos[0]+(f.offsetLeft||0),h=c.pos[1]+(f.offsetTop||0),i=d.tickFormat()(b.x()(c.point,c.pointIndex)),j=e.tickFormat()(b.y()(c.point,c.pointIndex)),k=w(c.series.key,i,j,c,A);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],y.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){v&&a.tooltip.cleanup()}),A.dispatch=y,A.legend=h,A.lines=b,A.lines2=c,A.xAxis=d,A.yAxis=e,A.x2Axis=f,A.y2Axis=g,d3.rebind(A,b,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){if(!arguments.length)return b.x;b.x(a),c.x(a);return A},A.y=function(a){if(!arguments.length)return b.y;b.y(a),c.y(a);return A},A.margin=function(a){if(!arguments.length)return j;j.top=typeof a.top!="undefined"?a.top:j.top,j.right=typeof a.right!="undefined"?a.right:j.right,j.bottom=typeof a.bottom!="undefined"?a.bottom:j.bottom,j.left=typeof a.left!="undefined"?a.left:j.left;return A},A.margin2=function(a){if(!arguments.length)return k;k=a;return A},A.width=function(a){if(!arguments.length)return m;m=a;return A},A.height=function(a){if(!arguments.length)return n;n=a;return A},A.height2=function(a){if(!arguments.length)return o;o=a;return A},A.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),h.color(l);return A},A.showLegend=function(a){if(!arguments.length)return t;t=a;return A},A.tooltips=function(a){if(!arguments.length)return v;v=a;return A},A.tooltipContent=function(a){if(!arguments.length)return w;w=a;return A},A.interpolate=function(a){if(!arguments.length)return b.interpolate();b.interpolate(a),c.interpolate(a);return A},A.noData=function(a){if(!arguments.length)return x;x=a;return A},A.xTickFormat=function(a){if(!arguments.length)return d.tickFormat();d.tickFormat(a),f.tickFormat(a);return A},A.yTickFormat=function(a){if(!arguments.length)return e.tickFormat();e.tickFormat(a),g.tickFormat(a);return A};return A},a.models.multiBar=function(){function t(a){a.each(function(a){var t=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=o&&p?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});e.domain(d3.merge(w).map(function( -a){return a.x})).rangeBands([0,t],.1),f.domain(p||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([u,0]);if(e.domain()[0]===e.domain()[1]||f.domain()[0]===f.domain()[1])singlePoint=!0;e.domain()[0]===e.domain()[1]&&(e.domain()[0]?e.domain([e.domain()[0]-e.domain()[0]*.01,e.domain()[1]+e.domain()[1]*.01]):e.domain([-1,1])),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]+f.domain()[0]*.01,f.domain()[1]-f.domain()[1]*.01]):f.domain([-1,1])),r=r||e,s=s||f;var z=v.selectAll("g.nv-wrap.nv-multibar").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")"),B.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),z.select("#nv-edge-clip-"+g+" rect").attr("width",t).attr("height",u),D.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).selectAll("rect.nv-bar").delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return m(a,b)}).style("stroke",function(a,b){return m(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("rect.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return l?0:d*e.rangeBand()/a.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:a.length));F.style("fill",function(a,b,c){return m(a,c,b)}).style("stroke",function(a,b,c){return m(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){q.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){q.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+e(h(a,b))+",0)"}),l?d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.max(Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(b,c){return l?0:b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/(l?1:a.length))}):d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("x",function(b,c){return b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/a.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(0)-f(i(a,b))<1?f(0)-1:f(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(f(i(a,b))-f(0)),1)})}),r=e.copy(),s=f.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.ordinal(),f=d3.scale.linear(),g=Math.floor(Math.random()*1e4),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=!0,l=!1,m=a.utils.defaultColor(),n=1200,o,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),r,s;t.dispatch=q,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return e;e=a;return t},t.yScale=function(a){if(!arguments.length)return f;f=a;return t},t.xDomain=function(a){if(!arguments.length)return o;o=a;return t},t.yDomain=function(a){if(!arguments.length)return p;p=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.stacked=function(a){if(!arguments.length)return l;l=a;return t},t.clipEdge=function(a){if(!arguments.length)return k;k=a;return t},t.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return g;g=a;return t},t.delay=function(a){if(!arguments.length)return n;n=a;return t};return t},a.models.multiBarChart=function(){function v(a){a.each(function(p){var w=d3.select(this),z=this,A=(h||parseInt(w.style("width"))||960)-g.left-g.right,B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom;v.update=function(){a.transition().call(v)},v.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=w.selectAll(".nv-noData").data([s]);C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",g.left+A/2).attr("y",g.top+B/2).text(function(a){return a});return v}w.selectAll(".nv-noData").remove(),q=b.xScale(),r=b.yScale();var D=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([p]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-controlsWrap"),l&&(e.width(A/2),F.select(".nv-legendWrap").datum(p).call(e),g.top!=e.height()&&(g.top=e.height(),B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom),F.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -g.top+")"));if(k){var G=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),F.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+ -g.top+")").call(f)}D.attr("transform","translate("+g.left+","+g.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!p[b].disabled}));var H=F.select(".nv-barsWrap").datum(p.filter(function(a){return!a.disabled}));d3.transition(H).call(b),c.scale(q).ticks(A/100).tickSize(-B,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(c);var I=F.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1),m&&I.filter(function(a,b){return b%Math.ceil(p[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),n&&I.selectAll("text").attr("transform",function(a,b,c){return"rotate("+n+" 0,0)"}).attr("text-transform",n>0?"start":"end"),F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),d.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(F.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(v)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){G=G.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(v)}}),t.on("tooltipShow",function(a){o&&u(a,z.parentNode)})});return v}var b=a.models.multiBar(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:20,bottom:30,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!0,n=0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" on "+b+"

"},q,r,s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");b.stacked(!1),c.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var u=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=p(e.series.key,i,j,e,v);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),v.dispatch=t,v.multibar=b,v.legend=e,v.xAxis=c,v.yAxis=d,d3.rebind(v,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return v},v.width=function(a){if(!arguments.length)return h;h=a;return v},v.height=function(a){if(!arguments.length)return i;i=a;return v},v.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return v},v.showControls=function(a){if(!arguments.length)return k;k=a;return v},v.showLegend=function(a){if(!arguments.length)return l;l=a;return v},v.reduceXTicks=function(a){if(!arguments.length)return m;m=a;return v},v.rotateLabels=function(a){if(!arguments.length)return n;n=a;return v},v.tooltip=function(a){if(!arguments.length)return p;p=a;return v},v.tooltips=function(a){if(!arguments.length)return o;o=a;return v},v.tooltipContent=function(a){if(!arguments.length)return p;p=a;return v},v.noData=function(a){if(!arguments.length)return s;s=a;return v};return v},a.models.multiBarHorizontal=function(){function v(a){a.each(function(a){var e=c-b.left-b.right,p=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=q&&r?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(q||d3.merge(w).map(function(a){return a.x})).rangeBands([0,p],.1),g.domain(r||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,e-(g.domain()[1]>0?n:0)]):g.range([0,e]),t=t||f,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var z=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+u(l?b.y0:0)+","+(l?0:d*f.rangeBand()/a.length+f(h(b,c)))+")"});G.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),s.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[g(i(b,c)+(l?b.y0:0)),f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),s.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){s.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){s.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(G.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),F.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(F).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):F.selectAll("text").remove(),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(F).attr("transform",function(a,b){return"translate("+g(a.y0)+","+f(h(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(g(i(a,b)+a.y0)-g(a.y0))}).attr("height",f.rangeBand()):d3.transition(F).attr("transform",function(b,c){return"translate("+(i(b,c)<0?g(i(b,c)):g(0))+","+(b.series*f.rangeBand()/a.length+f(h(b,c)))+")"}).select("rect").attr("height",f.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)}),t=f.copy(),u=g.copy()});return v}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),t,u;v.dispatch=s,v.x=function(a){if(!arguments.length)return h;h=a;return v},v.y=function(a){if(!arguments.length)return i;i=a;return v},v.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.xScale=function(a){if(!arguments.length)return f;f=a;return v},v.yScale=function(a){if(!arguments.length)return g;g=a;return v},v.xDomain=function(a){if(!arguments.length)return q;q=a;return v},v.yDomain=function(a){if(!arguments.length)return r;r=a;return v},v.forceY=function(a){if(!arguments.length)return j;j=a;return v},v.stacked=function(a){if(!arguments.length)return l;l=a;return v},v.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return v},v.id=function(a){if(!arguments.length)return e;e=a;return v},v.delay=function(a){if(!arguments.length)return p;p=a;return v},v.showValues=function(a){if(!arguments.length)return m;m=a;return v},v.valueFormat=function(a){if(!arguments.length)return o;o=a;return v},v.valuePadding=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontalChart=function(){function u(a){a.each(function(m){var o=d3.select(this),v=this,w=(h||parseInt(o.style("width"))||960)-g.left-g.right,z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom;u.update=function(){a.transition().call(u)},u.container=this;if(!m||!m.length||!m.filter(function(a){return a.values.length}).length){var A=o.selectAll(".nv-noData").data([r]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",g.left+w/2).attr("y",g.top+z/2).text(function(a){return a});return u}o.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();var B=o.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([m]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),D=B.select("g");C.append("g").attr("class","nv-x nv-axis"),C.append("g").attr("class","nv-y nv-axis"),C.append("g").attr("class","nv-barsWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap"),l&&(e.width(w/2),D.select(".nv-legendWrap").datum(m).call(e),g.top!=e.height()&&(g.top=e.height(),z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom),D.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -g.top+")"));if(k){var E=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(E).attr("transform","translate(0,"+ -g.top+")").call(f)}B.attr("transform","translate("+g.left+","+g.top+")"),b.width(w).height(z).color(m.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!m[b].disabled}));var F=D.select(".nv-barsWrap").datum(m.filter(function(a){return!a.disabled}));d3.transition(F).call(b),c.scale(p).ticks(z/24).tickSize(-w,0),d3.transition(D.select(".nv-x.nv-axis")).call(c);var G=D.select(".nv-x.nv-axis").selectAll("g");G.selectAll("line, text").style("opacity",1),d.scale(q).ticks(w/100).tickSize(-z,0),D.select(".nv-y.nv-axis").attr("transform","translate(0,"+z+")"),d3.transition(D.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,m.filter(function(a){return!a.disabled}).length||m.map(function(a){a.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(u)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){E=E.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(u)}}),s.on("tooltipShow",function(a){n&&t(a,v.parentNode)})});return u}var b=a.models.multiBarHorizontal(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend().height(30),f=a.models.legend().height(30),g={top:30,right:20,bottom:50,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!1,n=!0,o=function(a,b,c,d,e){return"

"+a+" - "+b+"

"+"

"+c+"

"},p,q,r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");b.stacked(m),c.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("bottom").tickFormat(d3.format(",.1f"));var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"e":"w",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),u.dispatch=s,u.multibar=b,u.legend=e,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return h;h=a;return u},u.height=function(a){if(!arguments.length)return i;i=a;return u},u.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return o;o=a;return u},u.tooltips=function(a){if(!arguments.length)return n;n=a;return u},u.tooltipContent=function(a){if(!arguments.length)return o;o=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u};return u},a.models.multiChart=function(){function y(a){a.each(function(h){var j=d3.select(this),z=this,A=(d||parseInt(j.style("width"))||960)-b.left-b.right,B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom,C=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==1}),D=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==2}),E=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==1}),F=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==2}),G=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==1}),H=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==2}),I=h.filter(function(a){return!a.disabled&&a.yAxis==1}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),J=h.filter(function(a){return!a.disabled&&a.yAxis==2}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});i.domain(d3.extent(d3.merge(I.concat(J)),function(a){return a.x})).range([0,A]);var K=j.selectAll("g.wrap.multiChart").data([h]),L=K.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");L.append("g").attr("class","x axis"),L.append("g").attr("class","y1 axis"),L.append("g").attr("class","y2 axis"),L.append("g").attr("class","lines1Wrap"),L.append("g").attr("class","lines2Wrap"),L.append("g").attr("class","bars1Wrap"),L.append("g").attr("class","bars2Wrap"),L.append("g").attr("class","stack1Wrap"),L.append("g").attr("class","stack2Wrap"),L.append("g").attr("class","legendWrap");var M=K.select("g");f&&(v.width(A/2),M.select(".legendWrap").datum(h.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)");return a})).call(v),b.top!=v.height()&&(b.top=v.height(),B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom),M.select(".legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),m.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="line"})),n.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="line"})),o.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="bar"})),p.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="bar"})),q.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="area"})),r.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="area"})),M.attr("transform","translate("+b.left+","+b.top+")");var N=M.select(".lines1Wrap").datum(C),O=M.select(".bars1Wrap").datum(E),P=M.select(".stack1Wrap").datum(G),Q=M.select(".lines2Wrap").datum(D),R=M.select(".bars2Wrap").datum(F),S=M.select(".stack2Wrap").datum(H),T=G.length?G.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];k.domain(d3.extent(d3.merge(I).concat(T),function(a){return a.y})).range([0,B]),l.domain(d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,B]),m.yDomain(k.domain()),o.yDomain(k.domain()),q.yDomain(k.domain()),n.yDomain(l.domain()),p.yDomain(l.domain()),r.yDomain(l.domain()),G.length&&d3.transition(P).call(q),H.length&&d3.transition(S).call(r),E.length&&d3.transition(O).call(o),F.length&&d3.transition(R).call(p),C.length&&d3.transition(N).call(m),D.length&&d3.transition(Q).call(n),s.ticks(A/100).tickSize(-B,0),M.select(".x.axis").attr("transform","translate(0,"+B+")"),d3.transition(M.select(".x.axis")).call(s),t.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y1.axis")).call(t),u.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y2.axis")).call(u),M.select(".y2.axis").style("opacity",J.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,K.selectAll(".series").classed("disabled",!1);return a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this;return y}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},i,j,i=d3.scale.linear(),k=d3.scale.linear(),l=d3.scale.linear(),m=a.models.line().yScale(k),n=a.models.line().yScale(l),o=a.models.multiBar().stacked(!1).yScale(k),p=a.models.multiBar().stacked(!1).yScale(l),q=a.models.stackedArea().yScale(k),r=a.models.stackedArea().yScale(l),s=a.models.axis().scale(i).orient("bottom").tickPadding(5),t=a.models.axis().scale(k).orient("left"),u=a.models.axis().scale(l).orient("right"),v=a.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=(b.series.bar?t:u).tickFormat()(m.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,y);a.tooltip.show([d,e],i,undefined,undefined,c.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),q.dispatch.on("tooltipShow",function(a){if(!Math.round(q.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),q.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),r.dispatch.on("tooltipShow",function(a){if(!Math.round(r.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),r.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),w.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),y.dispatch=w,y.lines1=m,y.lines2=n,y.bars1=o,y.bars2=p,y.stack1=q,y.stack2=r,y.xAxis=s,y.yAxis1=t,y.yAxis2=u,y.x=function(a){if(!arguments.length)return getX;getX=a,m.x(a),o.x(a);return y},y.y=function(a){if(!arguments.length)return getY;getY=a,m.y(a),o.y(a);return y},y.margin=function(a){if(!arguments.length)return b;b=a;return y},y.width=function(a){if(!arguments.length)return d;d=a;return y},y.height=function(a){if(!arguments.length)return e;e=a;return y},y.color=function(a){if(!arguments.length)return c;c=a,v.color(a);return y},y.showLegend=function(a){if(!arguments.length)return f;f=a;return y},y.tooltips=function(a){if(!arguments.length)return g;g=a;return y},y.tooltipContent=function(a){if(!arguments.length)return h;h=a;return y};return y},a.models.ohlcBar=function(){function u(a){a.each(function(a){var q=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);f.domain(r||d3.extent(a[0].values.map(h).concat(n))).range([0,q]),g.domain(s||[d3.min(a[0].values.map(m).concat(o)),d3.max(a[0].values.map(l).concat(o))]).range([u,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var w=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),A=z.append("defs"),B=z.append("g"),C=w.select("g");B.append("g").attr("class","nv-ticks"),w.attr("transform","translate("+b.left+","+b.top+")"),v.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:e})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",u),C.attr("clip-path",p?"url(#nv-chart-clip-path-"+e+")":"");var D=w.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});D.exit().remove();var E=D.enter().append("path").attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){t.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){t.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})});return u}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=function(a){return a.open},k=function(a){return a.close},l=function(a){return a.high},m=function(a){return a.low},n=[],o=[],p=!0,q=a.utils.defaultColor(),r,s,t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");u.dispatch=t,u.x=function(a){if(!arguments.length)return h;h=a;return u},u.y=function(a){if(!arguments.length)return i;i=a;return u},u.open=function(a){if(!arguments.length)return j;j=a;return u},u.close=function(a){if(!arguments.length)return k;k=a;return u},u.high=function(a){if(!arguments.length)return l;l=a;return u},u.low=function(a){if(!arguments.length)return m;m=a;return u},u.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return u},u.width=function(a){if(!arguments.length)return c;c=a;return u},u.height=function(a){if(!arguments.length)return d;d=a;return u},u.xScale=function(a){if(!arguments.length)return f;f=a;return u},u.yScale=function(a){if(!arguments.length)return g -;g=a;return u},u.xDomain=function(a){if(!arguments.length)return r;r=a;return u},u.yDomain=function(a){if(!arguments.length)return s;s=a;return u},u.forceX=function(a){if(!arguments.length)return n;n=a;return u},u.forceY=function(a){if(!arguments.length)return o;o=a;return u},u.clipEdge=function(a){if(!arguments.length)return p;p=a;return u},u.color=function(b){if(!arguments.length)return q;q=a.utils.getColor(b);return u},u.id=function(a){if(!arguments.length)return e;e=a;return u};return u},a.models.pie=function(){function p(a){a.each(function(a){function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);this._current=b(0);return function(a){return w(b(a))}}function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this),s=r.selectAll(".nv-wrap.nv-pie").data([e(a[0])]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+h),u=t.append("g"),v=s.select("g");u.append("g").attr("class","nv-pie"),s.attr("transform","translate("+b.left+","+b.top+")"),v.select(".nv-pie").attr("transform","translate("+j/2+","+p/2+")"),r.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})});var w=d3.svg.arc().outerRadius(q-q/5);n&&w.innerRadius(q/2);var x=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:g(a)}),y=s.select(".nv-pie").selectAll(".nv-slice").data(x);y.exit().remove();var z=y.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:f(a.data),value:g(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:h})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:f(a.data),value:g(a.data),point:a.data,index:b,id:h})}).on("click",function(a,b){o.elementClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()});y.attr("fill",function(a,b){return i(a,b)}).attr("stroke",function(a,b){return i(a,b)});var A=z.append("path").each(function(a){this._current=a});d3.transition(y.select("path")).attr("d",w).attrTween("d",D);if(k){var B=w;l&&(B=d3.svg.arc().outerRadius(w.outerRadius())),z.append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor","middle").style("fill","#000")}),y.select(".nv-label").transition().attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),y.each(function(a,b){var c=d3.select(this);c.select(".nv-label text").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>m?f(a.data):""});var d=c.select("text").node().getBBox();c.select(".nv-label rect").attr("width",d.width+10).attr("height",d.height+10).attr("transform",function(){return"translate("+[d.x-5,d.y-5]+")"})})}});return p}var b={top:0,right:0,bottom:0,left:0},c=500,d=500,e=function(a){return a.values},f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(Math.random()*1e4),i=a.utils.defaultColor(),j=d3.format(",.2f"),k=!0,l=!1,m=.02,n=!1,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");p.dispatch=o,p.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.values=function(a){if(!arguments.length)return e;e=a;return p},p.x=function(a){if(!arguments.length)return f;f=a;return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return p},p.showLabels=function(a){if(!arguments.length)return k;k=a;return p},p.donutLabelsOutside=function(a){if(!arguments.length)return l;l=a;return p},p.donut=function(a){if(!arguments.length)return n;n=a;return p},p.id=function(a){if(!arguments.length)return h;h=a;return p},p.color=function(b){if(!arguments.length)return i;i=a.utils.getColor(b);return p},p.valueFormat=function(a){if(!arguments.length)return j;j=a;return p},p.labelThreshold=function(a){if(!arguments.length)return m;m=a;return p};return p},a.models.pieChart=function(){function n(a){a.each(function(h){var i=d3.select(this),j=this,m=(e||parseInt(i.style("width"))||960)-d.left-d.right,o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom;n.update=function(){n(a)},n.container=this;if(!h||!h.length){var p=i.selectAll(".nv-noData").data([k]);p.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),p.attr("x",d.left+m/2).attr("y",d.top+o/2).text(function(a){return a});return n}i.selectAll(".nv-noData").remove();var q=i.selectAll("g.nv-wrap.nv-pieChart").data([h]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),s=q.select("g");r.append("g").attr("class","nv-pieWrap"),r.append("g").attr("class","nv-legendWrap"),g&&(c.width(m).key(b.x()),q.select(".nv-legendWrap").datum(b.values()(h[0])).call(c),d.top!=c.height()&&(d.top=c.height(),o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom),q.select(".nv-legendWrap").attr("transform","translate(0,"+ -d.top+")")),q.attr("transform","translate("+d.left+","+d.top+")"),b.width(m).height(o);var t=s.select(".nv-pieWrap").datum(h);d3.transition(t).call(b),c.dispatch.on("legendClick",function(c,d,e){c.disabled=!c.disabled,b.values()(h[0]).filter(function(a){return!a.disabled}).length||b.values()(h[0]).map(function(a){a.disabled=!1,q.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(n)}),b.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)})});return n}var b=a.models.pie(),c=a.models.legend(),d={top:30,right:20,bottom:20,left:20},e=null,f=null,g=!0,h=a.utils.defaultColor(),i=!0,j=function(a,b,c,d){return"

"+a+"

"+"

"+b+"

"},k="No Data Available.",l=d3.dispatch("tooltipShow","tooltipHide"),m=function(c,d){var e=c.pos[0]+(d&&d.offsetLeft||0),f=c.pos[1]+(d&&d.offsetTop||0),g=b.valueFormat()(b.y()(c.point)),h=j(b.x()(c.point),g,c,n);a.tooltip.show([e,f],h,c.value<0?"n":"s",null,d)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+d.left,a.pos[1]+d.top],l.tooltipShow(a)}),l.on("tooltipShow",function(a){i&&m(a)}),l.on("tooltipHide",function(){i&&a.tooltip.cleanup()}),n.dispatch=l,n.pie=b,d3.rebind(n,b,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){if(!arguments.length)return d;d.top=typeof a.top!="undefined"?a.top:d.top,d.right=typeof a.right!="undefined"?a.right:d.right,d.bottom=typeof a.bottom!="undefined"?a.bottom:d.bottom,d.left=typeof a.left!="undefined"?a.left:d.left;return n},n.width=function(a){if(!arguments.length)return e;e=a;return n},n.height=function(a){if(!arguments.length)return f;f=a;return n},n.color=function(d){if(!arguments.length)return h;h=a.utils.getColor(d),c.color(h),b.color(h);return n},n.showLegend=function(a){if(!arguments.length)return g;g=a;return n},n.tooltips=function(a){if(!arguments.length)return i;i=a;return n},n.tooltipContent=function(a){if(!arguments.length)return j;j=a;return n},n.noData=function(a){if(!arguments.length)return k;k=a;return n};return n},a.models.scatter=function(){function H(a){a.each(function(a){function Q(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c,a]}).filter(function(a,b){return r(a[4],b)})}));if(t){N.append("clipPath").attr("id","nv-points-clip-"+f);var e=L.select("#nv-points-clip-"+f).selectAll("circle").data(d);e.enter().append("circle").attr("r",u),e.exit().remove(),e.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),L.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){d.length<3&&(d.push([g.range()[0]-20,h.range()[0]-20,null,null]),d.push([g.range()[1]+20,h.range()[1]+20,null,null]));var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=L.select(".nv-point-paths").selectAll("path").data(i);l.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),l.exit().remove(),l.attr("d",function(a){return"M"+a.data.join(",")+"Z"}),c=l}else{var m=d.map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}});c=L.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementClick({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseover",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementMouseover({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseout",function(b,c){if(G)return 0;var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})}),G=!1}var H=c-b.left-b.right,I=d-b.top-b.bottom,J=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var K=v&&w&&x?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:j(a,b),y:k(a,b),size:l(a,b)}})}));g.domain(v||d3.extent(K.map(function(a){return a.x}).concat(n))).range([0,H]),h.domain(w||d3.extent(K.map(function(a){return a.y}).concat(o))).range([I,0]),i.domain(x||d3.extent(K.map(function(a){return a.size}).concat(p))).range(y||[16,256]);if(g.domain()[0]===g.domain()[1]||h.domain()[0]===h.domain()[1])z=!0;g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-g.domain()[0]*.01,g.domain()[1]+g.domain()[1]*.01]):g.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*.01,h.domain()[1]-h.domain()[1]*.01]):h.domain([-1,1])),C=C||g,D=D||h,E=E||i;var L=J.selectAll("g.nv-wrap.nv-scatter").data([a]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),O.append("g").attr("class","nv-point-paths"),L.attr("transform","translate("+b.left+","+b.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),L.select("#nv-edge-clip-"+f+" rect").attr("width",H).attr("height",I),P.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":""),G=!0;var R=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(R.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),R.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(R).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var S=R.selectAll("path.nv-point").data(function(a){return a.values});S.enter().append("path").attr("transform",function(a,b){return"translate("+C(j(a,b))+","+D(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),S.exit().remove(),d3.transition(R.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),S.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(S).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),clearTimeout(F),F=setTimeout(Q,1e3),C=g.copy(),D=h.copy(),E=i.copy()});return H}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e5),g=d3.scale.linear(),h=d3.scale.linear(),i=d3.scale.linear(),j=function(a){return a.x},k=function(a){return a.y},l=function(a){return a.size||1},m=function(a){return a.shape||"circle"},n=[],o=[],p=[],q=!0,r=function(a){return!a.notActive},s=!1,t=!0,u=function(){return 25},v=null,w=null,x=null,y=null,z=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),B=!0,C,D,E,F,G=!1;A.on("elementMouseover.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!1)}),H.dispatch=A,H.x=function(a){if(!arguments.length)return j;j=d3.functor(a);return H},H.y=function(a){if(!arguments.length)return k;k=d3.functor(a);return H},H.size=function(a){if(!arguments.length)return l;l=d3.functor(a);return H},H.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return H},H.width=function(a){if(!arguments.length)return c;c=a;return H},H.height=function(a){if(!arguments.length)return d;d=a;return H},H.xScale=function(a){if(!arguments.length)return g;g=a;return H},H.yScale=function(a){if(!arguments.length)return h;h=a;return H},H.zScale=function(a){if(!arguments.length)return i;i=a;return H},H.xDomain=function(a){if(!arguments.length)return v;v=a;return H},H.yDomain=function(a){if(!arguments.length)return w;w=a;return H},H.sizeDomain=function(a){if(!arguments.length)return x;x=a;return H},H.sizeRange=function(a){if(!arguments.length)return y;y=a;return H},H.forceX=function(a){if(!arguments.length)return n;n=a;return H},H.forceY=function(a){if(!arguments.length)return o;o=a;return H},H.forceSize=function(a){if(!arguments.length)return p;p=a;return H},H.interactive=function(a){if(!arguments.length)return q;q=a;return H},H.pointActive=function(a){if(!arguments.length)return r;r=a;return H},H.clipEdge=function(a){if(!arguments.length)return s;s=a;return H},H.clipVoronoi=function(a){if(!arguments.length)return t;t=a;return H},H.useVoronoi=function(a){if(!arguments.length)return B;B=a,B===!1&&(t=!1);return H},H.clipRadius=function(a){if(!arguments.length)return u;u=a;return H},H.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return H},H.shape=function(a){if(!arguments.length)return m;m=a;return H},H.id=function(a){if(!arguments.length)return f;f=a;return H},H.singlePoint=function(a){if(!arguments.length)return z;z=a;return H};return H},a.models.scatterChart=function(){function G(a){a.each(function(x){function Q(){if(v){N.select(".nv-point-paths").style("pointer-events","all");return!1}N.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(u).focus(a[0]),n.distortion(u).focus(a[1]),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d),N.select(".nv-distributionX").datum(x.filter(function(a){return!a.disabled})).call(g),N.select(".nv-distributionY").datum(x.filter(function(a){return!a.disabled})).call(h)}var y=d3.select(this),z=this,H=(j||parseInt(y.style("width"))||960)-i.left-i.right,I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom;G.update=function(){G(a)},G.container=this;if(!x||!x.length||!x.filter(function(a){return a.values.length}).length){var J=y.selectAll(".nv-noData").data([B]);J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",i.left+H/2).attr("y",i.top+I/2).text(function(a){return a});return G}y.selectAll(".nv-noData").remove(),C=C||m,D=D||n;var K=y.selectAll("g.nv-wrap.nv-scatterChart").data([x]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),M=L.append("g"),N=K.select("g");M.append("rect").attr("class","nvd3 nv-background"),M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis"),M.append("g").attr("class","nv-scatterWrap"),M.append("g").attr("class","nv-distWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),s&&(e.width(H/2),K.select(".nv-legendWrap").datum(x).call(e),i.top!=e.height()&&(i.top=e.height(),I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom),K.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -i.top+")")),t&&(f.width(180).color(["#444"]),N.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -i.top+")").call(f)),K.attr("transform","translate("+i.left+","+i.top+")"),b.width(H).height(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),K.select(".nv-scatterWrap").datum(x.filter(function(a){return!a.disabled})).call(b);if(o){var O=m.domain()[1]-m.domain()[0];m.domain([m.domain()[0]-o*O,m.domain()[1]+o*O])}if(p){var P=n.domain()[1]-n.domain()[0];n.domain([n.domain()[0]-p*P,n.domain()[1]+p*P])}c.scale(m).ticks(c.ticks()&&c.ticks().length?c.ticks():H/100).tickSize(-I,0),N.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():I/36).tickSize(-H,0),N.select(".nv-y.nv-axis").call(d),q&&(g.getData(b.x()).scale(m).width(H).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),N.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(x.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(b.y()).scale(n).width(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),N.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(x.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(N.select(".nv-background").attr("width",H).attr("height",I),N.select(".nv-background").on("mousemove",Q),N.select(".nv-background").on("click",function(){v=!v}),b.dispatch.on("elementClick.freezeFisheye",function(){v=!v})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,u=e.disabled?0:2.5,N.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),N.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(u).focus(0),n.distortion(u).focus(0),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d)):v=!1,G(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,x.filter(function(a){return!a.disabled}).length||x.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),G(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-I),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],A.tooltipShow(a)}),A.on("tooltipShow",function(a){w&&E(a,z.parentNode)}),C=m.copy(),D=n.copy()});return G}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=0,p=0,q=!1,r=!1,s=!0,t=!!d3.fisheye,u=0,v=!1,w=!0,x=function(a,b,c){return""+b+""},y=function(a,b,c){return""+c+""},z=null,A=d3.dispatch("tooltipShow","tooltipHide"),B="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var C,D,E=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));x!=null&&a.tooltip.show([j,k],x(e.series.key,p,q,e,G),"n",1,f,"x-nvtooltip"),y!=null&&a.tooltip.show([l,o],y(e.series.key,p,q,e,G),"e",1,f,"y-nvtooltip"),z!=null&&a.tooltip.show([g,h],z(e.series.key,p,q,e,G),e.value<0?"n":"s",null,f)},F=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),A.on("tooltipHide",function(){w&&a.tooltip.cleanup()}),G.dispatch=A,G.scatter=b,G.legend=e,G.controls=f,G.xAxis=c,G.yAxis=d,G.distX=g,G.distY=h,d3.rebind(G,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),G.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return G},G.width=function(a){if(!arguments.length)return j;j=a;return G},G.height=function(a){if(!arguments.length)return k;k=a;return G},G.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return G},G.showDistX=function(a){if(!arguments.length)return q;q=a;return G},G.showDistY=function(a){if(!arguments.length)return r;r=a;return G},G.showControls=function(a){if(!arguments.length)return t;t=a;return G},G.showLegend=function(a){if(!arguments.length)return s;s=a;return G},G.fisheye=function(a){if(!arguments.length)return u;u=a;return G},G.xPadding=function(a){if(!arguments.length)return o;o=a;return G},G.yPadding=function(a){if(!arguments.length)return p;p=a;return G},G.tooltips=function(a){if(!arguments.length)return w;w=a;return G},G.tooltipContent=function(a){if(!arguments.length)return z;z=a;return G},G.tooltipXContent=function(a){if(!arguments.length)return x;x=a;return G},G.tooltipYContent=function(a){if(!arguments.length)return y;y=a;return G},G.noData=function(a){if(!arguments.length)return B;B=a;return G};return G},a.models.scatterPlusLineChart=function(){function E(a){a.each(function(v){function O(){if(t){L.select(".nv-point-paths").style("pointer-events","all");return!1}L.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(s).focus(a[0]),n.distortion(s).focus(a[1]),L.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d),L.select(".nv-distributionX").datum(v.filter(function(a){return!a.disabled})).call(g),L.select(".nv-distributionY").datum(v.filter(function(a){return!a.disabled})).call(h)}var w=d3.select(this),x=this,F=(j||parseInt(w.style("width"))||960)-i.left-i.right,G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom;E.update=function(){E(a)},E.container=this;if(!v||!v.length||!v.filter(function(a){return a.values.length}).length){var H=w.selectAll(".nv-noData").data([z]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",i.left+F/2).attr("y",i.top+G/2).text(function(a){return a});return E}w.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale(),A=A||m,B=B||n;var I=w.selectAll("g.nv-wrap.nv-scatterChart").data([v]),J=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),K=J.append("g"),L=I.select("g");K.append("rect").attr("class","nvd3 nv-background"),K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-scatterWrap"),K.append("g").attr("class","nv-regressionLinesWrap"),K.append("g").attr("class","nv-distWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+i.left+","+i.top+")"),q&&(e.width(F/2),I.select(".nv-legendWrap").datum(v).call(e),i.top!=e.height()&&(i.top=e.height(),G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom),I.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -i.top+")")),r&&(f.width(180).color(["#444"]),L.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -i.top+")").call(f)),b.width(F).height(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),I.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var M=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a}),N=M.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);M.selectAll(".nv-regLines line").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(a,b){return n(m.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return n(m.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return l(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||typeof a.slope=="undefined"||typeof a.intercept=="undefined"?0:1}),c.scale(m).ticks(c.ticks()?c.ticks():F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()?d.ticks():G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").call(d),o&&(g.getData(b.x()).scale(m).width(F).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),L.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(v.filter(function(a){return!a.disabled})).call(g)),p&&(h.getData(b.y()).scale(n).width(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),L.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(v.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(L.select(".nv-background").attr("width",F).attr("height",G),L.select(".nv-background").on("mousemove",O),L.select(".nv-background").on("click",function(){t=!t}),b.dispatch.on("elementClick.freezeFisheye",function(){t=!t})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,s=e.disabled?0:2.5,L.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),L.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(s).focus(0),n.distortion(s).focus(0),L.select(".nv-scatterWrap").call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d)):t=!1,E(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,v.filter(function(a){return!a.disabled}).length||v.map(function(a){a.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1);return a}),E(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){u&&C(a,x.parentNode)}),A=m.copy(),B=n.copy()});return E}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=!1,p=!1,q=!0,r=!!d3.fisheye,s=0,t=!1,u=!0,v=function(a,b,c){return""+b+""},w=function(a,b,c){return""+c+""},x=function(a,b,c,d){return"

"+a+"

"+"

"+d+"

"},y=d3.dispatch("tooltipShow","tooltipHide"),z="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var A,B,C=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));v!=null&&a.tooltip.show([j,k],v(e.series.key,p,q,e,E),"n",1,f,"x-nvtooltip"),w!=null&&a.tooltip.show([l,o],w(e.series.key,p,q,e,E),"e",1,f,"y-nvtooltip"),x!=null&&a.tooltip.show([g,h],x(e.series.key,p,q,e.point.tooltip,e,E),e.value<0?"n":"s",null,f)},D=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),y.on("tooltipHide",function(){u&&a.tooltip.cleanup()}),E.dispatch=y,E.scatter=b,E.legend=e,E.controls=f,E.xAxis=c,E.yAxis=d,E.distX=g,E.distY=h,d3.rebind(E,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return E},E.width=function(a){if(!arguments.length)return j;j=a;return E},E.height=function(a){if(!arguments.length)return k;k=a;return E},E.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return E},E.showDistX=function(a){if(!arguments.length)return o;o=a;return E},E.showDistY=function(a){if(!arguments.length)return p;p=a;return E},E.showControls=function(a){if(!arguments.length)return r;r=a;return E},E.showLegend=function(a){if(!arguments.length)return q;q=a;return E},E.fisheye=function(a){if(!arguments.length)return s;s=a;return E},E.tooltips=function(a){if(!arguments.length)return u;u=a;return E},E.tooltipContent=function(a){if(!arguments.length)return x;x=a;return E},E.tooltipXContent=function(a){if(!arguments.length)return v;v=a;return E},E.tooltipYContent=function(a){if(!arguments.length)return w;w=a;return E},E.noData=function(a){if(!arguments.length)return z;z=a;return E};return E},a.models.sparkline=function(){function m(a){a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom,n=d3.select(this);f.domain(k||d3.extent(a,h)).range([0,e]),g.domain(l||d3.extent(a,i)).range([m,0]);var o=n.selectAll("g.nv-wrap.nv-sparkline").data([a]),p=o.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),q=p.append("g"),r=o.select("g");o.attr("transform","translate("+b.left+","+b.top+")");var s=o.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||j(a,b)}).attr("d",d3.svg.line().x(function(a,b){return f(h(a,b))}).y(function(a,b){return g(i(a,b))}));var t=o.selectAll("circle.nv-point").data(function(a){function c(b){if(b!=-1){var c=a[b];c.pointIndex=b;return c}return null}var b=a.map(function(a,b){return i(a,b)}),d=c(b.lastIndexOf(g.domain()[1])),e=c(b.indexOf(g.domain()[0])),f=c(b.length-1);return[e,d,f].filter(function(a){return a!=null})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return f(h(a,a.pointIndex))}).attr("cy",function(a,b){return g(i(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return h(a,a.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":i(a,a.pointIndex)==g.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return m}var b={top:2,right:0,bottom:2,left:0 -},c=400,d=32,e=!0,f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=a.utils.getColor(["#000"]),k,l;m.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.x=function(a){if(!arguments.length)return h;h=d3.functor(a);return m},m.y=function(a){if(!arguments.length)return i;i=d3.functor(a);return m},m.xScale=function(a){if(!arguments.length)return f;f=a;return m},m.yScale=function(a){if(!arguments.length)return g;g=a;return m},m.xDomain=function(a){if(!arguments.length)return k;k=a;return m},m.yDomain=function(a){if(!arguments.length)return l;l=a;return m},m.animate=function(a){if(!arguments.length)return e;e=a;return m},m.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b);return m};return m},a.models.sparklinePlus=function(){function n(a){a.each(function(l){function D(){function d(a,c){var d=Math.abs(b.x()(a[0],0)-c),e=0;for(var f=0;f"+a+""+"

"+c+" on "+b+"

"},o,p,q=d3.format(",.2f"),r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left"),b.scatter.pointActive(function(a){return!!Math.round(b.y()(a)*100)});var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=n(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){m&&a.tooltip.cleanup()}),u.dispatch=s,u.stacked=b,u.legend=e,u.controls=f,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return getWidth;h=a;return u},u.height=function(a){if(!arguments.length)return getHeight;i=a;return u},u.color=function(c){if(!arguments.length)return j;j=a.utils.getColor(c),e.color(j),b.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return n;n=a;return u},u.tooltips=function(a){if(!arguments.length)return m;m=a;return u},u.tooltipContent=function(a){if(!arguments.length)return n;n=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u},d.setTickFormat=d.tickFormat,d.tickFormat=function(a){if(!arguments.length)return q;q=a;return d};return u}})() \ No newline at end of file +(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(g=document.body.scrollWidth?m:m-16,l=window.innerHeight>=document.body.scrollHeight?l:l-16;var r=function(a){var b=q;do isNaN(a.offsetTop)||(b+=a.offsetTop);while(a=a.offsetParent);return b},s=function(a){var b=p;do isNaN(a.offsetLeft)||(b+=a.offsetLeft);while(a=a.offsetParent);return b};switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2;var t=s(h),u=r(h);to?b[0]+e:o-t+p),un+m&&(q=n+m-u+q-j);break;case"w":p=b[0]+e,q=b[1]-j/2,t+k>l&&(p=b[0]-k-e),un+m&&(q=n-j-5);break;case"n":p=b[0]-k/2-5,q=b[1]+e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),u+j>n+m&&(q=n+m-u+q-j);break;case"s":p=b[0]-k/2,q=b[1]-j-e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),n>u&&(q=n)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(b){if(!arguments.length)return a.utils.defaultColor();return Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);d||(d=c.length);return typeof a[g]!="undefined"?typeof a[g]=="function"?a[g]():a[g]:c[--d]}},a.utils.pjax=function(b,c){function d(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})}d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.models.axis=function(){function o(d){d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),r=q.append("g"),s=p.select("g");m!==null?a.ticks(m):(a.orient()=="top"||a.orient()=="bottom")&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();t==null&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);u.exit().remove();switch(a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)-12:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"end").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+12:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+n(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}u.text(function(a){return a}),g&&(a.orient()==="left"||a.orient()==="right")&&(s.selectAll("g").each(function(a,b){if(e(a)e.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),e.domain()[0]==e.domain()[1]&&e.domain()[0]==0&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1}));if(g&&(a.orient()==="top"||a.orient()==="bottom")){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a,b){if(e(a)B[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),n=e.copy()});return o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!0,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.ticks=function(a){if(!arguments.length)return m;m=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.axisLabel=function(a){if(!arguments.length)return f;f=a;return o},o.showMaxMin=function(a){if(!arguments.length)return g;g=a;return o},o.highlightZero=function(a){if(!arguments.length)return h;h=a;return o},o.scale=function(b){if(!arguments.length)return e;e=b,a.scale(e),l=typeof e.rangeBands=="function",d3.rebind(o,e,"domain","range","rangeBand","rangeBands");return o},o.rotateYLabel=function(a){if(!arguments.length)return j;j=a;return o},o.rotateLabels=function(a){if(!arguments.length)return i;i=a;return o},o.staggerLabels=function(a){if(!arguments.length)return k;k=a;return o};return o},a.models.historicalBar=function(){function q(a){a.each(function(a){var q=c-b.left-b.right,r=d-b.top-b.bottom,s=d3.select(this);f.domain(n||d3.extent(a[0].values.map(h).concat(j))).range([0,q]),g.domain(o||d3.extent(a[0].values.map(i).concat(k))).range([r,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var t=s.selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-bars"),t.attr("transform","translate("+b.left+","+b.top+")"),s.on("click",function(a,b){p.chartClick({data:a,index:b,pos:d3.event,id:e})}),v.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",r),z.attr("clip-path",l?"url(#nv-chart-clip-path-"+e+")":"");var A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("x",0).attr("y",function(a,b){return g(Math.max(0,i(a,b)))}).attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("fill",function(a,b){return m(a,b)}).attr("class",function(a,b,c){return(i(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(f(h(b,c))-q/a[0].values.length*.5)+",0)"}).attr("width",q/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)})});return q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[],k=[0],l=!0,m=a.utils.defaultColor(),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");q.dispatch=p,q.x=function(a){if(!arguments.length)return h;h=a;return q},q.y=function(a){if(!arguments.length)return i;i=a;return q},q.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return q},q.width=function(a){if(!arguments.length)return c;c=a;return q},q.height=function(a){if(!arguments.length)return d;d=a;return q},q.xScale=function(a){if(!arguments.length)return f;f=a;return q},q.yScale=function(a){if(!arguments.length)return g;g=a;return q},q.xDomain=function(a){if(!arguments.length)return n;n=a;return q},q.yDomain=function(a){if(!arguments.length)return o;o=a;return q},q.forceX=function(a){if(!arguments.length)return j;j=a;return q},q.forceY=function(a){if(!arguments.length)return k;k=a;return q},q.clipEdge=function(a){if(!arguments.length)return l;l=a;return q},q.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return q},q.id=function(a){if(!arguments.length)return e;e=a;return q};return q},a.models.bullet=function(){function n(a){a.each(function(a,c){var h=i-b.left-b.right,k=j-b.top-b.bottom,n=d3.select(this),o=e.call(this,a,c).slice().sort(d3.descending),p=f.call(this,a,c).slice().sort(d3.descending),q=g.call(this,a,c).slice().sort(d3.descending),r=d3.scale.linear().domain([0,Math.max(o[0],p[0],q[0])]).range(d?[h,0]:[0,h]),s=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(r.range());this.__chart__=r;var t=n.selectAll("g.nv-wrap.nv-bullet").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),v=u.append("g"),w=t.select("g");t.attr("transform","translate("+b.left+","+b.top+")");var x=function(a){return Math.abs(s(a)-s(0))},y=function(a){return Math.abs(r(a)-r(0))},z=w.selectAll("rect.nv-range").data(o);z.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",x).attr("height",k).attr("x",d?s:0).on("mouseover",function(a,b){m.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(z).attr("x",d?r:0).attr("width",y).attr("height",k);var A=w.selectAll("rect.nv-measure").data(q);A.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).style("fill",function(a,b){return l(a,b)}).attr("width",x).attr("height",k/3).attr("x",d?s:0).attr("y",k/3).on("mouseover",function(a){m.elementMouseover({value:a,label:"Current",pos:[r(a),k/2]})}).on("mouseout",function(a){m.elementMouseout({value:a,label:"Current"})}),d3.transition(A).attr("width",y).attr("height",k/3).attr("x",d?r:0).attr("y",k/3);var B=w.selectAll("path.nv-markerTriangle").data(p),C=k/6;B.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+s(a)+","+k/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(a,b){m.elementMouseover({value:a,label:"Previous",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:"Previous"})}),d3.transition(B).attr("transform",function(a){return"translate("+r(a)+","+k/2+")"}),B.exit().remove()}),d3.timer.flush();return n}var b={top:0,right:0,bottom:0,left:0},c="left",d=!1,e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=[0],i=380,j=30,k=null,l=a.utils.getColor(["#1f77b4"]),m=d3.dispatch("elementMouseover","elementMouseout");n.dispatch=m,n.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return n},n.ranges=function(a){if(!arguments.length)return e;e=a;return n},n.markers=function(a){if(!arguments.length)return f;f=a;return n},n.measures=function(a){if(!arguments.length)return g;g=a;return n},n.forceX=function(a){if(!arguments.length)return h;h=a;return n},n.width=function(a){if(!arguments.length)return i;i=a;return n},n.height=function(a){if(!arguments.length)return j;j=a;return n},n.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return n},n.tickFormat=function(a){if(!arguments.length)return k;k=a;return n},n.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b);return n};return n},a.models.bulletChart=function(){function q(a){a.each(function(c,m){var r=d3.select(this),s=(i||parseInt(r.style("width"))||960)-e.left-e.right,t=j-e.top-e.bottom,u=this;q.update=function(){q(a)},q.container=this;if(!c||!f.call(this,c,m)){var v=r.selectAll(".nv-noData").data([n]);v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",e.left+s/2).attr("y",18+e.top+t/2).text(function(a){return a});return q}r.selectAll(".nv-noData").remove();var w=f.call(this,c,m).slice().sort(d3.descending),x=g.call(this,c,m).slice().sort(d3.descending),y=h.call(this,c,m).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([c]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+e.left+","+e.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(d?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(D.range());this.__chart__=D;var F=function(a){return Math.abs(E(a)-E(0))},G=function(a){return Math.abs(D(a)-D(0))},H=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(j-e.top-e.bottom)/2+")");H.append("text").attr("class","nv-title").text(function(a){return a.title}),H.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var I=C.select(".nv-bulletWrap");d3.transition(I).call(b);var J=k||D.tickFormat(s/100),K=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||J(a)}),L=K.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",t).attr("y2",t*7/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",t*7/6).text(J);var M=d3.transition(K).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);M.select("line").attr("y1",t).attr("y2",t*7/6),M.select("text").attr("y",t*7/6),d3.transition(K.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),o.on("tooltipShow",function(a){a.key=data[0].title,l&&p(a,u.parentNode)})}),d3.timer.flush();return q}var b=a.models.bullet(),c="left",d=!1,e={top:5,right:40,bottom:20,left:120},f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=null,j=55,k=null,l=!0,m=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0)+e.left,f=b.pos[1]+(c.offsetTop||0)+e.top,g=m(b.key,b.label,b.value,b,q);a.tooltip.show([d,f],g,b.value<0?"e":"w",null,c)};b.dispatch.on("elementMouseover.tooltip",function(a){o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),q.dispatch=o,q.bullet=b,d3.rebind(q,b,"color"),q.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return q},q.ranges=function(a){if(!arguments.length)return f;f=a;return q},q.markers=function(a){if(!arguments.length)return g;g=a;return q},q.measures=function(a){if(!arguments.length)return h;h=a;return q},q.width=function(a){if(!arguments.length)return i;i=a;return q},q.height=function(a){if(!arguments.length)return j;j=a;return q},q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.tickFormat=function(a){if(!arguments.length)return k;k=a;return q},q.tooltips=function(a){if(!arguments.length)return l;l=a;return q},q.tooltipContent=function(a){if(!arguments.length)return m;m=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.cumulativeLineChart=function(){function y(a,c){return c.map(function(c,d){var e=b.y()(c.values[a],a);if(e<-0.95){c.tempDisabled=!0;return c}c.tempDisabled=!1,c.values=c.values.map(function(a,c){a.display={y:(b.y()(a,c)-e)/(1+e)};return a});return c})}function x(a){a.each(function(o){function R(){Q.data([v]),x.update()}function G(a,b){d3.select(x.container).style("cursor","auto")}function F(a,b){v.x=d3.event.x,v.i=Math.round(u.invert(v.x)),R()}function E(a,b){d3.select(x.container).style("cursor","ew-resize")}var z=d3.select(this).classed("nv-chart-"+r,!0),A=this,B=(i||parseInt(z.style("width"))||960)-g.left-g.right,C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom;x.update=function(){x(a)},x.container=this;var D=d3.behavior.drag().on("dragstart",E).on("drag",F).on("dragend",G);if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){var H=z.selectAll(".nv-noData").data([s]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",g.left+B/2).attr("y",g.top+C/2).text(function(a){return a});return x}z.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();if(!n){var I=o.filter(function(a){return!a.disabled}).map(function(a,c){var d=d3.extent(a.values,b.y());return[(d[0]-d[1])/(1+d[1]),(d[1]-d[0])/(1+d[0])]}),J=[d3.min(I,function(a){return a[0]}),d3.max(I,function(a){return a[1]})];b.yDomain(J)}else b.yDomain(null);u.domain([0,o[0].values.length-1]).range([0,B]).clamp(!0);var o=y(v.i,o),K=z.selectAll("g.nv-wrap.nv-cumulativeLine").data([o]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),M=K.select("g");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-background"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-legendWrap"),L.append("g").attr("class","nv-controlsWrap"),k&&(e.width(B),M.select(".nv-legendWrap").datum(o).call(e),g.top!=e.height()&&(g.top=e.height(),C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -g.top+")"));if(m){var N=[{key:"Re-scale y-axis",disabled:!n}];f.width(140).color(["#444","#444","#444"]),M.select(".nv-controlsWrap").datum(N).attr("transform","translate(0,"+ -g.top+")").call(f)}K.attr("transform","translate("+g.left+","+g.top+")");var O=o.filter(function(a){return a.tempDisabled});K.select(".tempDisabled").remove(),O.length&&K.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(O.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),L.select(".nv-background").append("rect"),M.select(".nv-background rect").attr("width",B).attr("height",C),b.y(function(a){return a.display.y}).width(B).height(C).color(o.map(function(a,b){return a.color||h(a,b)}).filter(function(a,b){return!o[b].disabled&&!o[b].tempDisabled}));var P=M.select(".nv-linesWrap").datum(o.filter(function(a){return!a.disabled&&!a.tempDisabled}));P.call(b);var Q=P.selectAll(".nv-indexLine").data([v]);Q.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(D),Q.attr("transform",function(a){return"translate("+u(a.i)+",0)"}).attr("height",C),c.scale(p).tickSubdivide(o[0].values.length>d3.select("body").select("svg").select(".nv-x").selectAll(".tick")[0].length?!0:!1).ticks(Math.min(o[0].values.length,B/70)).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(M.select(".nv-x.nv-axis")).call(c),d.scale(q).ticks(C/36).tickSize(-B,0),d3.transition(M.select(".nv-y.nv-axis")).call(d),M.select(".nv-background rect").on("click",function(){v.x=d3.mouse(this)[0],v.i=Math.round(u.invert(v.x)),R()}),b.dispatch.on("elementClick",function(a){v.i=a.pointIndex,v.x=u(v.i),R()}),f.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,n=!b.disabled,a.call(x)}),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),a.call(x)}),t.on("tooltipShow",function(a){l&&w(a,A.parentNode)})});return x}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:30,bottom:50,left:60},h=a.utils.defaultColor(),i=null,j=null,k=!0,l=!0,m=!0,n=!0,o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p,q,r=b.id(),s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var u=d3.scale.linear(),v={i:0,x:0},w=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,x);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),x.dispatch=t,x.lines=b,x.legend=e,x.xAxis=c,x.yAxis=d,d3.rebind(x,b,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),x.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return x},x.width=function(a){if(!arguments.length)return i;i=a;return x},x.height=function(a){if(!arguments.length)return j;j=a;return x},x.color=function(b){if(!arguments.length)return h;h=a.utils.getColor(b),e.color(h);return x},x.showControls=function(a){if(!arguments.length)return m;m=a;return x},x.showLegend=function(a){if(!arguments.length)return k;k=a;return x},x.tooltips=function(a){if(!arguments.length)return l;l=a;return x},x.tooltipContent=function(a){if(!arguments.length)return o;o=a;return x},x.noData=function(a){if(!arguments.length)return s;s=a;return x};return x},a.models.discreteBar=function(){function t(a){a.each(function(a){var e=c-b.left-b.right,t=d-b.top-b.bottom,u=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var v=n&&o?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(n||d3.merge(v).map(function(a){return a.x})).rangeBands([0,e],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([t-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([t,0]),r=r||f,s=s||g.copy().range([g(0),g(0)]);var w=u.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g"),B=w.select("g");A.append("g").attr("class","nv-groups"),w.attr("transform","translate("+b.left+","+b.top+")");var C=w.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(C.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),C.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.75);var D=C.selectAll("g.nv-bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+(f(h(a,b))+f.rangeBand()*.05)+", "+g(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){p.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){p.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()*.9/a.length),l?(E.append("text").attr("text-anchor","middle"),D.select("text").attr("x",f.rangeBand()*.9/2).attr("y",function(a,b){return i(a,b)<0?g(i(a,b))-g(0)+12:-4}).text(function(a,b){return m(i(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}).select("rect").attr("class",q).attr("width",f.rangeBand()*.9/a.length),d3.transition(D).attr("transform",function(a,b){var c=f(h(a,b))+f.rangeBand()*.05,d=i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0))||1)}),r=f.copy(),s=g.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=d3.format(",.2f"),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q="discreteBar",r,s;t.dispatch=p,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return f;f=a;return t},t.yScale=function(a){if(!arguments.length)return g;g=a;return t},t.xDomain=function(a){if(!arguments.length)return n;n=a;return t},t.yDomain= +function(a){if(!arguments.length)return o;o=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return e;e=a;return t},t.showValues=function(a){if(!arguments.length)return l;l=a;return t},t.valueFormat=function(a){if(!arguments.length)return m;m=a;return t},t.rectClass=function(a){if(!arguments.length)return q;q=a;return t};return t},a.models.discreteBarChart=function(){function q(a){a.each(function(h){var k=d3.select(this),r=this,s=(f||parseInt(k.style("width"))||960)-e.left-e.right,t=(g||parseInt(k.style("height"))||400)-e.top-e.bottom;q.update=function(){a.transition().call(q)},q.container=this;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){var u=k.selectAll(".nv-noData").data([n]);u.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),u.attr("x",e.left+s/2).attr("y",e.top+t/2).text(function(a){return a});return q}k.selectAll(".nv-noData").remove(),l=b.xScale(),m=b.yScale();var v=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),z=w.append("defs"),A=v.select("g");w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis"),w.append("g").attr("class","nv-barsWrap"),A.attr("transform","translate("+e.left+","+e.top+")"),b.width(s).height(t);var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(b),z.append("clipPath").attr("id","nv-x-label-clip-"+b.id()).append("rect"),A.select("#nv-x-label-clip-"+b.id()+" rect").attr("width",l.rangeBand()*(i?2:1)).attr("height",16).attr("x",-l.rangeBand()/(i?1:2)),c.scale(l).ticks(s/100).tickSize(-t,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+(b.showValues()&&m.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(c);var C=A.select(".nv-x.nv-axis").selectAll("g");i?C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"}):C.selectAll("text").attr("transform","translate(0,5)"),d.scale(m).ticks(t/36).tickSize(-s,0),d3.transition(A.select(".nv-y.nv-axis")).call(d),o.on("tooltipShow",function(a){j&&p(a,r.parentNode)})});return q}var b=a.models.discreteBar(),c=a.models.axis(),d=a.models.axis(),e={top:15,right:10,bottom:50,left:60},f=null,g=null,h=a.utils.getColor(),i=!1,j=!0,k=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},l,m,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var p=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),l=k(e.series.key,i,j,e,q);a.tooltip.show([g,h],l,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),q.dispatch=o,q.discretebar=b,q.xAxis=c,q.yAxis=d,d3.rebind(q,b,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.width=function(a){if(!arguments.length)return f;f=a;return q},q.height=function(a){if(!arguments.length)return g;g=a;return q},q.color=function(c){if(!arguments.length)return h;h=a.utils.getColor(c),b.color(h);return q},q.staggerLabels=function(a){if(!arguments.length)return i;i=a;return q},q.tooltips=function(a){if(!arguments.length)return j;j=a;return q},q.tooltipContent=function(a){if(!arguments.length)return k;k=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.distribution=function(){function k(a){a.each(function(a){var i=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x",l=d3.select(this);j=j||h;var m=l.selectAll("g.nv-distribution").data([a]),n=m.enter().append("g").attr("class","nvd3 nv-distribution"),o=n.append("g"),p=m.select("g");m.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var r=q.selectAll("line.nv-dist"+e).data(function(a){return a.values});r.enter().append("line").attr(e+"1",function(a,b){return j(f(a,b))}).attr(e+"2",function(a,b){return j(f(a,b))}),d3.transition(q.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(r).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}),j=h.copy()});return k}var b={top:0,right:0,bottom:0,left:0},c=400,d=8,e="x",f=function(a){return a[e]},g=a.utils.defaultColor(),h=d3.scale.linear(),i,j;k.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return k},k.width=function(a){if(!arguments.length)return c;c=a;return k},k.axis=function(a){if(!arguments.length)return e;e=a;return k},k.size=function(a){if(!arguments.length)return d;d=a;return k},k.getData=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.scale=function(a){if(!arguments.length)return h;h=a;return k},k.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b);return k};return k},a.models.indentedTree=function(){function o(a){a.each(function(b){function C(a){var b=a.values||a._values;return b&&b.length}function B(a){return a._values&&a._values.length}function A(a){return a._values&&a._values.length?l:a.values&&a.values.length?m:""}function z(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c){d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&z(a,0,!0)});return!0}if(!C(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),o.update()}var c=0,e=1,f=d3.layout.tree().children(function(a){return a.values}).size([d,i]);o.update=function(){a.transition().call(o)},o.container=this,b[0]||(b[0]={key:h});var p=f.nodes(b[0]),q=d3.select(this).selectAll("div").data([[p]]),r=q.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),s=r.append("table"),t=q.select("table").attr("width","100%").attr("class",k);if(g){var u=s.append("thead"),v=u.append("tr");j.forEach(function(a){v.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var w=t.selectAll("tbody").data(function(a){return a});w.enter().append("tbody"),e=d3.max(p,function(a){return a.depth}),f.size([d,e*i]);var x=w.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++c});x.exit().remove(),x.select("img.nv-treeicon").attr("src",A).classed("folded",B);var y=x.enter().append("tr");j.forEach(function(a,b){var c=y.append("td").style("padding-left",function(a){return(b?0:a.depth*i+12+(A(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("nv-treeicon",!0).classed("nv-folded",B).attr("src",A).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return A(a)?"inline-block":"none"}).on("click",z),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),x.order().on("click",function(a){n.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){n.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){n.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){n.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})});return o}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=!0,h="No Data Available.",i=20,j=[{key:"key",label:"Name",type:"text"}],k=null,l="images/grey-plus.png",m="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),scatter.color(e);return o},o.id=function(a){if(!arguments.length)return f;f=a;return o},o.header=function(a){if(!arguments.length)return g;g=a;return o},o.noData=function(a){if(!arguments.length)return h;h=a;return o},o.columns=function(a){if(!arguments.length)return j;j=a;return o},o.tableClass=function(a){if(!arguments.length)return k;k=a;return o},o.iconOpen=function(a){if(!arguments.length)return l;l=a;return o},o.iconClose=function(a){if(!arguments.length)return m;m=a;return o};return o},a.models.legend=function(){function i(a){a.each(function(a){var i=c-b.left-b.right,j=d3.select(this),l=j.selectAll("g.nv-legend").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),n=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var o=n.selectAll(".nv-series").data(function(a){return a}),p=o.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){h.legendMouseover(a,b)}).on("mouseout",function(a,b){h.legendMouseout(a,b)}).on("click",function(a,b){h.legendClick(a,b)}).on("dblclick",function(a,b){h.legendDblclick(a,b)});p.append("circle").style("stroke-width",2).attr("r",5),p.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),o.classed("disabled",function(a){return a.disabled}),o.exit().remove(),o.select("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}),o.select("text").text(e);if(g){var q=[];o.each(function(a,b){q.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var r=0,s=0,t=[];while(si&&r>1){t=[],r--;for(k=0;k(t[k%r]||0)&&(t[k%r]=q[k]);s=t.reduce(function(a,b,c,d){return a+b})}var u=[];for(var v=0,w=0;vz&&(z=y);return"translate("+A+","+x+")"}),n.attr("transform","translate("+(c-b.right-z)+","+b.top+")"),d=b.top+b.bottom+x+15}});return i}var b={top:5,right:0,bottom:5,left:0},c=400,d=20,e=function(a){return a.key},f=a.utils.defaultColor(),g=!0,h=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");i.dispatch=h,i.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return i},i.width=function(a){if(!arguments.length)return c;c=a;return i},i.height=function(a){if(!arguments.length)return d;d=a;return i},i.key=function(a){if(!arguments.length)return e;e=a;return i},i.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b);return i},i.align=function(a){if(!arguments.length)return g;g=a;return i};return i},a.models.line=function(){function q(a){a.each(function(a){var q=d-c.left-c.right,r=e-c.top-c.bottom,s=d3.select(this);l=b.xScale(),m=b.yScale(),o=o||l,p=p||m;var t=s.selectAll("g.nv-wrap.nv-line").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-groups"),w.append("g").attr("class","nv-scatterWrap"),t.attr("transform","translate("+c.left+","+c.top+")"),b.width(q).height(r);var A=t.select(".nv-scatterWrap");d3.transition(A).call(b),v.append("clipPath").attr("id","nv-edge-clip-"+b.id()).append("rect"),t.select("#nv-edge-clip-"+b.id()+" rect").attr("width",q).attr("height",r),z.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":""),A.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":"");var B=t.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return f(a,b)}).style("stroke",function(a,b){return f(a,b)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.5);var C=B.selectAll("path.nv-area").data(function(a){return j(a)?[a]:[]});C.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(B.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var D=B.selectAll("path.nv-line").data(function(a){return[a.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y(function(a,b){return p(h(a,b))})),d3.transition(B.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),d3.transition(D).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),o=l.copy(),p=m.copy()});return q}var b=a.models.scatter(),c={top:0,right:0,bottom:0,left:0},d=960,e=500,f=a.utils.defaultColor(),g=function(a){return a.x},h=function(a){return a.y},i=function(a,b){return!isNaN(h(a,b))&&h(a,b)!==null},j=function(a){return a.area},k=!1,l,m,n="linear";b.size(16).sizeDomain([16,256]);var o,p;q.dispatch=b.dispatch,q.scatter=b,d3.rebind(q,b,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){if(!arguments.length)return c;c.top=typeof a.top!="undefined"?a.top:c.top,c.right=typeof a.right!="undefined"?a.right:c.right,c.bottom=typeof a.bottom!="undefined"?a.bottom:c.bottom,c.left=typeof a.left!="undefined"?a.left:c.left;return q},q.width=function(a){if(!arguments.length)return d;d=a;return q},q.height=function(a){if(!arguments.length)return e;e=a;return q},q.x=function(a){if(!arguments.length)return g;g=a,b.x(a);return q},q.y=function(a){if(!arguments.length)return h;h=a,b.y(a);return q},q.clipEdge=function(a){if(!arguments.length)return k;k=a;return q},q.color=function(c){if(!arguments.length)return f;f=a.utils.getColor(c),b.color(f);return q},q.interpolate=function(a){if(!arguments.length)return n;n=a;return q},q.defined=function(a){if(!arguments.length)return i;i=a;return q},q.isArea=function(a){if(!arguments.length)return j;j=d3.functor(a);return q};return q},a.models.lineChart=function(){function r(a){a.each(function(l){var s=d3.select(this),t=this,u=(h||parseInt(s.style("width"))||960)-f.left-f.right,v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom;r.update=function(){r(a)},r.container=this;if(!l||!l.length||!l.filter(function(a){return a.values.length}).length){var w=s.selectAll(".nv-noData").data([o]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",f.left+u/2).attr("y",f.top+v/2).text(function(a){return a});return r}s.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale();var z=s.selectAll("g.nv-wrap.nv-lineChart").data([l]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),B=z.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-linesWrap"),A.append("g").attr("class","nv-legendWrap"),j&&(e.width(u),B.select(".nv-legendWrap").datum(l).call(e),f.top!=e.height()&&(f.top=e.height(),v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom),z.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),z.attr("transform","translate("+f.left+","+f.top+")"),b.width(u).height(v).color(l.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!l[b].disabled}));var C=B.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled}));d3.transition(C).call(b),c.scale(m).ticks(u/100).tickSize(-v,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(B.select(".nv-x.nv-axis")).call(c),d.scale(n).ticks(v/36).tickSize(-u,0),d3.transition(B.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l.filter(function(a){return!a.disabled}).length||l.map(function(a){a.disabled=!1,z.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(r)}),p.on("tooltipShow",function(a){k&&q(a,t.parentNode)})});return r}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f={top:30,right:20,bottom:50,left:60},g=a.utils.defaultColor(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},m,n,o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var q=function(e,f){if(f){var g=d3.select(f).select("svg"),h=g.attr("viewBox");if(h){h=h.split(" ");var i=parseInt(g.style("width"))/h[2];e.pos[0]=e.pos[0]*i,e.pos[1]=e.pos[1]*i}}var j=e.pos[0]+(f.offsetLeft||0),k=e.pos[1]+(f.offsetTop||0),m=c.tickFormat()(b.x()(e.point,e.pointIndex)),n=d.tickFormat()(b.y()(e.point,e.pointIndex)),o=l(e.series.key,m,n,e,r);a.tooltip.show([j,k],o,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){k&&a.tooltip.cleanup()}),r.dispatch=p,r.lines=b,r.legend=e,r.xAxis=c,r.yAxis=d,d3.rebind(r,b,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){if(!arguments.length)return f;f.top=typeof a.top!="undefined"?a.top:f.top,f.right=typeof a.right!="undefined"?a.right:f.right,f.bottom=typeof a.bottom!="undefined"?a.bottom:f.bottom,f.left=typeof a.left!="undefined"?a.left:f.left;return r},r.width=function(a){if(!arguments.length)return h;h=a;return r},r.height=function(a){if(!arguments.length)return i;i=a;return r},r.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b),e.color(g);return r},r.showLegend=function(a){if(!arguments.length)return j;j=a;return r},r.tooltips=function(a){if(!arguments.length)return k;k=a;return r},r.tooltipContent=function(a){if(!arguments.length)return l;l=a;return r},r.noData=function(a){if(!arguments.length)return o;o=a;return r};return r},a.models.linePlusBarChart=function(){function w(a){a.each(function(k){var l=d3.select(this),p=this,y=(i||parseInt(l.style("width"))||960)-h.left-h.right,z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom;w.update=function(){w(a)},w.container=this;if(!k||!k.length||!k.filter(function(a){return a.values.length}).length){var A=l.selectAll(".nv-noData").data([t]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",h.left+y/2).attr("y",h.top+z/2).text(function(a){return a});return w}l.selectAll(".nv-noData").remove(),q=b.xScale(),r=c.yScale(),s=b.yScale();var B=k.filter(function(a){return!a.disabled&&a.bar}),C=k.filter(function(a){return!a.bar}),D=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([k]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y1 nv-axis"),E.append("g").attr("class","nv-y2 nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-linesWrap"),E.append("g").attr("class","nv-legendWrap"),n&&(g.width(y/2),F.select(".nv-legendWrap").datum(k.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)");return a})).call(g),h.top!=g.height()&&(h.top=g.height(),z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom),F.select(".nv-legendWrap").attr("transform","translate("+y/2+","+ -h.top+")")),D.attr("transform","translate("+h.left+","+h.top+")"),b.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&!k[b].bar})),c.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&k[b].bar}));var G=F.select(".nv-barsWrap").datum(B.length?B:[{values:[]}]),H=F.select(".nv-linesWrap").datum(C[0].disabled?[{values:[]}]:C);d3.transition(G).call(c),d3.transition(H).call(b),d.scale(q).ticks(y/100).tickSize(-z,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(d),e.scale(r).ticks(z/36).tickSize(-y,0),d3.transition(F.select(".nv-y1.nv-axis")).style("opacity",B.length?1:0).call(e),f.scale(s).ticks(z/36).tickSize(B.length?0:-y,0),F.select(".nv-y2.nv-axis").style("opacity",C.length?1:0).attr("transform","translate("+q.range()[1]+",0)"),d3.transition(F.select(".nv-y2.nv-axis")).call(f),g.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(w)}),u.on("tooltipShow",function(a){o&&v(a,p.parentNode)})});return w}var b=a.models.line(),c=a.models.historicalBar(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.legend(),h={top:30,right:60,bottom:50,left:60},i=null,j=null,k=function(a){return a.x},l=function(a){return a.y},m=a.utils.defaultColor(),n=!0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},q,r,s,t="No Data Available.",u=d3.dispatch("tooltipShow","tooltipHide");b.clipEdge(!1),d.orient("bottom").tickPadding(7),e.orient("left"),f.orient("right");var v=function(c,g){var h=c.pos[0]+(g.offsetLeft||0),i=c.pos[1]+(g.offsetTop||0),j=d.tickFormat()(b.x()(c.point,c.pointIndex)),k=(c.series.bar?e:f).tickFormat()(b.y()(c.point,c.pointIndex)),l=p(c.series.key,j,k,c,w);a.tooltip.show([h,i],l,c.value<0?"n":"s",null,g)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),c.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),c.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),w.dispatch=u,w.legend=g,w.lines=b,w.bars=c,w.xAxis=d,w.y1Axis=e,w.y2Axis=f,d3.rebind(w,b,"defined","size","clipVoronoi","interpolate"),w.x=function(a){if(!arguments.length)return k;k=a,b.x(a),c.x(a);return w},w.y=function(a){if(!arguments.length)return l;l=a,b.y(a),c.y(a);return w},w.margin=function(a){if(!arguments.length)return h;h.top=typeof a.top!="undefined"?a.top:h.top,h.right=typeof a.right!="undefined"?a.right:h.right,h.bottom=typeof a.bottom!="undefined"?a.bottom:h.bottom,h.left=typeof a.left!="undefined"?a.left:h.left;return w},w.width=function(a){if(!arguments.length)return i;i=a;return w},w.height=function(a){if(!arguments.length)return j;j=a;return w},w.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b),g.color(m);return w},w.showLegend=function(a){if(!arguments.length)return n;n=a;return w},w.tooltips=function(a){if(!arguments.length)return o;o=a;return w},w.tooltipContent=function(a){if(!arguments.length)return p;p=a;return w},w.noData=function(a){if(!arguments.length)return t;t=a;return w};return w},a.models.lineWithFocusChart=function(){function A(a){a.each(function(w){function R(){u=i.empty()?null:i.extent(),extent=i.empty()?r.domain():i.extent(),y.brush({extent:extent,brush:i}),Q();var a=J.select(".nv-focus .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}).map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return b.x()(a,c)>=extent[0]&&b.x()(a,c)<=extent[1]})}}));d3.transition(a).call(b),d3.transition(J.select(".nv-focus .nv-x.nv-axis")).call(d),d3.transition(J.select(".nv-focus .nv-y.nv-axis")).call(e)}function Q(){i.empty()||i.extent(u),N.data([i.empty()?r.domain():u]).each(function(a,b){var c=r(a[0])-p.range()[0],d=p.range()[1]-r(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",r(a[1])).attr("width",d<0?0:d)})}function P(a){var b=+(a=="e"),c=b?1:-1,d=F/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}var B=d3.select(this),C=this,D=(m||parseInt(B.style("width"))||960)-j.left-j.right,E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o,F=o-k.top-k.bottom;A.update=function(){A(a)},A.container=this;if(!w||!w.length||!w.filter(function(a){return a.values.length}).length){var G=B.selectAll(".nv-noData").data([x]);G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),G.attr("x",j.left+D/2).attr("y",j.top+E/2).text(function(a){return a});return A}B.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale(),r=c.xScale(),s=c.yScale();var H=B.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([w]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),J=H.select("g");I.append("g").attr("class","nv-legendWrap");var K=I.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-linesWrap");var L=I.append("g").attr("class","nv-context");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-brushBackground"),L.append("g").attr("class","nv-x nv-brush"),t&&(h.width(D),J.select(".nv-legendWrap").datum(w).call(h),j.top!=h.height()&&(j.top=h.height(),E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -j.top+")")),H.attr("transform","translate("+j.left+","+j.top+")"),b.width(D).height(E).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),c.defined(b.defined()).width(D).height(F).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),J.select(".nv-context").attr("transform","translate(0,"+(E+j.bottom+k.top)+")");var M=J.select(".nv-context .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}));d3.transition(M).call(c),d.scale(p).ticks(D/100).tickSize(-E,0),e.scale(q).ticks(E/36).tickSize(-D,0),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+E+")"),i.x(r).on("brush",R),u&&i.extent(u);var N=J.select(".nv-brushBackground").selectAll("g").data([u||i.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=J.select(".nv-x.nv-brush").call(i),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",P),R(),f.scale(r).ticks(D/100).tickSize(-F,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(f),g.scale(s).ticks(F/36).tickSize(-D,0),d3.transition(J.select(".nv-context .nv-y.nv-axis")).call(g),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),h.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w.filter(function(a){return!a.disabled}).length||w.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(A)}),y.on("tooltipShow",function(a){v&&z(a,C.parentNode)})});return A}var b=a.models.line(),c=a.models.line(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=d3.svg.brush(),j={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},l=a.utils.defaultColor(),m=null,n=null,o=100,p,q,r,s,t=!0,u=null,v=!0,w=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},x="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide","brush");b.clipEdge(!0),c.interactive(!1),d.orient("bottom").tickPadding(5),e.orient("left"),f.orient("bottom").tickPadding(5),g.orient("left");var z=function(c,f){var g=c.pos[0]+(f.offsetLeft||0),h=c.pos[1]+(f.offsetTop||0),i=d.tickFormat()(b.x()(c.point,c.pointIndex)),j=e.tickFormat()(b.y()(c.point,c.pointIndex)),k=w(c.series.key,i,j,c,A);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],y.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){v&&a.tooltip.cleanup()}),A.dispatch=y,A.legend=h,A.lines=b,A.lines2=c,A.xAxis=d,A.yAxis=e,A.x2Axis=f,A.y2Axis=g,d3.rebind(A,b,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){if(!arguments.length)return b.x;b.x(a),c.x(a);return A},A.y=function(a){if(!arguments.length)return b.y;b.y(a),c.y(a);return A},A.margin=function(a){if(!arguments.length)return j;j.top=typeof a.top!="undefined"?a.top:j.top,j.right=typeof a.right!="undefined"?a.right:j.right,j.bottom=typeof a.bottom!="undefined"?a.bottom:j.bottom,j.left=typeof a.left!="undefined"?a.left:j.left;return A},A.margin2=function(a){if(!arguments.length)return k;k=a;return A},A.width=function(a){if(!arguments.length)return m;m=a;return A},A.height=function(a){if(!arguments.length)return n;n=a;return A},A.height2=function(a){if(!arguments.length)return o;o=a;return A},A.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),h.color(l);return A},A.showLegend=function(a){if(!arguments.length)return t;t=a;return A},A.tooltips=function(a){if(!arguments.length)return v;v=a;return A},A.tooltipContent=function(a){if(!arguments.length)return w;w=a;return A},A.interpolate=function(a){if(!arguments.length)return b.interpolate();b.interpolate(a),c.interpolate(a);return A},A.noData=function(a){if(!arguments.length)return x;x=a;return A},A.xTickFormat=function(a){if(!arguments.length)return d.tickFormat();d.tickFormat(a),f.tickFormat(a);return A},A.yTickFormat=function(a){if(!arguments.length)return e.tickFormat();e.tickFormat(a),g.tickFormat(a);return A};return A},a.models.multiBar=function(){function t +(a){a.each(function(a){var t=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=o&&p?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});e.domain(d3.merge(w).map(function(a){return a.x})).rangeBands([0,t],.1),f.domain(p||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([u,0]);if(e.domain()[0]===e.domain()[1]||f.domain()[0]===f.domain()[1])singlePoint=!0;e.domain()[0]===e.domain()[1]&&(e.domain()[0]?e.domain([e.domain()[0]-e.domain()[0]*.01,e.domain()[1]+e.domain()[1]*.01]):e.domain([-1,1])),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]+f.domain()[0]*.01,f.domain()[1]-f.domain()[1]*.01]):f.domain([-1,1])),r=r||e,s=s||f;var z=v.selectAll("g.nv-wrap.nv-multibar").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")"),B.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),z.select("#nv-edge-clip-"+g+" rect").attr("width",t).attr("height",u),D.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).selectAll("rect.nv-bar").delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return m(a,b)}).style("stroke",function(a,b){return m(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("rect.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return l?0:d*e.rangeBand()/a.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:a.length));F.style("fill",function(a,b,c){return m(a,c,b)}).style("stroke",function(a,b,c){return m(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){q.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){q.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+e(h(a,b))+",0)"}),l?d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.max(Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(b,c){return l?0:b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/(l?1:a.length))}):d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("x",function(b,c){return b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/a.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(0)-f(i(a,b))<1?f(0)-1:f(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(f(i(a,b))-f(0)),1)})}),r=e.copy(),s=f.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.ordinal(),f=d3.scale.linear(),g=Math.floor(Math.random()*1e4),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=!0,l=!1,m=a.utils.defaultColor(),n=1200,o,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),r,s;t.dispatch=q,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return e;e=a;return t},t.yScale=function(a){if(!arguments.length)return f;f=a;return t},t.xDomain=function(a){if(!arguments.length)return o;o=a;return t},t.yDomain=function(a){if(!arguments.length)return p;p=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.stacked=function(a){if(!arguments.length)return l;l=a;return t},t.clipEdge=function(a){if(!arguments.length)return k;k=a;return t},t.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return g;g=a;return t},t.delay=function(a){if(!arguments.length)return n;n=a;return t};return t},a.models.multiBarChart=function(){function v(a){a.each(function(p){var w=d3.select(this),z=this,A=(h||parseInt(w.style("width"))||960)-g.left-g.right,B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom;v.update=function(){a.transition().call(v)},v.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=w.selectAll(".nv-noData").data([s]);C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",g.left+A/2).attr("y",g.top+B/2).text(function(a){return a});return v}w.selectAll(".nv-noData").remove(),q=b.xScale(),r=b.yScale();var D=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([p]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-controlsWrap"),l&&(e.width(A/2),F.select(".nv-legendWrap").datum(p).call(e),g.top!=e.height()&&(g.top=e.height(),B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom),F.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -g.top+")"));if(k){var G=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),F.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+ -g.top+")").call(f)}D.attr("transform","translate("+g.left+","+g.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!p[b].disabled}));var H=F.select(".nv-barsWrap").datum(p.filter(function(a){return!a.disabled}));d3.transition(H).call(b),c.scale(q).ticks(A/100).tickSize(-B,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(c);var I=F.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1),m&&I.filter(function(a,b){return b%Math.ceil(p[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),n&&I.selectAll("text").attr("transform",function(a,b,c){return"rotate("+n+" 0,0)"}).attr("text-transform",n>0?"start":"end"),F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),d.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(F.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(v)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){G=G.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(v)}}),t.on("tooltipShow",function(a){o&&u(a,z.parentNode)})});return v}var b=a.models.multiBar(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:20,bottom:30,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!0,n=0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" on "+b+"

"},q,r,s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");b.stacked(!1),c.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var u=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=p(e.series.key,i,j,e,v);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),v.dispatch=t,v.multibar=b,v.legend=e,v.xAxis=c,v.yAxis=d,d3.rebind(v,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return v},v.width=function(a){if(!arguments.length)return h;h=a;return v},v.height=function(a){if(!arguments.length)return i;i=a;return v},v.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return v},v.showControls=function(a){if(!arguments.length)return k;k=a;return v},v.showLegend=function(a){if(!arguments.length)return l;l=a;return v},v.reduceXTicks=function(a){if(!arguments.length)return m;m=a;return v},v.rotateLabels=function(a){if(!arguments.length)return n;n=a;return v},v.tooltip=function(a){if(!arguments.length)return p;p=a;return v},v.tooltips=function(a){if(!arguments.length)return o;o=a;return v},v.tooltipContent=function(a){if(!arguments.length)return p;p=a;return v},v.noData=function(a){if(!arguments.length)return s;s=a;return v};return v},a.models.multiBarHorizontal=function(){function v(a){a.each(function(a){var e=c-b.left-b.right,p=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=q&&r?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(q||d3.merge(w).map(function(a){return a.x})).rangeBands([0,p],.1),g.domain(r||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,e-(g.domain()[1]>0?n:0)]):g.range([0,e]),t=t||f,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var z=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+u(l?b.y0:0)+","+(l?0:d*f.rangeBand()/a.length+f(h(b,c)))+")"});G.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),s.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[g(i(b,c)+(l?b.y0:0)),f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),s.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){s.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){s.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(G.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),F.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(F).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):F.selectAll("text").remove(),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(F).attr("transform",function(a,b){return"translate("+g(a.y0)+","+f(h(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(g(i(a,b)+a.y0)-g(a.y0))}).attr("height",f.rangeBand()):d3.transition(F).attr("transform",function(b,c){return"translate("+(i(b,c)<0?g(i(b,c)):g(0))+","+(b.series*f.rangeBand()/a.length+f(h(b,c)))+")"}).select("rect").attr("height",f.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)}),t=f.copy(),u=g.copy()});return v}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),t,u;v.dispatch=s,v.x=function(a){if(!arguments.length)return h;h=a;return v},v.y=function(a){if(!arguments.length)return i;i=a;return v},v.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.xScale=function(a){if(!arguments.length)return f;f=a;return v},v.yScale=function(a){if(!arguments.length)return g;g=a;return v},v.xDomain=function(a){if(!arguments.length)return q;q=a;return v},v.yDomain=function(a){if(!arguments.length)return r;r=a;return v},v.forceY=function(a){if(!arguments.length)return j;j=a;return v},v.stacked=function(a){if(!arguments.length)return l;l=a;return v},v.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return v},v.id=function(a){if(!arguments.length)return e;e=a;return v},v.delay=function(a){if(!arguments.length)return p;p=a;return v},v.showValues=function(a){if(!arguments.length)return m;m=a;return v},v.valueFormat=function(a){if(!arguments.length)return o;o=a;return v},v.valuePadding=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontalChart=function(){function u(a){a.each(function(m){var o=d3.select(this),v=this,w=(h||parseInt(o.style("width"))||960)-g.left-g.right,z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom;u.update=function(){a.transition().call(u)},u.container=this;if(!m||!m.length||!m.filter(function(a){return a.values.length}).length){var A=o.selectAll(".nv-noData").data([r]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",g.left+w/2).attr("y",g.top+z/2).text(function(a){return a});return u}o.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();var B=o.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([m]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),D=B.select("g");C.append("g").attr("class","nv-x nv-axis"),C.append("g").attr("class","nv-y nv-axis"),C.append("g").attr("class","nv-barsWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap"),l&&(e.width(w/2),D.select(".nv-legendWrap").datum(m).call(e),g.top!=e.height()&&(g.top=e.height(),z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom),D.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -g.top+")"));if(k){var E=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(E).attr("transform","translate(0,"+ -g.top+")").call(f)}B.attr("transform","translate("+g.left+","+g.top+")"),b.width(w).height(z).color(m.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!m[b].disabled}));var F=D.select(".nv-barsWrap").datum(m.filter(function(a){return!a.disabled}));d3.transition(F).call(b),c.scale(p).ticks(z/24).tickSize(-w,0),d3.transition(D.select(".nv-x.nv-axis")).call(c);var G=D.select(".nv-x.nv-axis").selectAll("g");G.selectAll("line, text").style("opacity",1),d.scale(q).ticks(w/100).tickSize(-z,0),D.select(".nv-y.nv-axis").attr("transform","translate(0,"+z+")"),d3.transition(D.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,m.filter(function(a){return!a.disabled}).length||m.map(function(a){a.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(u)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){E=E.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(u)}}),s.on("tooltipShow",function(a){n&&t(a,v.parentNode)})});return u}var b=a.models.multiBarHorizontal(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend().height(30),f=a.models.legend().height(30),g={top:30,right:20,bottom:50,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!1,n=!0,o=function(a,b,c,d,e){return"

"+a+" - "+b+"

"+"

"+c+"

"},p,q,r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");b.stacked(m),c.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("bottom").tickFormat(d3.format(",.1f"));var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"e":"w",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),u.dispatch=s,u.multibar=b,u.legend=e,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return h;h=a;return u},u.height=function(a){if(!arguments.length)return i;i=a;return u},u.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return o;o=a;return u},u.tooltips=function(a){if(!arguments.length)return n;n=a;return u},u.tooltipContent=function(a){if(!arguments.length)return o;o=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u};return u},a.models.multiChart=function(){function y(a){a.each(function(h){var j=d3.select(this),z=this,A=(d||parseInt(j.style("width"))||960)-b.left-b.right,B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom,C=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==1}),D=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==2}),E=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==1}),F=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==2}),G=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==1}),H=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==2}),I=h.filter(function(a){return!a.disabled&&a.yAxis==1}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),J=h.filter(function(a){return!a.disabled&&a.yAxis==2}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});i.domain(d3.extent(d3.merge(I.concat(J)),function(a){return a.x})).range([0,A]);var K=j.selectAll("g.wrap.multiChart").data([h]),L=K.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");L.append("g").attr("class","x axis"),L.append("g").attr("class","y1 axis"),L.append("g").attr("class","y2 axis"),L.append("g").attr("class","lines1Wrap"),L.append("g").attr("class","lines2Wrap"),L.append("g").attr("class","bars1Wrap"),L.append("g").attr("class","bars2Wrap"),L.append("g").attr("class","stack1Wrap"),L.append("g").attr("class","stack2Wrap"),L.append("g").attr("class","legendWrap");var M=K.select("g");f&&(v.width(A/2),M.select(".legendWrap").datum(h.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)");return a})).call(v),b.top!=v.height()&&(b.top=v.height(),B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom),M.select(".legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),m.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="line"})),n.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="line"})),o.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="bar"})),p.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="bar"})),q.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="area"})),r.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="area"})),M.attr("transform","translate("+b.left+","+b.top+")");var N=M.select(".lines1Wrap").datum(C),O=M.select(".bars1Wrap").datum(E),P=M.select(".stack1Wrap").datum(G),Q=M.select(".lines2Wrap").datum(D),R=M.select(".bars2Wrap").datum(F),S=M.select(".stack2Wrap").datum(H),T=G.length?G.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];k.domain(d3.extent(d3.merge(I).concat(T),function(a){return a.y})).range([0,B]),l.domain(d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,B]),m.yDomain(k.domain()),o.yDomain(k.domain()),q.yDomain(k.domain()),n.yDomain(l.domain()),p.yDomain(l.domain()),r.yDomain(l.domain()),G.length&&d3.transition(P).call(q),H.length&&d3.transition(S).call(r),E.length&&d3.transition(O).call(o),F.length&&d3.transition(R).call(p),C.length&&d3.transition(N).call(m),D.length&&d3.transition(Q).call(n),s.ticks(A/100).tickSize(-B,0),M.select(".x.axis").attr("transform","translate(0,"+B+")"),d3.transition(M.select(".x.axis")).call(s),t.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y1.axis")).call(t),u.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y2.axis")).call(u),M.select(".y2.axis").style("opacity",J.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,K.selectAll(".series").classed("disabled",!1);return a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this;return y}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},i,j,i=d3.scale.linear(),k=d3.scale.linear(),l=d3.scale.linear(),m=a.models.line().yScale(k),n=a.models.line().yScale(l),o=a.models.multiBar().stacked(!1).yScale(k),p=a.models.multiBar().stacked(!1).yScale(l),q=a.models.stackedArea().yScale(k),r=a.models.stackedArea().yScale(l),s=a.models.axis().scale(i).orient("bottom").tickPadding(5),t=a.models.axis().scale(k).orient("left"),u=a.models.axis().scale(l).orient("right"),v=a.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=(b.series.bar?t:u).tickFormat()(m.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,y);a.tooltip.show([d,e],i,undefined,undefined,c.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),q.dispatch.on("tooltipShow",function(a){if(!Math.round(q.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),q.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),r.dispatch.on("tooltipShow",function(a){if(!Math.round(r.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),r.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),w.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),y.dispatch=w,y.lines1=m,y.lines2=n,y.bars1=o,y.bars2=p,y.stack1=q,y.stack2=r,y.xAxis=s,y.yAxis1=t,y.yAxis2=u,y.x=function(a){if(!arguments.length)return getX;getX=a,m.x(a),o.x(a);return y},y.y=function(a){if(!arguments.length)return getY;getY=a,m.y(a),o.y(a);return y},y.margin=function(a){if(!arguments.length)return b;b=a;return y},y.width=function(a){if(!arguments.length)return d;d=a;return y},y.height=function(a){if(!arguments.length)return e;e=a;return y},y.color=function(a){if(!arguments.length)return c;c=a,v.color(a);return y},y.showLegend=function(a){if(!arguments.length)return f;f=a;return y},y.tooltips=function(a){if(!arguments.length)return g;g=a;return y},y.tooltipContent=function(a){if(!arguments.length)return h;h=a;return y};return y},a.models.ohlcBar=function(){function u(a){a.each(function(a){var q=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);f.domain(r||d3.extent(a[0].values.map(h).concat(n))).range([0,q]),g.domain(s||[d3.min(a[0].values.map(m).concat(o)),d3.max(a[0].values.map(l).concat(o))]).range([u,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var w=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),A=z.append("defs"),B=z.append("g"),C=w.select("g");B.append("g").attr("class","nv-ticks"),w.attr("transform","translate("+b.left+","+b.top+")"),v.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:e})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",u),C.attr("clip-path",p?"url(#nv-chart-clip-path-"+e+")":"");var D=w.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});D.exit().remove();var E=D.enter().append("path").attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){t.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){t.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})});return u}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=function(a){return a.open},k=function(a){return a.close},l=function(a){return a.high},m=function(a){return a.low},n=[],o=[],p=!0,q=a.utils.defaultColor(),r,s,t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");u.dispatch=t,u.x=function(a){if(!arguments.length)return h;h=a;return u},u.y=function(a){if(!arguments.length)return i;i=a;return u},u.open=function(a){if(!arguments.length)return j;j=a;return u},u.close=function(a){if(!arguments.length)return k;k=a;return u},u.high=function(a){if(!arguments.length)return l;l=a;return u},u.low=function(a){if(!arguments.length)return m;m=a;return u},u.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof +a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return u},u.width=function(a){if(!arguments.length)return c;c=a;return u},u.height=function(a){if(!arguments.length)return d;d=a;return u},u.xScale=function(a){if(!arguments.length)return f;f=a;return u},u.yScale=function(a){if(!arguments.length)return g;g=a;return u},u.xDomain=function(a){if(!arguments.length)return r;r=a;return u},u.yDomain=function(a){if(!arguments.length)return s;s=a;return u},u.forceX=function(a){if(!arguments.length)return n;n=a;return u},u.forceY=function(a){if(!arguments.length)return o;o=a;return u},u.clipEdge=function(a){if(!arguments.length)return p;p=a;return u},u.color=function(b){if(!arguments.length)return q;q=a.utils.getColor(b);return u},u.id=function(a){if(!arguments.length)return e;e=a;return u};return u},a.models.pie=function(){function p(a){a.each(function(a){function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);this._current=b(0);return function(a){return w(b(a))}}function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this),s=r.selectAll(".nv-wrap.nv-pie").data([e(a[0])]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+h),u=t.append("g"),v=s.select("g");u.append("g").attr("class","nv-pie"),s.attr("transform","translate("+b.left+","+b.top+")"),v.select(".nv-pie").attr("transform","translate("+j/2+","+p/2+")"),r.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})});var w=d3.svg.arc().outerRadius(q-q/5);n&&w.innerRadius(q/2);var x=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:g(a)}),y=s.select(".nv-pie").selectAll(".nv-slice").data(x);y.exit().remove();var z=y.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:f(a.data),value:g(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:h})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:f(a.data),value:g(a.data),point:a.data,index:b,id:h})}).on("click",function(a,b){o.elementClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()});y.attr("fill",function(a,b){return i(a,b)}).attr("stroke",function(a,b){return i(a,b)});var A=z.append("path").each(function(a){this._current=a});d3.transition(y.select("path")).attr("d",w).attrTween("d",D);if(k){var B=w;l&&(B=d3.svg.arc().outerRadius(w.outerRadius())),z.append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor","middle").style("fill","#000")}),y.select(".nv-label").transition().attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),y.each(function(a,b){var c=d3.select(this);c.select(".nv-label text").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>m?f(a.data):""});var d=c.select("text").node().getBBox();c.select(".nv-label rect").attr("width",d.width+10).attr("height",d.height+10).attr("transform",function(){return"translate("+[d.x-5,d.y-5]+")"})})}});return p}var b={top:0,right:0,bottom:0,left:0},c=500,d=500,e=function(a){return a.values},f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(Math.random()*1e4),i=a.utils.defaultColor(),j=d3.format(",.2f"),k=!0,l=!1,m=.02,n=!1,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");p.dispatch=o,p.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.values=function(a){if(!arguments.length)return e;e=a;return p},p.x=function(a){if(!arguments.length)return f;f=a;return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return p},p.showLabels=function(a){if(!arguments.length)return k;k=a;return p},p.donutLabelsOutside=function(a){if(!arguments.length)return l;l=a;return p},p.donut=function(a){if(!arguments.length)return n;n=a;return p},p.id=function(a){if(!arguments.length)return h;h=a;return p},p.color=function(b){if(!arguments.length)return i;i=a.utils.getColor(b);return p},p.valueFormat=function(a){if(!arguments.length)return j;j=a;return p},p.labelThreshold=function(a){if(!arguments.length)return m;m=a;return p};return p},a.models.pieChart=function(){function n(a){a.each(function(h){var i=d3.select(this),j=this,m=(e||parseInt(i.style("width"))||960)-d.left-d.right,o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom;n.update=function(){n(a)},n.container=this;if(!h||!h.length){var p=i.selectAll(".nv-noData").data([k]);p.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),p.attr("x",d.left+m/2).attr("y",d.top+o/2).text(function(a){return a});return n}i.selectAll(".nv-noData").remove();var q=i.selectAll("g.nv-wrap.nv-pieChart").data([h]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),s=q.select("g");r.append("g").attr("class","nv-pieWrap"),r.append("g").attr("class","nv-legendWrap"),g&&(c.width(m).key(b.x()),q.select(".nv-legendWrap").datum(b.values()(h[0])).call(c),d.top!=c.height()&&(d.top=c.height(),o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom),q.select(".nv-legendWrap").attr("transform","translate(0,"+ -d.top+")")),q.attr("transform","translate("+d.left+","+d.top+")"),b.width(m).height(o);var t=s.select(".nv-pieWrap").datum(h);d3.transition(t).call(b),c.dispatch.on("legendClick",function(c,d,e){c.disabled=!c.disabled,b.values()(h[0]).filter(function(a){return!a.disabled}).length||b.values()(h[0]).map(function(a){a.disabled=!1,q.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(n)}),b.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)})});return n}var b=a.models.pie(),c=a.models.legend(),d={top:30,right:20,bottom:20,left:20},e=null,f=null,g=!0,h=a.utils.defaultColor(),i=!0,j=function(a,b,c,d){return"

"+a+"

"+"

"+b+"

"},k="No Data Available.",l=d3.dispatch("tooltipShow","tooltipHide"),m=function(c,d){var e=c.pos[0]+(d&&d.offsetLeft||0),f=c.pos[1]+(d&&d.offsetTop||0),g=b.valueFormat()(b.y()(c.point)),h=j(b.x()(c.point),g,c,n);a.tooltip.show([e,f],h,c.value<0?"n":"s",null,d)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+d.left,a.pos[1]+d.top],l.tooltipShow(a)}),l.on("tooltipShow",function(a){i&&m(a)}),l.on("tooltipHide",function(){i&&a.tooltip.cleanup()}),n.dispatch=l,n.pie=b,d3.rebind(n,b,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){if(!arguments.length)return d;d.top=typeof a.top!="undefined"?a.top:d.top,d.right=typeof a.right!="undefined"?a.right:d.right,d.bottom=typeof a.bottom!="undefined"?a.bottom:d.bottom,d.left=typeof a.left!="undefined"?a.left:d.left;return n},n.width=function(a){if(!arguments.length)return e;e=a;return n},n.height=function(a){if(!arguments.length)return f;f=a;return n},n.color=function(d){if(!arguments.length)return h;h=a.utils.getColor(d),c.color(h),b.color(h);return n},n.showLegend=function(a){if(!arguments.length)return g;g=a;return n},n.tooltips=function(a){if(!arguments.length)return i;i=a;return n},n.tooltipContent=function(a){if(!arguments.length)return j;j=a;return n},n.noData=function(a){if(!arguments.length)return k;k=a;return n};return n},a.models.scatter=function(){function H(a){a.each(function(a){function Q(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c,a]}).filter(function(a,b){return r(a[4],b)})}));if(t){N.append("clipPath").attr("id","nv-points-clip-"+f);var e=L.select("#nv-points-clip-"+f).selectAll("circle").data(d);e.enter().append("circle").attr("r",u),e.exit().remove(),e.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),L.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){d.length<3&&(d.push([g.range()[0]-20,h.range()[0]-20,null,null]),d.push([g.range()[1]+20,h.range()[1]+20,null,null]));var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=L.select(".nv-point-paths").selectAll("path").data(i);l.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),l.exit().remove(),l.attr("d",function(a){return"M"+a.data.join(",")+"Z"}),c=l}else{var m=d.map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}});c=L.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementClick({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseover",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementMouseover({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseout",function(b,c){if(G)return 0;var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})}),G=!1}var H=c-b.left-b.right,I=d-b.top-b.bottom,J=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var K=v&&w&&x?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:j(a,b),y:k(a,b),size:l(a,b)}})}));g.domain(v||d3.extent(K.map(function(a){return a.x}).concat(n))).range([0,H]),h.domain(w||d3.extent(K.map(function(a){return a.y}).concat(o))).range([I,0]),i.domain(x||d3.extent(K.map(function(a){return a.size}).concat(p))).range(y||[16,256]);if(g.domain()[0]===g.domain()[1]||h.domain()[0]===h.domain()[1])z=!0;g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-g.domain()[0]*.01,g.domain()[1]+g.domain()[1]*.01]):g.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*.01,h.domain()[1]-h.domain()[1]*.01]):h.domain([-1,1])),C=C||g,D=D||h,E=E||i;var L=J.selectAll("g.nv-wrap.nv-scatter").data([a]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),O.append("g").attr("class","nv-point-paths"),L.attr("transform","translate("+b.left+","+b.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),L.select("#nv-edge-clip-"+f+" rect").attr("width",H).attr("height",I),P.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":""),G=!0;var R=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(R.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),R.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(R).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var S=R.selectAll("path.nv-point").data(function(a){return a.values});S.enter().append("path").attr("transform",function(a,b){return"translate("+C(j(a,b))+","+D(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),S.exit().remove(),d3.transition(R.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),S.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(S).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),clearTimeout(F),F=setTimeout(Q,1e3),C=g.copy(),D=h.copy(),E=i.copy()});return H}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e5),g=d3.scale.linear(),h=d3.scale.linear(),i=d3.scale.linear(),j=function(a){return a.x},k=function(a){return a.y},l=function(a){return a.size||1},m=function(a){return a.shape||"circle"},n=[],o=[],p=[],q=!0,r=function(a){return!a.notActive},s=!1,t=!0,u=function(){return 25},v=null,w=null,x=null,y=null,z=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),B=!0,C,D,E,F,G=!1;A.on("elementMouseover.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!1)}),H.dispatch=A,H.x=function(a){if(!arguments.length)return j;j=d3.functor(a);return H},H.y=function(a){if(!arguments.length)return k;k=d3.functor(a);return H},H.size=function(a){if(!arguments.length)return l;l=d3.functor(a);return H},H.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return H},H.width=function(a){if(!arguments.length)return c;c=a;return H},H.height=function(a){if(!arguments.length)return d;d=a;return H},H.xScale=function(a){if(!arguments.length)return g;g=a;return H},H.yScale=function(a){if(!arguments.length)return h;h=a;return H},H.zScale=function(a){if(!arguments.length)return i;i=a;return H},H.xDomain=function(a){if(!arguments.length)return v;v=a;return H},H.yDomain=function(a){if(!arguments.length)return w;w=a;return H},H.sizeDomain=function(a){if(!arguments.length)return x;x=a;return H},H.sizeRange=function(a){if(!arguments.length)return y;y=a;return H},H.forceX=function(a){if(!arguments.length)return n;n=a;return H},H.forceY=function(a){if(!arguments.length)return o;o=a;return H},H.forceSize=function(a){if(!arguments.length)return p;p=a;return H},H.interactive=function(a){if(!arguments.length)return q;q=a;return H},H.pointActive=function(a){if(!arguments.length)return r;r=a;return H},H.clipEdge=function(a){if(!arguments.length)return s;s=a;return H},H.clipVoronoi=function(a){if(!arguments.length)return t;t=a;return H},H.useVoronoi=function(a){if(!arguments.length)return B;B=a,B===!1&&(t=!1);return H},H.clipRadius=function(a){if(!arguments.length)return u;u=a;return H},H.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return H},H.shape=function(a){if(!arguments.length)return m;m=a;return H},H.id=function(a){if(!arguments.length)return f;f=a;return H},H.singlePoint=function(a){if(!arguments.length)return z;z=a;return H};return H},a.models.scatterChart=function(){function G(a){a.each(function(x){function Q(){if(v){N.select(".nv-point-paths").style("pointer-events","all");return!1}N.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(u).focus(a[0]),n.distortion(u).focus(a[1]),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d),N.select(".nv-distributionX").datum(x.filter(function(a){return!a.disabled})).call(g),N.select(".nv-distributionY").datum(x.filter(function(a){return!a.disabled})).call(h)}var y=d3.select(this),z=this,H=(j||parseInt(y.style("width"))||960)-i.left-i.right,I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom;G.update=function(){G(a)},G.container=this;if(!x||!x.length||!x.filter(function(a){return a.values.length}).length){var J=y.selectAll(".nv-noData").data([B]);J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",i.left+H/2).attr("y",i.top+I/2).text(function(a){return a});return G}y.selectAll(".nv-noData").remove(),C=C||m,D=D||n;var K=y.selectAll("g.nv-wrap.nv-scatterChart").data([x]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),M=L.append("g"),N=K.select("g");M.append("rect").attr("class","nvd3 nv-background"),M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis"),M.append("g").attr("class","nv-scatterWrap"),M.append("g").attr("class","nv-distWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),s&&(e.width(H/2),K.select(".nv-legendWrap").datum(x).call(e),i.top!=e.height()&&(i.top=e.height(),I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom),K.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -i.top+")")),t&&(f.width(180).color(["#444"]),N.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -i.top+")").call(f)),K.attr("transform","translate("+i.left+","+i.top+")"),b.width(H).height(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),K.select(".nv-scatterWrap").datum(x.filter(function(a){return!a.disabled})).call(b);if(o){var O=m.domain()[1]-m.domain()[0];m.domain([m.domain()[0]-o*O,m.domain()[1]+o*O])}if(p){var P=n.domain()[1]-n.domain()[0];n.domain([n.domain()[0]-p*P,n.domain()[1]+p*P])}c.scale(m).ticks(c.ticks()&&c.ticks().length?c.ticks():H/100).tickSize(-I,0),N.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():I/36).tickSize(-H,0),N.select(".nv-y.nv-axis").call(d),q&&(g.getData(b.x()).scale(m).width(H).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),N.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(x.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(b.y()).scale(n).width(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),N.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(x.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(N.select(".nv-background").attr("width",H).attr("height",I),N.select(".nv-background").on("mousemove",Q),N.select(".nv-background").on("click",function(){v=!v}),b.dispatch.on("elementClick.freezeFisheye",function(){v=!v})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,u=e.disabled?0:2.5,N.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),N.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(u).focus(0),n.distortion(u).focus(0),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d)):v=!1,G(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,x.filter(function(a){return!a.disabled}).length||x.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),G(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-I),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],A.tooltipShow(a)}),A.on("tooltipShow",function(a){w&&E(a,z.parentNode)}),C=m.copy(),D=n.copy()});return G}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=0,p=0,q=!1,r=!1,s=!0,t=!!d3.fisheye,u=0,v=!1,w=!0,x=function(a,b,c){return""+b+""},y=function(a,b,c){return""+c+""},z=null,A=d3.dispatch("tooltipShow","tooltipHide"),B="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var C,D,E=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));x!=null&&a.tooltip.show([j,k],x(e.series.key,p,q,e,G),"n",1,f,"x-nvtooltip"),y!=null&&a.tooltip.show([l,o],y(e.series.key,p,q,e,G),"e",1,f,"y-nvtooltip"),z!=null&&a.tooltip.show([g,h],z(e.series.key,p,q,e,G),e.value<0?"n":"s",null,f)},F=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),A.on("tooltipHide",function(){w&&a.tooltip.cleanup()}),G.dispatch=A,G.scatter=b,G.legend=e,G.controls=f,G.xAxis=c,G.yAxis=d,G.distX=g,G.distY=h,d3.rebind(G,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),G.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return G},G.width=function(a){if(!arguments.length)return j;j=a;return G},G.height=function(a){if(!arguments.length)return k;k=a;return G},G.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return G},G.showDistX=function(a){if(!arguments.length)return q;q=a;return G},G.showDistY=function(a){if(!arguments.length)return r;r=a;return G},G.showControls=function(a){if(!arguments.length)return t;t=a;return G},G.showLegend=function(a){if(!arguments.length)return s;s=a;return G},G.fisheye=function(a){if(!arguments.length)return u;u=a;return G},G.xPadding=function(a){if(!arguments.length)return o;o=a;return G},G.yPadding=function(a){if(!arguments.length)return p;p=a;return G},G.tooltips=function(a){if(!arguments.length)return w;w=a;return G},G.tooltipContent=function(a){if(!arguments.length)return z;z=a;return G},G.tooltipXContent=function(a){if(!arguments.length)return x;x=a;return G},G.tooltipYContent=function(a){if(!arguments.length)return y;y=a;return G},G.noData=function(a){if(!arguments.length)return B;B=a;return G};return G},a.models.scatterPlusLineChart=function(){function E(a){a.each(function(v){function O(){if(t){L.select(".nv-point-paths").style("pointer-events","all");return!1}L.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(s).focus(a[0]),n.distortion(s).focus(a[1]),L.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d),L.select(".nv-distributionX").datum(v.filter(function(a){return!a.disabled})).call(g),L.select(".nv-distributionY").datum(v.filter(function(a){return!a.disabled})).call(h)}var w=d3.select(this),x=this,F=(j||parseInt(w.style("width"))||960)-i.left-i.right,G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom;E.update=function(){E(a)},E.container=this;if(!v||!v.length||!v.filter(function(a){return a.values.length}).length){var H=w.selectAll(".nv-noData").data([z]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",i.left+F/2).attr("y",i.top+G/2).text(function(a){return a});return E}w.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale(),A=A||m,B=B||n;var I=w.selectAll("g.nv-wrap.nv-scatterChart").data([v]),J=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),K=J.append("g"),L=I.select("g");K.append("rect").attr("class","nvd3 nv-background"),K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-scatterWrap"),K.append("g").attr("class","nv-regressionLinesWrap"),K.append("g").attr("class","nv-distWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+i.left+","+i.top+")"),q&&(e.width(F/2),I.select(".nv-legendWrap").datum(v).call(e),i.top!=e.height()&&(i.top=e.height(),G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom),I.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -i.top+")")),r&&(f.width(180).color(["#444"]),L.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -i.top+")").call(f)),b.width(F).height(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),I.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var M=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a}),N=M.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);M.selectAll(".nv-regLines line").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(a,b){return n(m.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return n(m.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return l(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||typeof a.slope=="undefined"||typeof a.intercept=="undefined"?0:1}),c.scale(m).ticks(c.ticks()?c.ticks():F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()?d.ticks():G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").call(d),o&&(g.getData(b.x()).scale(m).width(F).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),L.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(v.filter(function(a){return!a.disabled})).call(g)),p&&(h.getData(b.y()).scale(n).width(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),L.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(v.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(L.select(".nv-background").attr("width",F).attr("height",G),L.select(".nv-background").on("mousemove",O),L.select(".nv-background").on("click",function(){t=!t}),b.dispatch.on("elementClick.freezeFisheye",function(){t=!t})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,s=e.disabled?0:2.5,L.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),L.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(s).focus(0),n.distortion(s).focus(0),L.select(".nv-scatterWrap").call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d)):t=!1,E(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,v.filter(function(a){return!a.disabled}).length||v.map(function(a){a.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1);return a}),E(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){u&&C(a,x.parentNode)}),A=m.copy(),B=n.copy()});return E}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=!1,p=!1,q=!0,r=!!d3.fisheye,s=0,t=!1,u=!0,v=function(a,b,c){return""+b+""},w=function(a,b,c){return""+c+""},x=function(a,b,c,d){return"

"+a+"

"+"

"+d+"

"},y=d3.dispatch("tooltipShow","tooltipHide"),z="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var A,B,C=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));v!=null&&a.tooltip.show([j,k],v(e.series.key,p,q,e,E),"n",1,f,"x-nvtooltip"),w!=null&&a.tooltip.show([l,o],w(e.series.key,p,q,e,E),"e",1,f,"y-nvtooltip"),x!=null&&a.tooltip.show([g,h],x(e.series.key,p,q,e.point.tooltip,e,E),e.value<0?"n":"s",null,f)},D=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),y.on("tooltipHide",function(){u&&a.tooltip.cleanup()}),E.dispatch=y,E.scatter=b,E.legend=e,E.controls=f,E.xAxis=c,E.yAxis=d,E.distX=g,E.distY=h,d3.rebind(E,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return E},E.width=function(a){if(!arguments.length)return j;j=a;return E},E.height=function(a){if(!arguments.length)return k;k=a;return E},E.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return E},E.showDistX=function(a){if(!arguments.length)return o;o=a;return E},E.showDistY=function(a){if(!arguments.length)return p;p=a;return E},E.showControls=function(a){if(!arguments.length)return r;r=a;return E},E.showLegend=function(a){if(!arguments.length)return q;q=a;return E},E.fisheye=function(a){if(!arguments.length)return s;s=a;return E},E.tooltips=function(a){if(!arguments.length)return u;u=a;return E},E.tooltipContent=function(a){if(!arguments.length)return x;x=a;return E},E.tooltipXContent=function(a){if(!arguments.length)return v;v=a;return E},E.tooltipYContent=function(a){if(!arguments.length)return w;w=a;return E},E.noData=function(a){if(!arguments.length)return z;z=a;return E};return E},a.models.sparkline=function(){function m(a){a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom,n=d3.select(this);f.domain(k||d3.extent(a,h)).range([0,e]),g.domain(l||d3.extent(a,i)).range([m,0]);var o=n.selectAll("g.nv-wrap.nv-sparkline").data([a]),p=o.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),q=p.append("g"),r=o.select("g");o.attr("transform","translate("+b.left+","+b.top+")");var s=o.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||j(a,b)}).attr("d",d3.svg.line().x(function(a,b){return f(h(a,b))}).y(function(a,b){return g(i(a,b))}));var t=o.selectAll("circle.nv-point").data(function(a){function c(b){if(b!=-1){var c=a[b];c.pointIndex=b;return c}return null}var b=a.map(function(a,b){return i(a,b)}),d=c(b.lastIndexOf(g.domain()[1])),e=c(b.indexOf(g.domain()[0])),f=c(b.length-1);return[e,d,f].filter(function(a){return a!=null +})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return f(h(a,a.pointIndex))}).attr("cy",function(a,b){return g(i(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return h(a,a.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":i(a,a.pointIndex)==g.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return m}var b={top:2,right:0,bottom:2,left:0},c=400,d=32,e=!0,f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=a.utils.getColor(["#000"]),k,l;m.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.x=function(a){if(!arguments.length)return h;h=d3.functor(a);return m},m.y=function(a){if(!arguments.length)return i;i=d3.functor(a);return m},m.xScale=function(a){if(!arguments.length)return f;f=a;return m},m.yScale=function(a){if(!arguments.length)return g;g=a;return m},m.xDomain=function(a){if(!arguments.length)return k;k=a;return m},m.yDomain=function(a){if(!arguments.length)return l;l=a;return m},m.animate=function(a){if(!arguments.length)return e;e=a;return m},m.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b);return m};return m},a.models.sparklinePlus=function(){function n(a){a.each(function(l){function D(){function d(a,c){var d=Math.abs(b.x()(a[0],0)-c),e=0;for(var f=0;f"+a+""+"

"+c+" on "+b+"

"},o,p,q=d3.format(",.2f"),r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left"),b.scatter.pointActive(function(a){return!!Math.round(b.y()(a)*100)});var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=n(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){m&&a.tooltip.cleanup()}),u.dispatch=s,u.stacked=b,u.legend=e,u.controls=f,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return getWidth;h=a;return u},u.height=function(a){if(!arguments.length)return getHeight;i=a;return u},u.color=function(c){if(!arguments.length)return j;j=a.utils.getColor(c),e.color(j),b.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return n;n=a;return u},u.tooltips=function(a){if(!arguments.length)return m;m=a;return u},u.tooltipContent=function(a){if(!arguments.length)return n;n=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u},d.setTickFormat=d.tickFormat,d.tickFormat=function(a){if(!arguments.length)return q;q=a;return d};return u}})() \ No newline at end of file diff --git a/src/models/cumulativeLineChart.js b/src/models/cumulativeLineChart.js index 6108bbf..5ee7700 100644 --- a/src/models/cumulativeLineChart.js +++ b/src/models/cumulativeLineChart.js @@ -256,6 +256,20 @@ nv.models.cumulativeLineChart = function() { wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + // Show error if series goes below 100% + var tempDisabled = data.filter(function(d) { return d.tempDisabled }); + + wrap.select('.tempDisabled').remove(); //clean-up and prevent duplicates + if (tempDisabled.length) { + wrap.append('text').attr('class', 'tempDisabled') + .attr('x', availableWidth / 2) + .attr('y', '-.71em') + .style('text-anchor', 'end') + .text(tempDisabled.map(function(d) { return d.key }).join(', ') + ' values cannot be calculated for this time period.'); + } + + + //------------------------------------------------------------ // Main Chart Component(s) @@ -273,12 +287,12 @@ nv.models.cumulativeLineChart = function() { .height(availableHeight) .color(data.map(function(d,i) { return d.color || color(d, i); - }).filter(function(d,i) { return !data[i].disabled })); + }).filter(function(d,i) { return !data[i].disabled && !data[i].tempDisabled })); var linesWrap = g.select('.nv-linesWrap') - .datum(data.filter(function(d) { return !d.disabled })) + .datum(data.filter(function(d) { return !d.disabled && !d.tempDisabled })); //d3.transition(linesWrap).call(lines); linesWrap.call(lines); @@ -505,16 +519,20 @@ nv.models.cumulativeLineChart = function() { return data.map(function(line, i) { var v = lines.y()(line.values[idx], idx); + //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue + if (v < -.95) { + //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100) + line.tempDisabled = true; + return line; + } + + line.tempDisabled = false; + line.values = line.values.map(function(point, pointIndex) { point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) }; return point; }) - /* - TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue - if (v < -.9) { - //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100) - } - */ + return line; }) } From 8b5c49281e66b3c36fdadd218ce3e6e245ca2978 Mon Sep 17 00:00:00 2001 From: Bob Monteverde Date: Wed, 14 Nov 2012 17:26:17 -0500 Subject: [PATCH 2/2] Issue #323 now acount for series that are temporarily disabld due to calcualtions being impossible to make --- nv.d3.js | 3 +++ nv.d3.min.js | 10 +++++----- src/models/cumulativeLineChart.js | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/nv.d3.js b/nv.d3.js index 76d5f46..1901b7c 100644 --- a/nv.d3.js +++ b/nv.d3.js @@ -1787,6 +1787,9 @@ nv.models.cumulativeLineChart = function() { .map(function(series,i) { var initialDomain = d3.extent(series.values, lines.y()); + //account for series being disabled when losing 95% or more + if (initialDomain[0] < -.95) initialDomain[0] = -.95; + return [ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0]) diff --git a/nv.d3.min.js b/nv.d3.min.js index 2b9d983..19c18e6 100644 --- a/nv.d3.min.js +++ b/nv.d3.min.js @@ -1,5 +1,5 @@ -(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(g=document.body.scrollWidth?m:m-16,l=window.innerHeight>=document.body.scrollHeight?l:l-16;var r=function(a){var b=q;do isNaN(a.offsetTop)||(b+=a.offsetTop);while(a=a.offsetParent);return b},s=function(a){var b=p;do isNaN(a.offsetLeft)||(b+=a.offsetLeft);while(a=a.offsetParent);return b};switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2;var t=s(h),u=r(h);to?b[0]+e:o-t+p),un+m&&(q=n+m-u+q-j);break;case"w":p=b[0]+e,q=b[1]-j/2,t+k>l&&(p=b[0]-k-e),un+m&&(q=n-j-5);break;case"n":p=b[0]-k/2-5,q=b[1]+e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),u+j>n+m&&(q=n+m-u+q-j);break;case"s":p=b[0]-k/2,q=b[1]-j-e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),n>u&&(q=n)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(b){if(!arguments.length)return a.utils.defaultColor();return Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);d||(d=c.length);return typeof a[g]!="undefined"?typeof a[g]=="function"?a[g]():a[g]:c[--d]}},a.utils.pjax=function(b,c){function d(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})}d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.models.axis=function(){function o(d){d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),r=q.append("g"),s=p.select("g");m!==null?a.ticks(m):(a.orient()=="top"||a.orient()=="bottom")&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();t==null&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);u.exit().remove();switch(a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)-12:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"end").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+12:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+n(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}u.text(function(a){return a}),g&&(a.orient()==="left"||a.orient()==="right")&&(s.selectAll("g").each(function(a,b){if(e(a)e.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),e.domain()[0]==e.domain()[1]&&e.domain()[0]==0&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1}));if(g&&(a.orient()==="top"||a.orient()==="bottom")){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a,b){if(e(a)B[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),n=e.copy()});return o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!0,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.ticks=function(a){if(!arguments.length)return m;m=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.axisLabel=function(a){if(!arguments.length)return f;f=a;return o},o.showMaxMin=function(a){if(!arguments.length)return g;g=a;return o},o.highlightZero=function(a){if(!arguments.length)return h;h=a;return o},o.scale=function(b){if(!arguments.length)return e;e=b,a.scale(e),l=typeof e.rangeBands=="function",d3.rebind(o,e,"domain","range","rangeBand","rangeBands");return o},o.rotateYLabel=function(a){if(!arguments.length)return j;j=a;return o},o.rotateLabels=function(a){if(!arguments.length)return i;i=a;return o},o.staggerLabels=function(a){if(!arguments.length)return k;k=a;return o};return o},a.models.historicalBar=function(){function q(a){a.each(function(a){var q=c-b.left-b.right,r=d-b.top-b.bottom,s=d3.select(this);f.domain(n||d3.extent(a[0].values.map(h).concat(j))).range([0,q]),g.domain(o||d3.extent(a[0].values.map(i).concat(k))).range([r,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var t=s.selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-bars"),t.attr("transform","translate("+b.left+","+b.top+")"),s.on("click",function(a,b){p.chartClick({data:a,index:b,pos:d3.event,id:e})}),v.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",r),z.attr("clip-path",l?"url(#nv-chart-clip-path-"+e+")":"");var A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("x",0).attr("y",function(a,b){return g(Math.max(0,i(a,b)))}).attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("fill",function(a,b){return m(a,b)}).attr("class",function(a,b,c){return(i(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(f(h(b,c))-q/a[0].values.length*.5)+",0)"}).attr("width",q/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)})});return q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[],k=[0],l=!0,m=a.utils.defaultColor(),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");q.dispatch=p,q.x=function(a){if(!arguments.length)return h;h=a;return q},q.y=function(a){if(!arguments.length)return i;i=a;return q},q.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return q},q.width=function(a){if(!arguments.length)return c;c=a;return q},q.height=function(a){if(!arguments.length)return d;d=a;return q},q.xScale=function(a){if(!arguments.length)return f;f=a;return q},q.yScale=function(a){if(!arguments.length)return g;g=a;return q},q.xDomain=function(a){if(!arguments.length)return n;n=a;return q},q.yDomain=function(a){if(!arguments.length)return o;o=a;return q},q.forceX=function(a){if(!arguments.length)return j;j=a;return q},q.forceY=function(a){if(!arguments.length)return k;k=a;return q},q.clipEdge=function(a){if(!arguments.length)return l;l=a;return q},q.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return q},q.id=function(a){if(!arguments.length)return e;e=a;return q};return q},a.models.bullet=function(){function n(a){a.each(function(a,c){var h=i-b.left-b.right,k=j-b.top-b.bottom,n=d3.select(this),o=e.call(this,a,c).slice().sort(d3.descending),p=f.call(this,a,c).slice().sort(d3.descending),q=g.call(this,a,c).slice().sort(d3.descending),r=d3.scale.linear().domain([0,Math.max(o[0],p[0],q[0])]).range(d?[h,0]:[0,h]),s=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(r.range());this.__chart__=r;var t=n.selectAll("g.nv-wrap.nv-bullet").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),v=u.append("g"),w=t.select("g");t.attr("transform","translate("+b.left+","+b.top+")");var x=function(a){return Math.abs(s(a)-s(0))},y=function(a){return Math.abs(r(a)-r(0))},z=w.selectAll("rect.nv-range").data(o);z.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",x).attr("height",k).attr("x",d?s:0).on("mouseover",function(a,b){m.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(z).attr("x",d?r:0).attr("width",y).attr("height",k);var A=w.selectAll("rect.nv-measure").data(q);A.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).style("fill",function(a,b){return l(a,b)}).attr("width",x).attr("height",k/3).attr("x",d?s:0).attr("y",k/3).on("mouseover",function(a){m.elementMouseover({value:a,label:"Current",pos:[r(a),k/2]})}).on("mouseout",function(a){m.elementMouseout({value:a,label:"Current"})}),d3.transition(A).attr("width",y).attr("height",k/3).attr("x",d?r:0).attr("y",k/3);var B=w.selectAll("path.nv-markerTriangle").data(p),C=k/6;B.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+s(a)+","+k/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(a,b){m.elementMouseover({value:a,label:"Previous",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:"Previous"})}),d3.transition(B).attr("transform",function(a){return"translate("+r(a)+","+k/2+")"}),B.exit().remove()}),d3.timer.flush();return n}var b={top:0,right:0,bottom:0,left:0},c="left",d=!1,e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=[0],i=380,j=30,k=null,l=a.utils.getColor(["#1f77b4"]),m=d3.dispatch("elementMouseover","elementMouseout");n.dispatch=m,n.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return n},n.ranges=function(a){if(!arguments.length)return e;e=a;return n},n.markers=function(a){if(!arguments.length)return f;f=a;return n},n.measures=function(a){if(!arguments.length)return g;g=a;return n},n.forceX=function(a){if(!arguments.length)return h;h=a;return n},n.width=function(a){if(!arguments.length)return i;i=a;return n},n.height=function(a){if(!arguments.length)return j;j=a;return n},n.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return n},n.tickFormat=function(a){if(!arguments.length)return k;k=a;return n},n.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b);return n};return n},a.models.bulletChart=function(){function q(a){a.each(function(c,m){var r=d3.select(this),s=(i||parseInt(r.style("width"))||960)-e.left-e.right,t=j-e.top-e.bottom,u=this;q.update=function(){q(a)},q.container=this;if(!c||!f.call(this,c,m)){var v=r.selectAll(".nv-noData").data([n]);v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",e.left+s/2).attr("y",18+e.top+t/2).text(function(a){return a});return q}r.selectAll(".nv-noData").remove();var w=f.call(this,c,m).slice().sort(d3.descending),x=g.call(this,c,m).slice().sort(d3.descending),y=h.call(this,c,m).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([c]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+e.left+","+e.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(d?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(D.range());this.__chart__=D;var F=function(a){return Math.abs(E(a)-E(0))},G=function(a){return Math.abs(D(a)-D(0))},H=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(j-e.top-e.bottom)/2+")");H.append("text").attr("class","nv-title").text(function(a){return a.title}),H.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var I=C.select(".nv-bulletWrap");d3.transition(I).call(b);var J=k||D.tickFormat(s/100),K=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||J(a)}),L=K.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",t).attr("y2",t*7/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",t*7/6).text(J);var M=d3.transition(K).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);M.select("line").attr("y1",t).attr("y2",t*7/6),M.select("text").attr("y",t*7/6),d3.transition(K.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),o.on("tooltipShow",function(a){a.key=data[0].title,l&&p(a,u.parentNode)})}),d3.timer.flush();return q}var b=a.models.bullet(),c="left",d=!1,e={top:5,right:40,bottom:20,left:120},f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=null,j=55,k=null,l=!0,m=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0)+e.left,f=b.pos[1]+(c.offsetTop||0)+e.top,g=m(b.key,b.label,b.value,b,q);a.tooltip.show([d,f],g,b.value<0?"e":"w",null,c)};b.dispatch.on("elementMouseover.tooltip",function(a){o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),q.dispatch=o,q.bullet=b,d3.rebind(q,b,"color"),q.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return q},q.ranges=function(a){if(!arguments.length)return f;f=a;return q},q.markers=function(a){if(!arguments.length)return g;g=a;return q},q.measures=function(a){if(!arguments.length)return h;h=a;return q},q.width=function(a){if(!arguments.length)return i;i=a;return q},q.height=function(a){if(!arguments.length)return j;j=a;return q},q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.tickFormat=function(a){if(!arguments.length)return k;k=a;return q},q.tooltips=function(a){if(!arguments.length)return l;l=a;return q},q.tooltipContent=function(a){if(!arguments.length)return m;m=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.cumulativeLineChart=function(){function y(a,c){return c.map(function(c,d){var e=b.y()(c.values[a],a);if(e<-0.95){c.tempDisabled=!0;return c}c.tempDisabled=!1,c.values=c.values.map(function(a,c){a.display={y:(b.y()(a,c)-e)/(1+e)};return a});return c})}function x(a){a.each(function(o){function R(){Q.data([v]),x.update()}function G(a,b){d3.select(x.container).style("cursor","auto")}function F(a,b){v.x=d3.event.x,v.i=Math.round(u.invert(v.x)),R()}function E(a,b){d3.select(x.container).style("cursor","ew-resize")}var z=d3.select(this).classed("nv-chart-"+r,!0),A=this,B=(i||parseInt(z.style("width"))||960)-g.left-g.right,C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom;x.update=function(){x(a)},x.container=this;var D=d3.behavior.drag().on("dragstart",E).on("drag",F).on("dragend",G);if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){var H=z.selectAll(".nv-noData").data([s]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",g.left+B/2).attr("y",g.top+C/2).text(function(a){return a});return x}z.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();if(!n){var I=o.filter(function(a){return!a.disabled}).map(function(a,c){var d=d3.extent(a.values,b.y());return[(d[0]-d[1])/(1+d[1]),(d[1]-d[0])/(1+d[0])]}),J=[d3.min(I,function(a){return a[0]}),d3.max(I,function(a){return a[1]})];b.yDomain(J)}else b.yDomain(null);u.domain([0,o[0].values.length-1]).range([0,B]).clamp(!0);var o=y(v.i,o),K=z.selectAll("g.nv-wrap.nv-cumulativeLine").data([o]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),M=K.select("g");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-background"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-legendWrap"),L.append("g").attr("class","nv-controlsWrap"),k&&(e.width(B),M.select(".nv-legendWrap").datum(o).call(e),g.top!=e.height()&&(g.top=e.height(),C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -g.top+")"));if(m){var N=[{key:"Re-scale y-axis",disabled:!n}];f.width(140).color(["#444","#444","#444"]),M.select(".nv-controlsWrap").datum(N).attr("transform","translate(0,"+ -g.top+")").call(f)}K.attr("transform","translate("+g.left+","+g.top+")");var O=o.filter(function(a){return a.tempDisabled});K.select(".tempDisabled").remove(),O.length&&K.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(O.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),L.select(".nv-background").append("rect"),M.select(".nv-background rect").attr("width",B).attr("height",C),b.y(function(a){return a.display.y}).width(B).height(C).color(o.map(function(a,b){return a.color||h(a,b)}).filter(function(a,b){return!o[b].disabled&&!o[b].tempDisabled}));var P=M.select(".nv-linesWrap").datum(o.filter(function(a){return!a.disabled&&!a.tempDisabled}));P.call(b);var Q=P.selectAll(".nv-indexLine").data([v]);Q.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(D),Q.attr("transform",function(a){return"translate("+u(a.i)+",0)"}).attr("height",C),c.scale(p).tickSubdivide(o[0].values.length>d3.select("body").select("svg").select(".nv-x").selectAll(".tick")[0].length?!0:!1).ticks(Math.min(o[0].values.length,B/70)).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(M.select(".nv-x.nv-axis")).call(c),d.scale(q).ticks(C/36).tickSize(-B,0),d3.transition(M.select(".nv-y.nv-axis")).call(d),M.select(".nv-background rect").on("click",function(){v.x=d3.mouse(this)[0],v.i=Math.round(u.invert(v.x)),R()}),b.dispatch.on("elementClick",function(a){v.i=a.pointIndex,v.x=u(v.i),R()}),f.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,n=!b.disabled,a.call(x)}),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),a.call(x)}),t.on("tooltipShow",function(a){l&&w(a,A.parentNode)})});return x}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:30,bottom:50,left:60},h=a.utils.defaultColor(),i=null,j=null,k=!0,l=!0,m=!0,n=!0,o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p,q,r=b.id(),s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var u=d3.scale.linear(),v={i:0,x:0},w=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,x);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),x.dispatch=t,x.lines=b,x.legend=e,x.xAxis=c,x.yAxis=d,d3.rebind(x,b,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),x.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return x},x.width=function(a){if(!arguments.length)return i;i=a;return x},x.height=function(a){if(!arguments.length)return j;j=a;return x},x.color=function(b){if(!arguments.length)return h;h=a.utils.getColor(b),e.color(h);return x},x.showControls=function(a){if(!arguments.length)return m;m=a;return x},x.showLegend=function(a){if(!arguments.length)return k;k=a;return x},x.tooltips=function(a){if(!arguments.length)return l;l=a;return x},x.tooltipContent=function(a){if(!arguments.length)return o;o=a;return x},x.noData=function(a){if(!arguments.length)return s;s=a;return x};return x},a.models.discreteBar=function(){function t(a){a.each(function(a){var e=c-b.left-b.right,t=d-b.top-b.bottom,u=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var v=n&&o?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(n||d3.merge(v).map(function(a){return a.x})).rangeBands([0,e],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([t-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([t,0]),r=r||f,s=s||g.copy().range([g(0),g(0)]);var w=u.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g"),B=w.select("g");A.append("g").attr("class","nv-groups"),w.attr("transform","translate("+b.left+","+b.top+")");var C=w.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(C.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),C.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.75);var D=C.selectAll("g.nv-bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+(f(h(a,b))+f.rangeBand()*.05)+", "+g(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){p.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){p.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()*.9/a.length),l?(E.append("text").attr("text-anchor","middle"),D.select("text").attr("x",f.rangeBand()*.9/2).attr("y",function(a,b){return i(a,b)<0?g(i(a,b))-g(0)+12:-4}).text(function(a,b){return m(i(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}).select("rect").attr("class",q).attr("width",f.rangeBand()*.9/a.length),d3.transition(D).attr("transform",function(a,b){var c=f(h(a,b))+f.rangeBand()*.05,d=i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0))||1)}),r=f.copy(),s=g.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=d3.format(",.2f"),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q="discreteBar",r,s;t.dispatch=p,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return f;f=a;return t},t.yScale=function(a){if(!arguments.length)return g;g=a;return t},t.xDomain=function(a){if(!arguments.length)return n;n=a;return t},t.yDomain= -function(a){if(!arguments.length)return o;o=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return e;e=a;return t},t.showValues=function(a){if(!arguments.length)return l;l=a;return t},t.valueFormat=function(a){if(!arguments.length)return m;m=a;return t},t.rectClass=function(a){if(!arguments.length)return q;q=a;return t};return t},a.models.discreteBarChart=function(){function q(a){a.each(function(h){var k=d3.select(this),r=this,s=(f||parseInt(k.style("width"))||960)-e.left-e.right,t=(g||parseInt(k.style("height"))||400)-e.top-e.bottom;q.update=function(){a.transition().call(q)},q.container=this;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){var u=k.selectAll(".nv-noData").data([n]);u.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),u.attr("x",e.left+s/2).attr("y",e.top+t/2).text(function(a){return a});return q}k.selectAll(".nv-noData").remove(),l=b.xScale(),m=b.yScale();var v=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),z=w.append("defs"),A=v.select("g");w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis"),w.append("g").attr("class","nv-barsWrap"),A.attr("transform","translate("+e.left+","+e.top+")"),b.width(s).height(t);var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(b),z.append("clipPath").attr("id","nv-x-label-clip-"+b.id()).append("rect"),A.select("#nv-x-label-clip-"+b.id()+" rect").attr("width",l.rangeBand()*(i?2:1)).attr("height",16).attr("x",-l.rangeBand()/(i?1:2)),c.scale(l).ticks(s/100).tickSize(-t,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+(b.showValues()&&m.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(c);var C=A.select(".nv-x.nv-axis").selectAll("g");i?C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"}):C.selectAll("text").attr("transform","translate(0,5)"),d.scale(m).ticks(t/36).tickSize(-s,0),d3.transition(A.select(".nv-y.nv-axis")).call(d),o.on("tooltipShow",function(a){j&&p(a,r.parentNode)})});return q}var b=a.models.discreteBar(),c=a.models.axis(),d=a.models.axis(),e={top:15,right:10,bottom:50,left:60},f=null,g=null,h=a.utils.getColor(),i=!1,j=!0,k=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},l,m,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var p=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),l=k(e.series.key,i,j,e,q);a.tooltip.show([g,h],l,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),q.dispatch=o,q.discretebar=b,q.xAxis=c,q.yAxis=d,d3.rebind(q,b,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.width=function(a){if(!arguments.length)return f;f=a;return q},q.height=function(a){if(!arguments.length)return g;g=a;return q},q.color=function(c){if(!arguments.length)return h;h=a.utils.getColor(c),b.color(h);return q},q.staggerLabels=function(a){if(!arguments.length)return i;i=a;return q},q.tooltips=function(a){if(!arguments.length)return j;j=a;return q},q.tooltipContent=function(a){if(!arguments.length)return k;k=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.distribution=function(){function k(a){a.each(function(a){var i=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x",l=d3.select(this);j=j||h;var m=l.selectAll("g.nv-distribution").data([a]),n=m.enter().append("g").attr("class","nvd3 nv-distribution"),o=n.append("g"),p=m.select("g");m.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var r=q.selectAll("line.nv-dist"+e).data(function(a){return a.values});r.enter().append("line").attr(e+"1",function(a,b){return j(f(a,b))}).attr(e+"2",function(a,b){return j(f(a,b))}),d3.transition(q.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(r).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}),j=h.copy()});return k}var b={top:0,right:0,bottom:0,left:0},c=400,d=8,e="x",f=function(a){return a[e]},g=a.utils.defaultColor(),h=d3.scale.linear(),i,j;k.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return k},k.width=function(a){if(!arguments.length)return c;c=a;return k},k.axis=function(a){if(!arguments.length)return e;e=a;return k},k.size=function(a){if(!arguments.length)return d;d=a;return k},k.getData=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.scale=function(a){if(!arguments.length)return h;h=a;return k},k.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b);return k};return k},a.models.indentedTree=function(){function o(a){a.each(function(b){function C(a){var b=a.values||a._values;return b&&b.length}function B(a){return a._values&&a._values.length}function A(a){return a._values&&a._values.length?l:a.values&&a.values.length?m:""}function z(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c){d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&z(a,0,!0)});return!0}if(!C(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),o.update()}var c=0,e=1,f=d3.layout.tree().children(function(a){return a.values}).size([d,i]);o.update=function(){a.transition().call(o)},o.container=this,b[0]||(b[0]={key:h});var p=f.nodes(b[0]),q=d3.select(this).selectAll("div").data([[p]]),r=q.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),s=r.append("table"),t=q.select("table").attr("width","100%").attr("class",k);if(g){var u=s.append("thead"),v=u.append("tr");j.forEach(function(a){v.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var w=t.selectAll("tbody").data(function(a){return a});w.enter().append("tbody"),e=d3.max(p,function(a){return a.depth}),f.size([d,e*i]);var x=w.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++c});x.exit().remove(),x.select("img.nv-treeicon").attr("src",A).classed("folded",B);var y=x.enter().append("tr");j.forEach(function(a,b){var c=y.append("td").style("padding-left",function(a){return(b?0:a.depth*i+12+(A(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("nv-treeicon",!0).classed("nv-folded",B).attr("src",A).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return A(a)?"inline-block":"none"}).on("click",z),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),x.order().on("click",function(a){n.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){n.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){n.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){n.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})});return o}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=!0,h="No Data Available.",i=20,j=[{key:"key",label:"Name",type:"text"}],k=null,l="images/grey-plus.png",m="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),scatter.color(e);return o},o.id=function(a){if(!arguments.length)return f;f=a;return o},o.header=function(a){if(!arguments.length)return g;g=a;return o},o.noData=function(a){if(!arguments.length)return h;h=a;return o},o.columns=function(a){if(!arguments.length)return j;j=a;return o},o.tableClass=function(a){if(!arguments.length)return k;k=a;return o},o.iconOpen=function(a){if(!arguments.length)return l;l=a;return o},o.iconClose=function(a){if(!arguments.length)return m;m=a;return o};return o},a.models.legend=function(){function i(a){a.each(function(a){var i=c-b.left-b.right,j=d3.select(this),l=j.selectAll("g.nv-legend").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),n=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var o=n.selectAll(".nv-series").data(function(a){return a}),p=o.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){h.legendMouseover(a,b)}).on("mouseout",function(a,b){h.legendMouseout(a,b)}).on("click",function(a,b){h.legendClick(a,b)}).on("dblclick",function(a,b){h.legendDblclick(a,b)});p.append("circle").style("stroke-width",2).attr("r",5),p.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),o.classed("disabled",function(a){return a.disabled}),o.exit().remove(),o.select("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}),o.select("text").text(e);if(g){var q=[];o.each(function(a,b){q.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var r=0,s=0,t=[];while(si&&r>1){t=[],r--;for(k=0;k(t[k%r]||0)&&(t[k%r]=q[k]);s=t.reduce(function(a,b,c,d){return a+b})}var u=[];for(var v=0,w=0;vz&&(z=y);return"translate("+A+","+x+")"}),n.attr("transform","translate("+(c-b.right-z)+","+b.top+")"),d=b.top+b.bottom+x+15}});return i}var b={top:5,right:0,bottom:5,left:0},c=400,d=20,e=function(a){return a.key},f=a.utils.defaultColor(),g=!0,h=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");i.dispatch=h,i.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return i},i.width=function(a){if(!arguments.length)return c;c=a;return i},i.height=function(a){if(!arguments.length)return d;d=a;return i},i.key=function(a){if(!arguments.length)return e;e=a;return i},i.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b);return i},i.align=function(a){if(!arguments.length)return g;g=a;return i};return i},a.models.line=function(){function q(a){a.each(function(a){var q=d-c.left-c.right,r=e-c.top-c.bottom,s=d3.select(this);l=b.xScale(),m=b.yScale(),o=o||l,p=p||m;var t=s.selectAll("g.nv-wrap.nv-line").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-groups"),w.append("g").attr("class","nv-scatterWrap"),t.attr("transform","translate("+c.left+","+c.top+")"),b.width(q).height(r);var A=t.select(".nv-scatterWrap");d3.transition(A).call(b),v.append("clipPath").attr("id","nv-edge-clip-"+b.id()).append("rect"),t.select("#nv-edge-clip-"+b.id()+" rect").attr("width",q).attr("height",r),z.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":""),A.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":"");var B=t.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return f(a,b)}).style("stroke",function(a,b){return f(a,b)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.5);var C=B.selectAll("path.nv-area").data(function(a){return j(a)?[a]:[]});C.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(B.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var D=B.selectAll("path.nv-line").data(function(a){return[a.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y(function(a,b){return p(h(a,b))})),d3.transition(B.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),d3.transition(D).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),o=l.copy(),p=m.copy()});return q}var b=a.models.scatter(),c={top:0,right:0,bottom:0,left:0},d=960,e=500,f=a.utils.defaultColor(),g=function(a){return a.x},h=function(a){return a.y},i=function(a,b){return!isNaN(h(a,b))&&h(a,b)!==null},j=function(a){return a.area},k=!1,l,m,n="linear";b.size(16).sizeDomain([16,256]);var o,p;q.dispatch=b.dispatch,q.scatter=b,d3.rebind(q,b,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){if(!arguments.length)return c;c.top=typeof a.top!="undefined"?a.top:c.top,c.right=typeof a.right!="undefined"?a.right:c.right,c.bottom=typeof a.bottom!="undefined"?a.bottom:c.bottom,c.left=typeof a.left!="undefined"?a.left:c.left;return q},q.width=function(a){if(!arguments.length)return d;d=a;return q},q.height=function(a){if(!arguments.length)return e;e=a;return q},q.x=function(a){if(!arguments.length)return g;g=a,b.x(a);return q},q.y=function(a){if(!arguments.length)return h;h=a,b.y(a);return q},q.clipEdge=function(a){if(!arguments.length)return k;k=a;return q},q.color=function(c){if(!arguments.length)return f;f=a.utils.getColor(c),b.color(f);return q},q.interpolate=function(a){if(!arguments.length)return n;n=a;return q},q.defined=function(a){if(!arguments.length)return i;i=a;return q},q.isArea=function(a){if(!arguments.length)return j;j=d3.functor(a);return q};return q},a.models.lineChart=function(){function r(a){a.each(function(l){var s=d3.select(this),t=this,u=(h||parseInt(s.style("width"))||960)-f.left-f.right,v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom;r.update=function(){r(a)},r.container=this;if(!l||!l.length||!l.filter(function(a){return a.values.length}).length){var w=s.selectAll(".nv-noData").data([o]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",f.left+u/2).attr("y",f.top+v/2).text(function(a){return a});return r}s.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale();var z=s.selectAll("g.nv-wrap.nv-lineChart").data([l]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),B=z.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-linesWrap"),A.append("g").attr("class","nv-legendWrap"),j&&(e.width(u),B.select(".nv-legendWrap").datum(l).call(e),f.top!=e.height()&&(f.top=e.height(),v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom),z.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),z.attr("transform","translate("+f.left+","+f.top+")"),b.width(u).height(v).color(l.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!l[b].disabled}));var C=B.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled}));d3.transition(C).call(b),c.scale(m).ticks(u/100).tickSize(-v,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(B.select(".nv-x.nv-axis")).call(c),d.scale(n).ticks(v/36).tickSize(-u,0),d3.transition(B.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l.filter(function(a){return!a.disabled}).length||l.map(function(a){a.disabled=!1,z.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(r)}),p.on("tooltipShow",function(a){k&&q(a,t.parentNode)})});return r}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f={top:30,right:20,bottom:50,left:60},g=a.utils.defaultColor(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},m,n,o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var q=function(e,f){if(f){var g=d3.select(f).select("svg"),h=g.attr("viewBox");if(h){h=h.split(" ");var i=parseInt(g.style("width"))/h[2];e.pos[0]=e.pos[0]*i,e.pos[1]=e.pos[1]*i}}var j=e.pos[0]+(f.offsetLeft||0),k=e.pos[1]+(f.offsetTop||0),m=c.tickFormat()(b.x()(e.point,e.pointIndex)),n=d.tickFormat()(b.y()(e.point,e.pointIndex)),o=l(e.series.key,m,n,e,r);a.tooltip.show([j,k],o,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){k&&a.tooltip.cleanup()}),r.dispatch=p,r.lines=b,r.legend=e,r.xAxis=c,r.yAxis=d,d3.rebind(r,b,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){if(!arguments.length)return f;f.top=typeof a.top!="undefined"?a.top:f.top,f.right=typeof a.right!="undefined"?a.right:f.right,f.bottom=typeof a.bottom!="undefined"?a.bottom:f.bottom,f.left=typeof a.left!="undefined"?a.left:f.left;return r},r.width=function(a){if(!arguments.length)return h;h=a;return r},r.height=function(a){if(!arguments.length)return i;i=a;return r},r.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b),e.color(g);return r},r.showLegend=function(a){if(!arguments.length)return j;j=a;return r},r.tooltips=function(a){if(!arguments.length)return k;k=a;return r},r.tooltipContent=function(a){if(!arguments.length)return l;l=a;return r},r.noData=function(a){if(!arguments.length)return o;o=a;return r};return r},a.models.linePlusBarChart=function(){function w(a){a.each(function(k){var l=d3.select(this),p=this,y=(i||parseInt(l.style("width"))||960)-h.left-h.right,z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom;w.update=function(){w(a)},w.container=this;if(!k||!k.length||!k.filter(function(a){return a.values.length}).length){var A=l.selectAll(".nv-noData").data([t]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",h.left+y/2).attr("y",h.top+z/2).text(function(a){return a});return w}l.selectAll(".nv-noData").remove(),q=b.xScale(),r=c.yScale(),s=b.yScale();var B=k.filter(function(a){return!a.disabled&&a.bar}),C=k.filter(function(a){return!a.bar}),D=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([k]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y1 nv-axis"),E.append("g").attr("class","nv-y2 nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-linesWrap"),E.append("g").attr("class","nv-legendWrap"),n&&(g.width(y/2),F.select(".nv-legendWrap").datum(k.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)");return a})).call(g),h.top!=g.height()&&(h.top=g.height(),z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom),F.select(".nv-legendWrap").attr("transform","translate("+y/2+","+ -h.top+")")),D.attr("transform","translate("+h.left+","+h.top+")"),b.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&!k[b].bar})),c.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&k[b].bar}));var G=F.select(".nv-barsWrap").datum(B.length?B:[{values:[]}]),H=F.select(".nv-linesWrap").datum(C[0].disabled?[{values:[]}]:C);d3.transition(G).call(c),d3.transition(H).call(b),d.scale(q).ticks(y/100).tickSize(-z,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(d),e.scale(r).ticks(z/36).tickSize(-y,0),d3.transition(F.select(".nv-y1.nv-axis")).style("opacity",B.length?1:0).call(e),f.scale(s).ticks(z/36).tickSize(B.length?0:-y,0),F.select(".nv-y2.nv-axis").style("opacity",C.length?1:0).attr("transform","translate("+q.range()[1]+",0)"),d3.transition(F.select(".nv-y2.nv-axis")).call(f),g.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(w)}),u.on("tooltipShow",function(a){o&&v(a,p.parentNode)})});return w}var b=a.models.line(),c=a.models.historicalBar(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.legend(),h={top:30,right:60,bottom:50,left:60},i=null,j=null,k=function(a){return a.x},l=function(a){return a.y},m=a.utils.defaultColor(),n=!0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},q,r,s,t="No Data Available.",u=d3.dispatch("tooltipShow","tooltipHide");b.clipEdge(!1),d.orient("bottom").tickPadding(7),e.orient("left"),f.orient("right");var v=function(c,g){var h=c.pos[0]+(g.offsetLeft||0),i=c.pos[1]+(g.offsetTop||0),j=d.tickFormat()(b.x()(c.point,c.pointIndex)),k=(c.series.bar?e:f).tickFormat()(b.y()(c.point,c.pointIndex)),l=p(c.series.key,j,k,c,w);a.tooltip.show([h,i],l,c.value<0?"n":"s",null,g)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),c.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),c.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),w.dispatch=u,w.legend=g,w.lines=b,w.bars=c,w.xAxis=d,w.y1Axis=e,w.y2Axis=f,d3.rebind(w,b,"defined","size","clipVoronoi","interpolate"),w.x=function(a){if(!arguments.length)return k;k=a,b.x(a),c.x(a);return w},w.y=function(a){if(!arguments.length)return l;l=a,b.y(a),c.y(a);return w},w.margin=function(a){if(!arguments.length)return h;h.top=typeof a.top!="undefined"?a.top:h.top,h.right=typeof a.right!="undefined"?a.right:h.right,h.bottom=typeof a.bottom!="undefined"?a.bottom:h.bottom,h.left=typeof a.left!="undefined"?a.left:h.left;return w},w.width=function(a){if(!arguments.length)return i;i=a;return w},w.height=function(a){if(!arguments.length)return j;j=a;return w},w.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b),g.color(m);return w},w.showLegend=function(a){if(!arguments.length)return n;n=a;return w},w.tooltips=function(a){if(!arguments.length)return o;o=a;return w},w.tooltipContent=function(a){if(!arguments.length)return p;p=a;return w},w.noData=function(a){if(!arguments.length)return t;t=a;return w};return w},a.models.lineWithFocusChart=function(){function A(a){a.each(function(w){function R(){u=i.empty()?null:i.extent(),extent=i.empty()?r.domain():i.extent(),y.brush({extent:extent,brush:i}),Q();var a=J.select(".nv-focus .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}).map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return b.x()(a,c)>=extent[0]&&b.x()(a,c)<=extent[1]})}}));d3.transition(a).call(b),d3.transition(J.select(".nv-focus .nv-x.nv-axis")).call(d),d3.transition(J.select(".nv-focus .nv-y.nv-axis")).call(e)}function Q(){i.empty()||i.extent(u),N.data([i.empty()?r.domain():u]).each(function(a,b){var c=r(a[0])-p.range()[0],d=p.range()[1]-r(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",r(a[1])).attr("width",d<0?0:d)})}function P(a){var b=+(a=="e"),c=b?1:-1,d=F/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}var B=d3.select(this),C=this,D=(m||parseInt(B.style("width"))||960)-j.left-j.right,E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o,F=o-k.top-k.bottom;A.update=function(){A(a)},A.container=this;if(!w||!w.length||!w.filter(function(a){return a.values.length}).length){var G=B.selectAll(".nv-noData").data([x]);G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),G.attr("x",j.left+D/2).attr("y",j.top+E/2).text(function(a){return a});return A}B.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale(),r=c.xScale(),s=c.yScale();var H=B.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([w]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),J=H.select("g");I.append("g").attr("class","nv-legendWrap");var K=I.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-linesWrap");var L=I.append("g").attr("class","nv-context");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-brushBackground"),L.append("g").attr("class","nv-x nv-brush"),t&&(h.width(D),J.select(".nv-legendWrap").datum(w).call(h),j.top!=h.height()&&(j.top=h.height(),E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -j.top+")")),H.attr("transform","translate("+j.left+","+j.top+")"),b.width(D).height(E).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),c.defined(b.defined()).width(D).height(F).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),J.select(".nv-context").attr("transform","translate(0,"+(E+j.bottom+k.top)+")");var M=J.select(".nv-context .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}));d3.transition(M).call(c),d.scale(p).ticks(D/100).tickSize(-E,0),e.scale(q).ticks(E/36).tickSize(-D,0),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+E+")"),i.x(r).on("brush",R),u&&i.extent(u);var N=J.select(".nv-brushBackground").selectAll("g").data([u||i.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=J.select(".nv-x.nv-brush").call(i),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",P),R(),f.scale(r).ticks(D/100).tickSize(-F,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(f),g.scale(s).ticks(F/36).tickSize(-D,0),d3.transition(J.select(".nv-context .nv-y.nv-axis")).call(g),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),h.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w.filter(function(a){return!a.disabled}).length||w.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(A)}),y.on("tooltipShow",function(a){v&&z(a,C.parentNode)})});return A}var b=a.models.line(),c=a.models.line(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=d3.svg.brush(),j={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},l=a.utils.defaultColor(),m=null,n=null,o=100,p,q,r,s,t=!0,u=null,v=!0,w=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},x="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide","brush");b.clipEdge(!0),c.interactive(!1),d.orient("bottom").tickPadding(5),e.orient("left"),f.orient("bottom").tickPadding(5),g.orient("left");var z=function(c,f){var g=c.pos[0]+(f.offsetLeft||0),h=c.pos[1]+(f.offsetTop||0),i=d.tickFormat()(b.x()(c.point,c.pointIndex)),j=e.tickFormat()(b.y()(c.point,c.pointIndex)),k=w(c.series.key,i,j,c,A);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],y.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){v&&a.tooltip.cleanup()}),A.dispatch=y,A.legend=h,A.lines=b,A.lines2=c,A.xAxis=d,A.yAxis=e,A.x2Axis=f,A.y2Axis=g,d3.rebind(A,b,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){if(!arguments.length)return b.x;b.x(a),c.x(a);return A},A.y=function(a){if(!arguments.length)return b.y;b.y(a),c.y(a);return A},A.margin=function(a){if(!arguments.length)return j;j.top=typeof a.top!="undefined"?a.top:j.top,j.right=typeof a.right!="undefined"?a.right:j.right,j.bottom=typeof a.bottom!="undefined"?a.bottom:j.bottom,j.left=typeof a.left!="undefined"?a.left:j.left;return A},A.margin2=function(a){if(!arguments.length)return k;k=a;return A},A.width=function(a){if(!arguments.length)return m;m=a;return A},A.height=function(a){if(!arguments.length)return n;n=a;return A},A.height2=function(a){if(!arguments.length)return o;o=a;return A},A.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),h.color(l);return A},A.showLegend=function(a){if(!arguments.length)return t;t=a;return A},A.tooltips=function(a){if(!arguments.length)return v;v=a;return A},A.tooltipContent=function(a){if(!arguments.length)return w;w=a;return A},A.interpolate=function(a){if(!arguments.length)return b.interpolate();b.interpolate(a),c.interpolate(a);return A},A.noData=function(a){if(!arguments.length)return x;x=a;return A},A.xTickFormat=function(a){if(!arguments.length)return d.tickFormat();d.tickFormat(a),f.tickFormat(a);return A},A.yTickFormat=function(a){if(!arguments.length)return e.tickFormat();e.tickFormat(a),g.tickFormat(a);return A};return A},a.models.multiBar=function(){function t -(a){a.each(function(a){var t=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=o&&p?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});e.domain(d3.merge(w).map(function(a){return a.x})).rangeBands([0,t],.1),f.domain(p||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([u,0]);if(e.domain()[0]===e.domain()[1]||f.domain()[0]===f.domain()[1])singlePoint=!0;e.domain()[0]===e.domain()[1]&&(e.domain()[0]?e.domain([e.domain()[0]-e.domain()[0]*.01,e.domain()[1]+e.domain()[1]*.01]):e.domain([-1,1])),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]+f.domain()[0]*.01,f.domain()[1]-f.domain()[1]*.01]):f.domain([-1,1])),r=r||e,s=s||f;var z=v.selectAll("g.nv-wrap.nv-multibar").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")"),B.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),z.select("#nv-edge-clip-"+g+" rect").attr("width",t).attr("height",u),D.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).selectAll("rect.nv-bar").delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return m(a,b)}).style("stroke",function(a,b){return m(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("rect.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return l?0:d*e.rangeBand()/a.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:a.length));F.style("fill",function(a,b,c){return m(a,c,b)}).style("stroke",function(a,b,c){return m(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){q.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){q.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+e(h(a,b))+",0)"}),l?d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.max(Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(b,c){return l?0:b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/(l?1:a.length))}):d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("x",function(b,c){return b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/a.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(0)-f(i(a,b))<1?f(0)-1:f(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(f(i(a,b))-f(0)),1)})}),r=e.copy(),s=f.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.ordinal(),f=d3.scale.linear(),g=Math.floor(Math.random()*1e4),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=!0,l=!1,m=a.utils.defaultColor(),n=1200,o,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),r,s;t.dispatch=q,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return e;e=a;return t},t.yScale=function(a){if(!arguments.length)return f;f=a;return t},t.xDomain=function(a){if(!arguments.length)return o;o=a;return t},t.yDomain=function(a){if(!arguments.length)return p;p=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.stacked=function(a){if(!arguments.length)return l;l=a;return t},t.clipEdge=function(a){if(!arguments.length)return k;k=a;return t},t.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return g;g=a;return t},t.delay=function(a){if(!arguments.length)return n;n=a;return t};return t},a.models.multiBarChart=function(){function v(a){a.each(function(p){var w=d3.select(this),z=this,A=(h||parseInt(w.style("width"))||960)-g.left-g.right,B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom;v.update=function(){a.transition().call(v)},v.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=w.selectAll(".nv-noData").data([s]);C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",g.left+A/2).attr("y",g.top+B/2).text(function(a){return a});return v}w.selectAll(".nv-noData").remove(),q=b.xScale(),r=b.yScale();var D=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([p]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-controlsWrap"),l&&(e.width(A/2),F.select(".nv-legendWrap").datum(p).call(e),g.top!=e.height()&&(g.top=e.height(),B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom),F.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -g.top+")"));if(k){var G=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),F.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+ -g.top+")").call(f)}D.attr("transform","translate("+g.left+","+g.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!p[b].disabled}));var H=F.select(".nv-barsWrap").datum(p.filter(function(a){return!a.disabled}));d3.transition(H).call(b),c.scale(q).ticks(A/100).tickSize(-B,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(c);var I=F.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1),m&&I.filter(function(a,b){return b%Math.ceil(p[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),n&&I.selectAll("text").attr("transform",function(a,b,c){return"rotate("+n+" 0,0)"}).attr("text-transform",n>0?"start":"end"),F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),d.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(F.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(v)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){G=G.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(v)}}),t.on("tooltipShow",function(a){o&&u(a,z.parentNode)})});return v}var b=a.models.multiBar(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:20,bottom:30,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!0,n=0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" on "+b+"

"},q,r,s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");b.stacked(!1),c.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var u=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=p(e.series.key,i,j,e,v);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),v.dispatch=t,v.multibar=b,v.legend=e,v.xAxis=c,v.yAxis=d,d3.rebind(v,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return v},v.width=function(a){if(!arguments.length)return h;h=a;return v},v.height=function(a){if(!arguments.length)return i;i=a;return v},v.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return v},v.showControls=function(a){if(!arguments.length)return k;k=a;return v},v.showLegend=function(a){if(!arguments.length)return l;l=a;return v},v.reduceXTicks=function(a){if(!arguments.length)return m;m=a;return v},v.rotateLabels=function(a){if(!arguments.length)return n;n=a;return v},v.tooltip=function(a){if(!arguments.length)return p;p=a;return v},v.tooltips=function(a){if(!arguments.length)return o;o=a;return v},v.tooltipContent=function(a){if(!arguments.length)return p;p=a;return v},v.noData=function(a){if(!arguments.length)return s;s=a;return v};return v},a.models.multiBarHorizontal=function(){function v(a){a.each(function(a){var e=c-b.left-b.right,p=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=q&&r?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(q||d3.merge(w).map(function(a){return a.x})).rangeBands([0,p],.1),g.domain(r||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,e-(g.domain()[1]>0?n:0)]):g.range([0,e]),t=t||f,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var z=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+u(l?b.y0:0)+","+(l?0:d*f.rangeBand()/a.length+f(h(b,c)))+")"});G.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),s.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[g(i(b,c)+(l?b.y0:0)),f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),s.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){s.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){s.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(G.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),F.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(F).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):F.selectAll("text").remove(),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(F).attr("transform",function(a,b){return"translate("+g(a.y0)+","+f(h(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(g(i(a,b)+a.y0)-g(a.y0))}).attr("height",f.rangeBand()):d3.transition(F).attr("transform",function(b,c){return"translate("+(i(b,c)<0?g(i(b,c)):g(0))+","+(b.series*f.rangeBand()/a.length+f(h(b,c)))+")"}).select("rect").attr("height",f.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)}),t=f.copy(),u=g.copy()});return v}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),t,u;v.dispatch=s,v.x=function(a){if(!arguments.length)return h;h=a;return v},v.y=function(a){if(!arguments.length)return i;i=a;return v},v.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.xScale=function(a){if(!arguments.length)return f;f=a;return v},v.yScale=function(a){if(!arguments.length)return g;g=a;return v},v.xDomain=function(a){if(!arguments.length)return q;q=a;return v},v.yDomain=function(a){if(!arguments.length)return r;r=a;return v},v.forceY=function(a){if(!arguments.length)return j;j=a;return v},v.stacked=function(a){if(!arguments.length)return l;l=a;return v},v.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return v},v.id=function(a){if(!arguments.length)return e;e=a;return v},v.delay=function(a){if(!arguments.length)return p;p=a;return v},v.showValues=function(a){if(!arguments.length)return m;m=a;return v},v.valueFormat=function(a){if(!arguments.length)return o;o=a;return v},v.valuePadding=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontalChart=function(){function u(a){a.each(function(m){var o=d3.select(this),v=this,w=(h||parseInt(o.style("width"))||960)-g.left-g.right,z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom;u.update=function(){a.transition().call(u)},u.container=this;if(!m||!m.length||!m.filter(function(a){return a.values.length}).length){var A=o.selectAll(".nv-noData").data([r]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",g.left+w/2).attr("y",g.top+z/2).text(function(a){return a});return u}o.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();var B=o.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([m]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),D=B.select("g");C.append("g").attr("class","nv-x nv-axis"),C.append("g").attr("class","nv-y nv-axis"),C.append("g").attr("class","nv-barsWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap"),l&&(e.width(w/2),D.select(".nv-legendWrap").datum(m).call(e),g.top!=e.height()&&(g.top=e.height(),z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom),D.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -g.top+")"));if(k){var E=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(E).attr("transform","translate(0,"+ -g.top+")").call(f)}B.attr("transform","translate("+g.left+","+g.top+")"),b.width(w).height(z).color(m.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!m[b].disabled}));var F=D.select(".nv-barsWrap").datum(m.filter(function(a){return!a.disabled}));d3.transition(F).call(b),c.scale(p).ticks(z/24).tickSize(-w,0),d3.transition(D.select(".nv-x.nv-axis")).call(c);var G=D.select(".nv-x.nv-axis").selectAll("g");G.selectAll("line, text").style("opacity",1),d.scale(q).ticks(w/100).tickSize(-z,0),D.select(".nv-y.nv-axis").attr("transform","translate(0,"+z+")"),d3.transition(D.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,m.filter(function(a){return!a.disabled}).length||m.map(function(a){a.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(u)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){E=E.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(u)}}),s.on("tooltipShow",function(a){n&&t(a,v.parentNode)})});return u}var b=a.models.multiBarHorizontal(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend().height(30),f=a.models.legend().height(30),g={top:30,right:20,bottom:50,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!1,n=!0,o=function(a,b,c,d,e){return"

"+a+" - "+b+"

"+"

"+c+"

"},p,q,r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");b.stacked(m),c.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("bottom").tickFormat(d3.format(",.1f"));var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"e":"w",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),u.dispatch=s,u.multibar=b,u.legend=e,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return h;h=a;return u},u.height=function(a){if(!arguments.length)return i;i=a;return u},u.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return o;o=a;return u},u.tooltips=function(a){if(!arguments.length)return n;n=a;return u},u.tooltipContent=function(a){if(!arguments.length)return o;o=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u};return u},a.models.multiChart=function(){function y(a){a.each(function(h){var j=d3.select(this),z=this,A=(d||parseInt(j.style("width"))||960)-b.left-b.right,B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom,C=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==1}),D=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==2}),E=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==1}),F=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==2}),G=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==1}),H=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==2}),I=h.filter(function(a){return!a.disabled&&a.yAxis==1}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),J=h.filter(function(a){return!a.disabled&&a.yAxis==2}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});i.domain(d3.extent(d3.merge(I.concat(J)),function(a){return a.x})).range([0,A]);var K=j.selectAll("g.wrap.multiChart").data([h]),L=K.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");L.append("g").attr("class","x axis"),L.append("g").attr("class","y1 axis"),L.append("g").attr("class","y2 axis"),L.append("g").attr("class","lines1Wrap"),L.append("g").attr("class","lines2Wrap"),L.append("g").attr("class","bars1Wrap"),L.append("g").attr("class","bars2Wrap"),L.append("g").attr("class","stack1Wrap"),L.append("g").attr("class","stack2Wrap"),L.append("g").attr("class","legendWrap");var M=K.select("g");f&&(v.width(A/2),M.select(".legendWrap").datum(h.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)");return a})).call(v),b.top!=v.height()&&(b.top=v.height(),B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom),M.select(".legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),m.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="line"})),n.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="line"})),o.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="bar"})),p.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="bar"})),q.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="area"})),r.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="area"})),M.attr("transform","translate("+b.left+","+b.top+")");var N=M.select(".lines1Wrap").datum(C),O=M.select(".bars1Wrap").datum(E),P=M.select(".stack1Wrap").datum(G),Q=M.select(".lines2Wrap").datum(D),R=M.select(".bars2Wrap").datum(F),S=M.select(".stack2Wrap").datum(H),T=G.length?G.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];k.domain(d3.extent(d3.merge(I).concat(T),function(a){return a.y})).range([0,B]),l.domain(d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,B]),m.yDomain(k.domain()),o.yDomain(k.domain()),q.yDomain(k.domain()),n.yDomain(l.domain()),p.yDomain(l.domain()),r.yDomain(l.domain()),G.length&&d3.transition(P).call(q),H.length&&d3.transition(S).call(r),E.length&&d3.transition(O).call(o),F.length&&d3.transition(R).call(p),C.length&&d3.transition(N).call(m),D.length&&d3.transition(Q).call(n),s.ticks(A/100).tickSize(-B,0),M.select(".x.axis").attr("transform","translate(0,"+B+")"),d3.transition(M.select(".x.axis")).call(s),t.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y1.axis")).call(t),u.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y2.axis")).call(u),M.select(".y2.axis").style("opacity",J.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,K.selectAll(".series").classed("disabled",!1);return a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this;return y}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},i,j,i=d3.scale.linear(),k=d3.scale.linear(),l=d3.scale.linear(),m=a.models.line().yScale(k),n=a.models.line().yScale(l),o=a.models.multiBar().stacked(!1).yScale(k),p=a.models.multiBar().stacked(!1).yScale(l),q=a.models.stackedArea().yScale(k),r=a.models.stackedArea().yScale(l),s=a.models.axis().scale(i).orient("bottom").tickPadding(5),t=a.models.axis().scale(k).orient("left"),u=a.models.axis().scale(l).orient("right"),v=a.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=(b.series.bar?t:u).tickFormat()(m.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,y);a.tooltip.show([d,e],i,undefined,undefined,c.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),q.dispatch.on("tooltipShow",function(a){if(!Math.round(q.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),q.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),r.dispatch.on("tooltipShow",function(a){if(!Math.round(r.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),r.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),w.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),y.dispatch=w,y.lines1=m,y.lines2=n,y.bars1=o,y.bars2=p,y.stack1=q,y.stack2=r,y.xAxis=s,y.yAxis1=t,y.yAxis2=u,y.x=function(a){if(!arguments.length)return getX;getX=a,m.x(a),o.x(a);return y},y.y=function(a){if(!arguments.length)return getY;getY=a,m.y(a),o.y(a);return y},y.margin=function(a){if(!arguments.length)return b;b=a;return y},y.width=function(a){if(!arguments.length)return d;d=a;return y},y.height=function(a){if(!arguments.length)return e;e=a;return y},y.color=function(a){if(!arguments.length)return c;c=a,v.color(a);return y},y.showLegend=function(a){if(!arguments.length)return f;f=a;return y},y.tooltips=function(a){if(!arguments.length)return g;g=a;return y},y.tooltipContent=function(a){if(!arguments.length)return h;h=a;return y};return y},a.models.ohlcBar=function(){function u(a){a.each(function(a){var q=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);f.domain(r||d3.extent(a[0].values.map(h).concat(n))).range([0,q]),g.domain(s||[d3.min(a[0].values.map(m).concat(o)),d3.max(a[0].values.map(l).concat(o))]).range([u,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var w=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),A=z.append("defs"),B=z.append("g"),C=w.select("g");B.append("g").attr("class","nv-ticks"),w.attr("transform","translate("+b.left+","+b.top+")"),v.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:e})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",u),C.attr("clip-path",p?"url(#nv-chart-clip-path-"+e+")":"");var D=w.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});D.exit().remove();var E=D.enter().append("path").attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){t.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){t.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})});return u}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=function(a){return a.open},k=function(a){return a.close},l=function(a){return a.high},m=function(a){return a.low},n=[],o=[],p=!0,q=a.utils.defaultColor(),r,s,t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");u.dispatch=t,u.x=function(a){if(!arguments.length)return h;h=a;return u},u.y=function(a){if(!arguments.length)return i;i=a;return u},u.open=function(a){if(!arguments.length)return j;j=a;return u},u.close=function(a){if(!arguments.length)return k;k=a;return u},u.high=function(a){if(!arguments.length)return l;l=a;return u},u.low=function(a){if(!arguments.length)return m;m=a;return u},u.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof -a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return u},u.width=function(a){if(!arguments.length)return c;c=a;return u},u.height=function(a){if(!arguments.length)return d;d=a;return u},u.xScale=function(a){if(!arguments.length)return f;f=a;return u},u.yScale=function(a){if(!arguments.length)return g;g=a;return u},u.xDomain=function(a){if(!arguments.length)return r;r=a;return u},u.yDomain=function(a){if(!arguments.length)return s;s=a;return u},u.forceX=function(a){if(!arguments.length)return n;n=a;return u},u.forceY=function(a){if(!arguments.length)return o;o=a;return u},u.clipEdge=function(a){if(!arguments.length)return p;p=a;return u},u.color=function(b){if(!arguments.length)return q;q=a.utils.getColor(b);return u},u.id=function(a){if(!arguments.length)return e;e=a;return u};return u},a.models.pie=function(){function p(a){a.each(function(a){function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);this._current=b(0);return function(a){return w(b(a))}}function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this),s=r.selectAll(".nv-wrap.nv-pie").data([e(a[0])]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+h),u=t.append("g"),v=s.select("g");u.append("g").attr("class","nv-pie"),s.attr("transform","translate("+b.left+","+b.top+")"),v.select(".nv-pie").attr("transform","translate("+j/2+","+p/2+")"),r.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})});var w=d3.svg.arc().outerRadius(q-q/5);n&&w.innerRadius(q/2);var x=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:g(a)}),y=s.select(".nv-pie").selectAll(".nv-slice").data(x);y.exit().remove();var z=y.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:f(a.data),value:g(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:h})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:f(a.data),value:g(a.data),point:a.data,index:b,id:h})}).on("click",function(a,b){o.elementClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()});y.attr("fill",function(a,b){return i(a,b)}).attr("stroke",function(a,b){return i(a,b)});var A=z.append("path").each(function(a){this._current=a});d3.transition(y.select("path")).attr("d",w).attrTween("d",D);if(k){var B=w;l&&(B=d3.svg.arc().outerRadius(w.outerRadius())),z.append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor","middle").style("fill","#000")}),y.select(".nv-label").transition().attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),y.each(function(a,b){var c=d3.select(this);c.select(".nv-label text").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>m?f(a.data):""});var d=c.select("text").node().getBBox();c.select(".nv-label rect").attr("width",d.width+10).attr("height",d.height+10).attr("transform",function(){return"translate("+[d.x-5,d.y-5]+")"})})}});return p}var b={top:0,right:0,bottom:0,left:0},c=500,d=500,e=function(a){return a.values},f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(Math.random()*1e4),i=a.utils.defaultColor(),j=d3.format(",.2f"),k=!0,l=!1,m=.02,n=!1,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");p.dispatch=o,p.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.values=function(a){if(!arguments.length)return e;e=a;return p},p.x=function(a){if(!arguments.length)return f;f=a;return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return p},p.showLabels=function(a){if(!arguments.length)return k;k=a;return p},p.donutLabelsOutside=function(a){if(!arguments.length)return l;l=a;return p},p.donut=function(a){if(!arguments.length)return n;n=a;return p},p.id=function(a){if(!arguments.length)return h;h=a;return p},p.color=function(b){if(!arguments.length)return i;i=a.utils.getColor(b);return p},p.valueFormat=function(a){if(!arguments.length)return j;j=a;return p},p.labelThreshold=function(a){if(!arguments.length)return m;m=a;return p};return p},a.models.pieChart=function(){function n(a){a.each(function(h){var i=d3.select(this),j=this,m=(e||parseInt(i.style("width"))||960)-d.left-d.right,o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom;n.update=function(){n(a)},n.container=this;if(!h||!h.length){var p=i.selectAll(".nv-noData").data([k]);p.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),p.attr("x",d.left+m/2).attr("y",d.top+o/2).text(function(a){return a});return n}i.selectAll(".nv-noData").remove();var q=i.selectAll("g.nv-wrap.nv-pieChart").data([h]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),s=q.select("g");r.append("g").attr("class","nv-pieWrap"),r.append("g").attr("class","nv-legendWrap"),g&&(c.width(m).key(b.x()),q.select(".nv-legendWrap").datum(b.values()(h[0])).call(c),d.top!=c.height()&&(d.top=c.height(),o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom),q.select(".nv-legendWrap").attr("transform","translate(0,"+ -d.top+")")),q.attr("transform","translate("+d.left+","+d.top+")"),b.width(m).height(o);var t=s.select(".nv-pieWrap").datum(h);d3.transition(t).call(b),c.dispatch.on("legendClick",function(c,d,e){c.disabled=!c.disabled,b.values()(h[0]).filter(function(a){return!a.disabled}).length||b.values()(h[0]).map(function(a){a.disabled=!1,q.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(n)}),b.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)})});return n}var b=a.models.pie(),c=a.models.legend(),d={top:30,right:20,bottom:20,left:20},e=null,f=null,g=!0,h=a.utils.defaultColor(),i=!0,j=function(a,b,c,d){return"

"+a+"

"+"

"+b+"

"},k="No Data Available.",l=d3.dispatch("tooltipShow","tooltipHide"),m=function(c,d){var e=c.pos[0]+(d&&d.offsetLeft||0),f=c.pos[1]+(d&&d.offsetTop||0),g=b.valueFormat()(b.y()(c.point)),h=j(b.x()(c.point),g,c,n);a.tooltip.show([e,f],h,c.value<0?"n":"s",null,d)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+d.left,a.pos[1]+d.top],l.tooltipShow(a)}),l.on("tooltipShow",function(a){i&&m(a)}),l.on("tooltipHide",function(){i&&a.tooltip.cleanup()}),n.dispatch=l,n.pie=b,d3.rebind(n,b,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){if(!arguments.length)return d;d.top=typeof a.top!="undefined"?a.top:d.top,d.right=typeof a.right!="undefined"?a.right:d.right,d.bottom=typeof a.bottom!="undefined"?a.bottom:d.bottom,d.left=typeof a.left!="undefined"?a.left:d.left;return n},n.width=function(a){if(!arguments.length)return e;e=a;return n},n.height=function(a){if(!arguments.length)return f;f=a;return n},n.color=function(d){if(!arguments.length)return h;h=a.utils.getColor(d),c.color(h),b.color(h);return n},n.showLegend=function(a){if(!arguments.length)return g;g=a;return n},n.tooltips=function(a){if(!arguments.length)return i;i=a;return n},n.tooltipContent=function(a){if(!arguments.length)return j;j=a;return n},n.noData=function(a){if(!arguments.length)return k;k=a;return n};return n},a.models.scatter=function(){function H(a){a.each(function(a){function Q(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c,a]}).filter(function(a,b){return r(a[4],b)})}));if(t){N.append("clipPath").attr("id","nv-points-clip-"+f);var e=L.select("#nv-points-clip-"+f).selectAll("circle").data(d);e.enter().append("circle").attr("r",u),e.exit().remove(),e.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),L.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){d.length<3&&(d.push([g.range()[0]-20,h.range()[0]-20,null,null]),d.push([g.range()[1]+20,h.range()[1]+20,null,null]));var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=L.select(".nv-point-paths").selectAll("path").data(i);l.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),l.exit().remove(),l.attr("d",function(a){return"M"+a.data.join(",")+"Z"}),c=l}else{var m=d.map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}});c=L.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementClick({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseover",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementMouseover({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseout",function(b,c){if(G)return 0;var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})}),G=!1}var H=c-b.left-b.right,I=d-b.top-b.bottom,J=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var K=v&&w&&x?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:j(a,b),y:k(a,b),size:l(a,b)}})}));g.domain(v||d3.extent(K.map(function(a){return a.x}).concat(n))).range([0,H]),h.domain(w||d3.extent(K.map(function(a){return a.y}).concat(o))).range([I,0]),i.domain(x||d3.extent(K.map(function(a){return a.size}).concat(p))).range(y||[16,256]);if(g.domain()[0]===g.domain()[1]||h.domain()[0]===h.domain()[1])z=!0;g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-g.domain()[0]*.01,g.domain()[1]+g.domain()[1]*.01]):g.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*.01,h.domain()[1]-h.domain()[1]*.01]):h.domain([-1,1])),C=C||g,D=D||h,E=E||i;var L=J.selectAll("g.nv-wrap.nv-scatter").data([a]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),O.append("g").attr("class","nv-point-paths"),L.attr("transform","translate("+b.left+","+b.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),L.select("#nv-edge-clip-"+f+" rect").attr("width",H).attr("height",I),P.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":""),G=!0;var R=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(R.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),R.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(R).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var S=R.selectAll("path.nv-point").data(function(a){return a.values});S.enter().append("path").attr("transform",function(a,b){return"translate("+C(j(a,b))+","+D(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),S.exit().remove(),d3.transition(R.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),S.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(S).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),clearTimeout(F),F=setTimeout(Q,1e3),C=g.copy(),D=h.copy(),E=i.copy()});return H}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e5),g=d3.scale.linear(),h=d3.scale.linear(),i=d3.scale.linear(),j=function(a){return a.x},k=function(a){return a.y},l=function(a){return a.size||1},m=function(a){return a.shape||"circle"},n=[],o=[],p=[],q=!0,r=function(a){return!a.notActive},s=!1,t=!0,u=function(){return 25},v=null,w=null,x=null,y=null,z=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),B=!0,C,D,E,F,G=!1;A.on("elementMouseover.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!1)}),H.dispatch=A,H.x=function(a){if(!arguments.length)return j;j=d3.functor(a);return H},H.y=function(a){if(!arguments.length)return k;k=d3.functor(a);return H},H.size=function(a){if(!arguments.length)return l;l=d3.functor(a);return H},H.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return H},H.width=function(a){if(!arguments.length)return c;c=a;return H},H.height=function(a){if(!arguments.length)return d;d=a;return H},H.xScale=function(a){if(!arguments.length)return g;g=a;return H},H.yScale=function(a){if(!arguments.length)return h;h=a;return H},H.zScale=function(a){if(!arguments.length)return i;i=a;return H},H.xDomain=function(a){if(!arguments.length)return v;v=a;return H},H.yDomain=function(a){if(!arguments.length)return w;w=a;return H},H.sizeDomain=function(a){if(!arguments.length)return x;x=a;return H},H.sizeRange=function(a){if(!arguments.length)return y;y=a;return H},H.forceX=function(a){if(!arguments.length)return n;n=a;return H},H.forceY=function(a){if(!arguments.length)return o;o=a;return H},H.forceSize=function(a){if(!arguments.length)return p;p=a;return H},H.interactive=function(a){if(!arguments.length)return q;q=a;return H},H.pointActive=function(a){if(!arguments.length)return r;r=a;return H},H.clipEdge=function(a){if(!arguments.length)return s;s=a;return H},H.clipVoronoi=function(a){if(!arguments.length)return t;t=a;return H},H.useVoronoi=function(a){if(!arguments.length)return B;B=a,B===!1&&(t=!1);return H},H.clipRadius=function(a){if(!arguments.length)return u;u=a;return H},H.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return H},H.shape=function(a){if(!arguments.length)return m;m=a;return H},H.id=function(a){if(!arguments.length)return f;f=a;return H},H.singlePoint=function(a){if(!arguments.length)return z;z=a;return H};return H},a.models.scatterChart=function(){function G(a){a.each(function(x){function Q(){if(v){N.select(".nv-point-paths").style("pointer-events","all");return!1}N.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(u).focus(a[0]),n.distortion(u).focus(a[1]),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d),N.select(".nv-distributionX").datum(x.filter(function(a){return!a.disabled})).call(g),N.select(".nv-distributionY").datum(x.filter(function(a){return!a.disabled})).call(h)}var y=d3.select(this),z=this,H=(j||parseInt(y.style("width"))||960)-i.left-i.right,I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom;G.update=function(){G(a)},G.container=this;if(!x||!x.length||!x.filter(function(a){return a.values.length}).length){var J=y.selectAll(".nv-noData").data([B]);J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",i.left+H/2).attr("y",i.top+I/2).text(function(a){return a});return G}y.selectAll(".nv-noData").remove(),C=C||m,D=D||n;var K=y.selectAll("g.nv-wrap.nv-scatterChart").data([x]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),M=L.append("g"),N=K.select("g");M.append("rect").attr("class","nvd3 nv-background"),M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis"),M.append("g").attr("class","nv-scatterWrap"),M.append("g").attr("class","nv-distWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),s&&(e.width(H/2),K.select(".nv-legendWrap").datum(x).call(e),i.top!=e.height()&&(i.top=e.height(),I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom),K.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -i.top+")")),t&&(f.width(180).color(["#444"]),N.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -i.top+")").call(f)),K.attr("transform","translate("+i.left+","+i.top+")"),b.width(H).height(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),K.select(".nv-scatterWrap").datum(x.filter(function(a){return!a.disabled})).call(b);if(o){var O=m.domain()[1]-m.domain()[0];m.domain([m.domain()[0]-o*O,m.domain()[1]+o*O])}if(p){var P=n.domain()[1]-n.domain()[0];n.domain([n.domain()[0]-p*P,n.domain()[1]+p*P])}c.scale(m).ticks(c.ticks()&&c.ticks().length?c.ticks():H/100).tickSize(-I,0),N.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():I/36).tickSize(-H,0),N.select(".nv-y.nv-axis").call(d),q&&(g.getData(b.x()).scale(m).width(H).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),N.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(x.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(b.y()).scale(n).width(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),N.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(x.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(N.select(".nv-background").attr("width",H).attr("height",I),N.select(".nv-background").on("mousemove",Q),N.select(".nv-background").on("click",function(){v=!v}),b.dispatch.on("elementClick.freezeFisheye",function(){v=!v})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,u=e.disabled?0:2.5,N.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),N.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(u).focus(0),n.distortion(u).focus(0),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d)):v=!1,G(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,x.filter(function(a){return!a.disabled}).length||x.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),G(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-I),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],A.tooltipShow(a)}),A.on("tooltipShow",function(a){w&&E(a,z.parentNode)}),C=m.copy(),D=n.copy()});return G}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=0,p=0,q=!1,r=!1,s=!0,t=!!d3.fisheye,u=0,v=!1,w=!0,x=function(a,b,c){return""+b+""},y=function(a,b,c){return""+c+""},z=null,A=d3.dispatch("tooltipShow","tooltipHide"),B="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var C,D,E=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));x!=null&&a.tooltip.show([j,k],x(e.series.key,p,q,e,G),"n",1,f,"x-nvtooltip"),y!=null&&a.tooltip.show([l,o],y(e.series.key,p,q,e,G),"e",1,f,"y-nvtooltip"),z!=null&&a.tooltip.show([g,h],z(e.series.key,p,q,e,G),e.value<0?"n":"s",null,f)},F=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),A.on("tooltipHide",function(){w&&a.tooltip.cleanup()}),G.dispatch=A,G.scatter=b,G.legend=e,G.controls=f,G.xAxis=c,G.yAxis=d,G.distX=g,G.distY=h,d3.rebind(G,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),G.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return G},G.width=function(a){if(!arguments.length)return j;j=a;return G},G.height=function(a){if(!arguments.length)return k;k=a;return G},G.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return G},G.showDistX=function(a){if(!arguments.length)return q;q=a;return G},G.showDistY=function(a){if(!arguments.length)return r;r=a;return G},G.showControls=function(a){if(!arguments.length)return t;t=a;return G},G.showLegend=function(a){if(!arguments.length)return s;s=a;return G},G.fisheye=function(a){if(!arguments.length)return u;u=a;return G},G.xPadding=function(a){if(!arguments.length)return o;o=a;return G},G.yPadding=function(a){if(!arguments.length)return p;p=a;return G},G.tooltips=function(a){if(!arguments.length)return w;w=a;return G},G.tooltipContent=function(a){if(!arguments.length)return z;z=a;return G},G.tooltipXContent=function(a){if(!arguments.length)return x;x=a;return G},G.tooltipYContent=function(a){if(!arguments.length)return y;y=a;return G},G.noData=function(a){if(!arguments.length)return B;B=a;return G};return G},a.models.scatterPlusLineChart=function(){function E(a){a.each(function(v){function O(){if(t){L.select(".nv-point-paths").style("pointer-events","all");return!1}L.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(s).focus(a[0]),n.distortion(s).focus(a[1]),L.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d),L.select(".nv-distributionX").datum(v.filter(function(a){return!a.disabled})).call(g),L.select(".nv-distributionY").datum(v.filter(function(a){return!a.disabled})).call(h)}var w=d3.select(this),x=this,F=(j||parseInt(w.style("width"))||960)-i.left-i.right,G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom;E.update=function(){E(a)},E.container=this;if(!v||!v.length||!v.filter(function(a){return a.values.length}).length){var H=w.selectAll(".nv-noData").data([z]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",i.left+F/2).attr("y",i.top+G/2).text(function(a){return a});return E}w.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale(),A=A||m,B=B||n;var I=w.selectAll("g.nv-wrap.nv-scatterChart").data([v]),J=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),K=J.append("g"),L=I.select("g");K.append("rect").attr("class","nvd3 nv-background"),K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-scatterWrap"),K.append("g").attr("class","nv-regressionLinesWrap"),K.append("g").attr("class","nv-distWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+i.left+","+i.top+")"),q&&(e.width(F/2),I.select(".nv-legendWrap").datum(v).call(e),i.top!=e.height()&&(i.top=e.height(),G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom),I.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -i.top+")")),r&&(f.width(180).color(["#444"]),L.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -i.top+")").call(f)),b.width(F).height(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),I.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var M=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a}),N=M.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);M.selectAll(".nv-regLines line").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(a,b){return n(m.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return n(m.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return l(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||typeof a.slope=="undefined"||typeof a.intercept=="undefined"?0:1}),c.scale(m).ticks(c.ticks()?c.ticks():F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()?d.ticks():G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").call(d),o&&(g.getData(b.x()).scale(m).width(F).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),L.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(v.filter(function(a){return!a.disabled})).call(g)),p&&(h.getData(b.y()).scale(n).width(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),L.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(v.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(L.select(".nv-background").attr("width",F).attr("height",G),L.select(".nv-background").on("mousemove",O),L.select(".nv-background").on("click",function(){t=!t}),b.dispatch.on("elementClick.freezeFisheye",function(){t=!t})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,s=e.disabled?0:2.5,L.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),L.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(s).focus(0),n.distortion(s).focus(0),L.select(".nv-scatterWrap").call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d)):t=!1,E(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,v.filter(function(a){return!a.disabled}).length||v.map(function(a){a.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1);return a}),E(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){u&&C(a,x.parentNode)}),A=m.copy(),B=n.copy()});return E}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=!1,p=!1,q=!0,r=!!d3.fisheye,s=0,t=!1,u=!0,v=function(a,b,c){return""+b+""},w=function(a,b,c){return""+c+""},x=function(a,b,c,d){return"

"+a+"

"+"

"+d+"

"},y=d3.dispatch("tooltipShow","tooltipHide"),z="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var A,B,C=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));v!=null&&a.tooltip.show([j,k],v(e.series.key,p,q,e,E),"n",1,f,"x-nvtooltip"),w!=null&&a.tooltip.show([l,o],w(e.series.key,p,q,e,E),"e",1,f,"y-nvtooltip"),x!=null&&a.tooltip.show([g,h],x(e.series.key,p,q,e.point.tooltip,e,E),e.value<0?"n":"s",null,f)},D=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),y.on("tooltipHide",function(){u&&a.tooltip.cleanup()}),E.dispatch=y,E.scatter=b,E.legend=e,E.controls=f,E.xAxis=c,E.yAxis=d,E.distX=g,E.distY=h,d3.rebind(E,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return E},E.width=function(a){if(!arguments.length)return j;j=a;return E},E.height=function(a){if(!arguments.length)return k;k=a;return E},E.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return E},E.showDistX=function(a){if(!arguments.length)return o;o=a;return E},E.showDistY=function(a){if(!arguments.length)return p;p=a;return E},E.showControls=function(a){if(!arguments.length)return r;r=a;return E},E.showLegend=function(a){if(!arguments.length)return q;q=a;return E},E.fisheye=function(a){if(!arguments.length)return s;s=a;return E},E.tooltips=function(a){if(!arguments.length)return u;u=a;return E},E.tooltipContent=function(a){if(!arguments.length)return x;x=a;return E},E.tooltipXContent=function(a){if(!arguments.length)return v;v=a;return E},E.tooltipYContent=function(a){if(!arguments.length)return w;w=a;return E},E.noData=function(a){if(!arguments.length)return z;z=a;return E};return E},a.models.sparkline=function(){function m(a){a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom,n=d3.select(this);f.domain(k||d3.extent(a,h)).range([0,e]),g.domain(l||d3.extent(a,i)).range([m,0]);var o=n.selectAll("g.nv-wrap.nv-sparkline").data([a]),p=o.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),q=p.append("g"),r=o.select("g");o.attr("transform","translate("+b.left+","+b.top+")");var s=o.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||j(a,b)}).attr("d",d3.svg.line().x(function(a,b){return f(h(a,b))}).y(function(a,b){return g(i(a,b))}));var t=o.selectAll("circle.nv-point").data(function(a){function c(b){if(b!=-1){var c=a[b];c.pointIndex=b;return c}return null}var b=a.map(function(a,b){return i(a,b)}),d=c(b.lastIndexOf(g.domain()[1])),e=c(b.indexOf(g.domain()[0])),f=c(b.length-1);return[e,d,f].filter(function(a){return a!=null -})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return f(h(a,a.pointIndex))}).attr("cy",function(a,b){return g(i(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return h(a,a.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":i(a,a.pointIndex)==g.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return m}var b={top:2,right:0,bottom:2,left:0},c=400,d=32,e=!0,f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=a.utils.getColor(["#000"]),k,l;m.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.x=function(a){if(!arguments.length)return h;h=d3.functor(a);return m},m.y=function(a){if(!arguments.length)return i;i=d3.functor(a);return m},m.xScale=function(a){if(!arguments.length)return f;f=a;return m},m.yScale=function(a){if(!arguments.length)return g;g=a;return m},m.xDomain=function(a){if(!arguments.length)return k;k=a;return m},m.yDomain=function(a){if(!arguments.length)return l;l=a;return m},m.animate=function(a){if(!arguments.length)return e;e=a;return m},m.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b);return m};return m},a.models.sparklinePlus=function(){function n(a){a.each(function(l){function D(){function d(a,c){var d=Math.abs(b.x()(a[0],0)-c),e=0;for(var f=0;f"+a+""+"

"+c+" on "+b+"

"},o,p,q=d3.format(",.2f"),r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left"),b.scatter.pointActive(function(a){return!!Math.round(b.y()(a)*100)});var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=n(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){m&&a.tooltip.cleanup()}),u.dispatch=s,u.stacked=b,u.legend=e,u.controls=f,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return getWidth;h=a;return u},u.height=function(a){if(!arguments.length)return getHeight;i=a;return u},u.color=function(c){if(!arguments.length)return j;j=a.utils.getColor(c),e.color(j),b.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return n;n=a;return u},u.tooltips=function(a){if(!arguments.length)return m;m=a;return u},u.tooltipContent=function(a){if(!arguments.length)return n;n=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u},d.setTickFormat=d.tickFormat,d.tickFormat=function(a){if(!arguments.length)return q;q=a;return d};return u}})() \ No newline at end of file +(function(){function c(a,b,c){return function(d,e,f){var g=a(d),h=[];g1)while(g=document.body.scrollWidth?m:m-16,l=window.innerHeight>=document.body.scrollHeight?l:l-16;var r=function(a){var b=q;do isNaN(a.offsetTop)||(b+=a.offsetTop);while(a=a.offsetParent);return b},s=function(a){var b=p;do isNaN(a.offsetLeft)||(b+=a.offsetLeft);while(a=a.offsetParent);return b};switch(d){case"e":p=b[0]-k-e,q=b[1]-j/2;var t=s(h),u=r(h);to?b[0]+e:o-t+p),un+m&&(q=n+m-u+q-j);break;case"w":p=b[0]+e,q=b[1]-j/2,t+k>l&&(p=b[0]-k-e),un+m&&(q=n-j-5);break;case"n":p=b[0]-k/2-5,q=b[1]+e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),u+j>n+m&&(q=n+m-u+q-j);break;case"s":p=b[0]-k/2,q=b[1]-j-e;var t=s(h),u=r(h);tl&&(p=p-k/2+5),n>u&&(q=n)}h.style.left=p+"px",h.style.top=q+"px",h.style.opacity=1,h.style.position="absolute",h.style.pointerEvents="none";return h},b.cleanup=function(){var a=document.getElementsByClassName("nvtooltip"),b=[];while(a.length)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){while(b.length){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),a.utils.windowSize=function(){var a={width:640,height:480};document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),document.compatMode=="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight);return a},a.utils.windowResize=function(a){var b=window.onresize;window.onresize=function(c){typeof b=="function"&&b(c),a(c)}},a.utils.getColor=function(b){if(!arguments.length)return a.utils.defaultColor();return Object.prototype.toString.call(b)==="[object Array]"?function(a,c){return a.color||b[c%b.length]}:b},a.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},a.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);d||(d=c.length);return typeof a[g]!="undefined"?typeof a[g]=="function"?a[g]():a[g]:c[--d]}},a.utils.pjax=function(b,c){function d(d){d3.html(d,function(d){var e=d3.select(c).node();e.parentNode.replaceChild(d3.select(d).select(c).node(),e),a.utils.pjax(b,c)})}d3.selectAll(b).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},a.models.axis=function(){function o(d){d.each(function(d){var o=d3.select(this),p=o.selectAll("g.nv-wrap.nv-axis").data([d]),q=p.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),r=q.append("g"),s=p.select("g");m!==null?a.ticks(m):(a.orient()=="top"||a.orient()=="bottom")&&a.ticks(Math.abs(e.range()[1]-e.range()[0])/100),d3.transition(s).call(a),n=n||a.scale();var t=a.tickFormat();t==null&&(t=n.tickFormat());var u=s.selectAll("text.nv-axislabel").data([f||null]);u.exit().remove();switch(a.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",0);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+e(a)+",0)"}).select("text").attr("dy","0em").attr("y",-a.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+e.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(i%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(i*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor","middle").attr("y",x);var v=e.range().length==2?e.range()[1]:e.range()[e.range().length-1]+(e.range()[1]-e.range()[0]);u.attr("x",v/2);if(g){var w=p.selectAll("g.nv-axisMaxMin").data([e.domain()[0],e.domain()[e.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",a.tickPadding()).attr("transform",function(a,b,c){return"rotate("+i+" 0,0)"}).attr("text-anchor",i?i%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate("+(e(a)+(l?e.rangeBand()/2:0))+",0)"})}k&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"begin").attr("transform",j?"rotate(90)":"").attr("y",j?-Math.max(b.right,c)-12:-10),u.attr("x",j?e.range()[0]/2:a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+e(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",a.tickPadding()).attr("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":u.enter().append("text").attr("class","nv-axislabel").attr("text-anchor",j?"middle":"end").attr("transform",j?"rotate(-90)":"").attr("y",j?-Math.max(b.left,c)+12:-10),u.attr("x",j?-e.range()[0]/2:-a.tickPadding());if(g){var w=p.selectAll("g.nv-axisMaxMin").data(e.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+n(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-a.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),d3.transition(w).attr("transform",function(a,b){return"translate(0,"+e.range()[b]+")"}).select("text").style("opacity",1)}}u.text(function(a){return a}),g&&(a.orient()==="left"||a.orient()==="right")&&(s.selectAll("g").each(function(a,b){if(e(a)e.range()[0]-10)a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()}),e.domain()[0]==e.domain()[1]&&e.domain()[0]==0&&p.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1}));if(g&&(a.orient()==="top"||a.orient()==="bottom")){var B=[];p.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(e(a)-this.getBBox().width-4):B.push(e(a)+this.getBBox().width+4)}catch(c){b?B.push(e(a)-4):B.push(e(a)+4)}}),s.selectAll("g").each(function(a,b){if(e(a)B[1])a>1e-10||a<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove()})}h&&s.selectAll("line.tick").filter(function(a){return!parseFloat(Math.round(a*1e5)/1e6)}).classed("zero",!0),n=e.copy()});return o}var a=d3.svg.axis(),b={top:0,right:0,bottom:0,left:0},c=75,d=60,e=d3.scale.linear(),f=null,g=!0,h=!0,i=0,j=!0,k=!1,l=!1,m=null;a.scale(e).orient("bottom").tickFormat(function(a){return a});var n;o.axis=a,d3.rebind(o,a,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(o,e,"domain","range","rangeBand","rangeBands"),o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.ticks=function(a){if(!arguments.length)return m;m=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.axisLabel=function(a){if(!arguments.length)return f;f=a;return o},o.showMaxMin=function(a){if(!arguments.length)return g;g=a;return o},o.highlightZero=function(a){if(!arguments.length)return h;h=a;return o},o.scale=function(b){if(!arguments.length)return e;e=b,a.scale(e),l=typeof e.rangeBands=="function",d3.rebind(o,e,"domain","range","rangeBand","rangeBands");return o},o.rotateYLabel=function(a){if(!arguments.length)return j;j=a;return o},o.rotateLabels=function(a){if(!arguments.length)return i;i=a;return o},o.staggerLabels=function(a){if(!arguments.length)return k;k=a;return o};return o},a.models.historicalBar=function(){function q(a){a.each(function(a){var q=c-b.left-b.right,r=d-b.top-b.bottom,s=d3.select(this);f.domain(n||d3.extent(a[0].values.map(h).concat(j))).range([0,q]),g.domain(o||d3.extent(a[0].values.map(i).concat(k))).range([r,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var t=s.selectAll("g.nv-wrap.nv-bar").data([a[0].values]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bar"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-bars"),t.attr("transform","translate("+b.left+","+b.top+")"),s.on("click",function(a,b){p.chartClick({data:a,index:b,pos:d3.event,id:e})}),v.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),t.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",r),z.attr("clip-path",l?"url(#nv-chart-clip-path-"+e+")":"");var A=t.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a});A.exit().remove();var B=A.enter().append("rect").attr("x",0).attr("y",function(a,b){return g(Math.max(0,i(a,b)))}).attr("height",function(a,b){return Math.abs(g(i(a,b))-g(0))}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){p.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){p.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});A.attr("fill",function(a,b){return m(a,b)}).attr("class",function(a,b,c){return(i(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).attr("transform",function(b,c){return"translate("+(f(h(b,c))-q/a[0].values.length*.5)+",0)"}).attr("width",q/a[0].values.length*.9),d3.transition(A).attr("y",function(a,b){return i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)})});return q}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[],k=[0],l=!0,m=a.utils.defaultColor(),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");q.dispatch=p,q.x=function(a){if(!arguments.length)return h;h=a;return q},q.y=function(a){if(!arguments.length)return i;i=a;return q},q.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return q},q.width=function(a){if(!arguments.length)return c;c=a;return q},q.height=function(a){if(!arguments.length)return d;d=a;return q},q.xScale=function(a){if(!arguments.length)return f;f=a;return q},q.yScale=function(a){if(!arguments.length)return g;g=a;return q},q.xDomain=function(a){if(!arguments.length)return n;n=a;return q},q.yDomain=function(a){if(!arguments.length)return o;o=a;return q},q.forceX=function(a){if(!arguments.length)return j;j=a;return q},q.forceY=function(a){if(!arguments.length)return k;k=a;return q},q.clipEdge=function(a){if(!arguments.length)return l;l=a;return q},q.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return q},q.id=function(a){if(!arguments.length)return e;e=a;return q};return q},a.models.bullet=function(){function n(a){a.each(function(a,c){var h=i-b.left-b.right,k=j-b.top-b.bottom,n=d3.select(this),o=e.call(this,a,c).slice().sort(d3.descending),p=f.call(this,a,c).slice().sort(d3.descending),q=g.call(this,a,c).slice().sort(d3.descending),r=d3.scale.linear().domain([0,Math.max(o[0],p[0],q[0])]).range(d?[h,0]:[0,h]),s=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(r.range());this.__chart__=r;var t=n.selectAll("g.nv-wrap.nv-bullet").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),v=u.append("g"),w=t.select("g");t.attr("transform","translate("+b.left+","+b.top+")");var x=function(a){return Math.abs(s(a)-s(0))},y=function(a){return Math.abs(r(a)-r(0))},z=w.selectAll("rect.nv-range").data(o);z.enter().append("rect").attr("class",function(a,b){return"nv-range nv-s"+b}).attr("width",x).attr("height",k).attr("x",d?s:0).on("mouseover",function(a,b){m.elementMouseover({value:a,label:b<=0?"Maximum":b>1?"Minimum":"Mean",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:b<=0?"Minimum":b>=1?"Maximum":"Mean"})}),d3.transition(z).attr("x",d?r:0).attr("width",y).attr("height",k);var A=w.selectAll("rect.nv-measure").data(q);A.enter().append("rect").attr("class",function(a,b){return"nv-measure nv-s"+b}).style("fill",function(a,b){return l(a,b)}).attr("width",x).attr("height",k/3).attr("x",d?s:0).attr("y",k/3).on("mouseover",function(a){m.elementMouseover({value:a,label:"Current",pos:[r(a),k/2]})}).on("mouseout",function(a){m.elementMouseout({value:a,label:"Current"})}),d3.transition(A).attr("width",y).attr("height",k/3).attr("x",d?r:0).attr("y",k/3);var B=w.selectAll("path.nv-markerTriangle").data(p),C=k/6;B.enter().append("path").attr("class","nv-markerTriangle").attr("transform",function(a){return"translate("+s(a)+","+k/2+")"}).attr("d","M0,"+C+"L"+C+","+ -C+" "+ -C+","+ -C+"Z").on("mouseover",function(a,b){m.elementMouseover({value:a,label:"Previous",pos:[r(a),k/2]})}).on("mouseout",function(a,b){m.elementMouseout({value:a,label:"Previous"})}),d3.transition(B).attr("transform",function(a){return"translate("+r(a)+","+k/2+")"}),B.exit().remove()}),d3.timer.flush();return n}var b={top:0,right:0,bottom:0,left:0},c="left",d=!1,e=function(a){return a.ranges},f=function(a){return a.markers},g=function(a){return a.measures},h=[0],i=380,j=30,k=null,l=a.utils.getColor(["#1f77b4"]),m=d3.dispatch("elementMouseover","elementMouseout");n.dispatch=m,n.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return n},n.ranges=function(a){if(!arguments.length)return e;e=a;return n},n.markers=function(a){if(!arguments.length)return f;f=a;return n},n.measures=function(a){if(!arguments.length)return g;g=a;return n},n.forceX=function(a){if(!arguments.length)return h;h=a;return n},n.width=function(a){if(!arguments.length)return i;i=a;return n},n.height=function(a){if(!arguments.length)return j;j=a;return n},n.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return n},n.tickFormat=function(a){if(!arguments.length)return k;k=a;return n},n.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b);return n};return n},a.models.bulletChart=function(){function q(a){a.each(function(c,m){var r=d3.select(this),s=(i||parseInt(r.style("width"))||960)-e.left-e.right,t=j-e.top-e.bottom,u=this;q.update=function(){q(a)},q.container=this;if(!c||!f.call(this,c,m)){var v=r.selectAll(".nv-noData").data([n]);v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",e.left+s/2).attr("y",18+e.top+t/2).text(function(a){return a});return q}r.selectAll(".nv-noData").remove();var w=f.call(this,c,m).slice().sort(d3.descending),x=g.call(this,c,m).slice().sort(d3.descending),y=h.call(this,c,m).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([c]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+e.left+","+e.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(d?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,Infinity]).range(D.range());this.__chart__=D;var F=function(a){return Math.abs(E(a)-E(0))},G=function(a){return Math.abs(D(a)-D(0))},H=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(j-e.top-e.bottom)/2+")");H.append("text").attr("class","nv-title").text(function(a){return a.title}),H.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var I=C.select(".nv-bulletWrap");d3.transition(I).call(b);var J=k||D.tickFormat(s/100),K=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||J(a)}),L=K.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);L.append("line").attr("y1",t).attr("y2",t*7/6),L.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",t*7/6).text(J);var M=d3.transition(K).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);M.select("line").attr("y1",t).attr("y2",t*7/6),M.select("text").attr("y",t*7/6),d3.transition(K.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),o.on("tooltipShow",function(a){a.key=data[0].title,l&&p(a,u.parentNode)})}),d3.timer.flush();return q}var b=a.models.bullet(),c="left",d=!1,e={top:5,right:40,bottom:20,left:120},f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=null,j=55,k=null,l=!0,m=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide"),p=function(b,c){var d=b.pos[0]+(c.offsetLeft||0)+e.left,f=b.pos[1]+(c.offsetTop||0)+e.top,g=m(b.key,b.label,b.value,b,q);a.tooltip.show([d,f],g,b.value<0?"e":"w",null,c)};b.dispatch.on("elementMouseover.tooltip",function(a){o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),q.dispatch=o,q.bullet=b,d3.rebind(q,b,"color"),q.orient=function(a){if(!arguments.length)return c;c=a,d=c=="right"||c=="bottom";return q},q.ranges=function(a){if(!arguments.length)return f;f=a;return q},q.markers=function(a){if(!arguments.length)return g;g=a;return q},q.measures=function(a){if(!arguments.length)return h;h=a;return q},q.width=function(a){if(!arguments.length)return i;i=a;return q},q.height=function(a){if(!arguments.length)return j;j=a;return q},q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.tickFormat=function(a){if(!arguments.length)return k;k=a;return q},q.tooltips=function(a){if(!arguments.length)return l;l=a;return q},q.tooltipContent=function(a){if(!arguments.length)return m;m=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.cumulativeLineChart=function(){function y(a,c){return c.map(function(c,d){var e=b.y()(c.values[a],a);if(e<-0.95){c.tempDisabled=!0;return c}c.tempDisabled=!1,c.values=c.values.map(function(a,c){a.display={y:(b.y()(a,c)-e)/(1+e)};return a});return c})}function x(a){a.each(function(o){function R(){Q.data([v]),x.update()}function G(a,b){d3.select(x.container).style("cursor","auto")}function F(a,b){v.x=d3.event.x,v.i=Math.round(u.invert(v.x)),R()}function E(a,b){d3.select(x.container).style("cursor","ew-resize")}var z=d3.select(this).classed("nv-chart-"+r,!0),A=this,B=(i||parseInt(z.style("width"))||960)-g.left-g.right,C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom;x.update=function(){x(a)},x.container=this;var D=d3.behavior.drag().on("dragstart",E).on("drag",F).on("dragend",G);if(!o||!o.length||!o.filter(function(a){return a.values.length}).length){var H=z.selectAll(".nv-noData").data([s]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",g.left+B/2).attr("y",g.top+C/2).text(function(a){return a});return x}z.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();if(!n){var I=o.filter(function(a){return!a.disabled}).map(function(a,c){var d=d3.extent(a.values,b.y());d[0]<-0.95&&(d[0]=-0.95);return[(d[0]-d[1])/(1+d[1]),(d[1]-d[0])/(1+d[0])]}),J=[d3.min(I,function(a){return a[0]}),d3.max(I,function(a){return a[1]})];b.yDomain(J)}else b.yDomain(null);u.domain([0,o[0].values.length-1]).range([0,B]).clamp(!0);var o=y(v.i,o),K=z.selectAll("g.nv-wrap.nv-cumulativeLine").data([o]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),M=K.select("g");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-background"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-legendWrap"),L.append("g").attr("class","nv-controlsWrap"),k&&(e.width(B),M.select(".nv-legendWrap").datum(o).call(e),g.top!=e.height()&&(g.top=e.height(),C=(j||parseInt(z.style("height"))||400)-g.top-g.bottom),M.select(".nv-legendWrap").attr("transform","translate(0,"+ -g.top+")"));if(m){var N=[{key:"Re-scale y-axis",disabled:!n}];f.width(140).color(["#444","#444","#444"]),M.select(".nv-controlsWrap").datum(N).attr("transform","translate(0,"+ -g.top+")").call(f)}K.attr("transform","translate("+g.left+","+g.top+")");var O=o.filter(function(a){return a.tempDisabled});K.select(".tempDisabled").remove(),O.length&&K.append("text").attr("class","tempDisabled").attr("x",B/2).attr("y","-.71em").style("text-anchor","end").text(O.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),L.select(".nv-background").append("rect"),M.select(".nv-background rect").attr("width",B).attr("height",C),b.y(function(a){return a.display.y}).width(B).height(C).color(o.map(function(a,b){return a.color||h(a,b)}).filter(function(a,b){return!o[b].disabled&&!o[b].tempDisabled}));var P=M.select(".nv-linesWrap").datum(o.filter(function(a){return!a.disabled&&!a.tempDisabled}));P.call(b);var Q=P.selectAll(".nv-indexLine").data([v]);Q.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).call(D),Q.attr("transform",function(a){return"translate("+u(a.i)+",0)"}).attr("height",C),c.scale(p).tickSubdivide(o[0].values.length>d3.select("body").select("svg").select(".nv-x").selectAll(".tick")[0].length?!0:!1).ticks(Math.min(o[0].values.length,B/70)).tickSize(-C,0),M.select(".nv-x.nv-axis").attr("transform","translate(0,"+q.range()[0]+")"),d3.transition(M.select(".nv-x.nv-axis")).call(c),d.scale(q).ticks(C/36).tickSize(-B,0),d3.transition(M.select(".nv-y.nv-axis")).call(d),M.select(".nv-background rect").on("click",function(){v.x=d3.mouse(this)[0],v.i=Math.round(u.invert(v.x)),R()}),b.dispatch.on("elementClick",function(a){v.i=a.pointIndex,v.x=u(v.i),R()}),f.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,n=!b.disabled,a.call(x)}),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,o.filter(function(a){return!a.disabled}).length||o.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),a.call(x)}),t.on("tooltipShow",function(a){l&&w(a,A.parentNode)})});return x}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:30,bottom:50,left:60},h=a.utils.defaultColor(),i=null,j=null,k=!0,l=!0,m=!0,n=!0,o=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},p,q,r=b.id(),s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var u=d3.scale.linear(),v={i:0,x:0},w=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,x);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){l&&a.tooltip.cleanup()}),x.dispatch=t,x.lines=b,x.legend=e,x.xAxis=c,x.yAxis=d,d3.rebind(x,b,"defined","isArea","x","y","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),x.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return x},x.width=function(a){if(!arguments.length)return i;i=a;return x},x.height=function(a){if(!arguments.length)return j;j=a;return x},x.color=function(b){if(!arguments.length)return h;h=a.utils.getColor(b),e.color(h);return x},x.showControls=function(a){if(!arguments.length)return m;m=a;return x},x.showLegend=function(a){if(!arguments.length)return k;k=a;return x},x.tooltips=function(a){if(!arguments.length)return l;l=a;return x},x.tooltipContent=function(a){if(!arguments.length)return o;o=a;return x},x.noData=function(a){if(!arguments.length)return s;s=a;return x};return x},a.models.discreteBar=function(){function t(a){a.each(function(a){var e=c-b.left-b.right,t=d-b.top-b.bottom,u=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var v=n&&o?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(n||d3.merge(v).map(function(a){return a.x})).rangeBands([0,e],.1),g.domain(o||d3.extent(d3.merge(v).map(function(a){return a.y}).concat(j))),l?g.range([t-(g.domain()[0]<0?12:0),g.domain()[1]>0?12:0]):g.range([t,0]),r=r||f,s=s||g.copy().range([g(0),g(0)]);var w=u.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g"),B=w.select("g");A.append("g").attr("class","nv-groups"),w.attr("transform","translate("+b.left+","+b.top+")");var C=w.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});C.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(C.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),C.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(C).style("stroke-opacity",1).style("fill-opacity",.75);var D=C.selectAll("g.nv-bar").data(function(a){return a.values});D.exit().remove();var E=D.enter().append("g").attr("transform",function(a,b,c){return"translate("+(f(h(a,b))+f.rangeBand()*.05)+", "+g(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),p.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),p.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){p.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){p.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(b.series+.5)/a.length,g(i(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",f.rangeBand()*.9/a.length),l?(E.append("text").attr("text-anchor","middle"),D.select("text").attr("x",f.rangeBand()*.9/2).attr("y",function(a,b){return i(a,b)<0?g(i(a,b))-g(0)+12:-4}).text(function(a,b){return m(i(a,b))})):D.selectAll("text").remove(),D.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||k(a,b)}).style("stroke",function(a,b){return a.color||k(a,b)}).select("rect").attr("class",q).attr("width",f.rangeBand()*.9/a.length),d3.transition(D).attr("transform",function(a,b){var c=f(h(a,b))+f.rangeBand()*.05,d=i(a,b)<0?g(0):g(0)-g(i(a,b))<1?g(0)-1:g(i(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0))||1)}),r=f.copy(),s=g.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=d3.format(",.2f"),n,o,p=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),q="discreteBar",r,s;t.dispatch=p,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return f;f=a;return t},t.yScale=function(a){if(!arguments.length)return g;g=a;return t},t.xDomain=function(a){if(!arguments.length)return n +;n=a;return t},t.yDomain=function(a){if(!arguments.length)return o;o=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return e;e=a;return t},t.showValues=function(a){if(!arguments.length)return l;l=a;return t},t.valueFormat=function(a){if(!arguments.length)return m;m=a;return t},t.rectClass=function(a){if(!arguments.length)return q;q=a;return t};return t},a.models.discreteBarChart=function(){function q(a){a.each(function(h){var k=d3.select(this),r=this,s=(f||parseInt(k.style("width"))||960)-e.left-e.right,t=(g||parseInt(k.style("height"))||400)-e.top-e.bottom;q.update=function(){a.transition().call(q)},q.container=this;if(!h||!h.length||!h.filter(function(a){return a.values.length}).length){var u=k.selectAll(".nv-noData").data([n]);u.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),u.attr("x",e.left+s/2).attr("y",e.top+t/2).text(function(a){return a});return q}k.selectAll(".nv-noData").remove(),l=b.xScale(),m=b.yScale();var v=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([h]),w=v.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),z=w.append("defs"),A=v.select("g");w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis"),w.append("g").attr("class","nv-barsWrap"),A.attr("transform","translate("+e.left+","+e.top+")"),b.width(s).height(t);var B=A.select(".nv-barsWrap").datum(h.filter(function(a){return!a.disabled}));d3.transition(B).call(b),z.append("clipPath").attr("id","nv-x-label-clip-"+b.id()).append("rect"),A.select("#nv-x-label-clip-"+b.id()+" rect").attr("width",l.rangeBand()*(i?2:1)).attr("height",16).attr("x",-l.rangeBand()/(i?1:2)),c.scale(l).ticks(s/100).tickSize(-t,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+(m.range()[0]+(b.showValues()&&m.domain()[0]<0?16:0))+")"),A.select(".nv-x.nv-axis").transition().duration(0).call(c);var C=A.select(".nv-x.nv-axis").selectAll("g");i?C.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"}):C.selectAll("text").attr("transform","translate(0,5)"),d.scale(m).ticks(t/36).tickSize(-s,0),d3.transition(A.select(".nv-y.nv-axis")).call(d),o.on("tooltipShow",function(a){j&&p(a,r.parentNode)})});return q}var b=a.models.discreteBar(),c=a.models.axis(),d=a.models.axis(),e={top:15,right:10,bottom:50,left:60},f=null,g=null,h=a.utils.getColor(),i=!1,j=!0,k=function(a,b,c,d,e){return"

"+b+"

"+"

"+c+"

"},l,m,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var p=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),l=k(e.series.key,i,j,e,q);a.tooltip.show([g,h],l,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("tooltipHide",function(){j&&a.tooltip.cleanup()}),q.dispatch=o,q.discretebar=b,q.xAxis=c,q.yAxis=d,d3.rebind(q,b,"x","y","xDomain","yDomain","forceX","forceY","id","showValues","valueFormat"),q.margin=function(a){if(!arguments.length)return e;e.top=typeof a.top!="undefined"?a.top:e.top,e.right=typeof a.right!="undefined"?a.right:e.right,e.bottom=typeof a.bottom!="undefined"?a.bottom:e.bottom,e.left=typeof a.left!="undefined"?a.left:e.left;return q},q.width=function(a){if(!arguments.length)return f;f=a;return q},q.height=function(a){if(!arguments.length)return g;g=a;return q},q.color=function(c){if(!arguments.length)return h;h=a.utils.getColor(c),b.color(h);return q},q.staggerLabels=function(a){if(!arguments.length)return i;i=a;return q},q.tooltips=function(a){if(!arguments.length)return j;j=a;return q},q.tooltipContent=function(a){if(!arguments.length)return k;k=a;return q},q.noData=function(a){if(!arguments.length)return n;n=a;return q};return q},a.models.distribution=function(){function k(a){a.each(function(a){var i=c-(e==="x"?b.left+b.right:b.top+b.bottom),k=e=="x"?"y":"x",l=d3.select(this);j=j||h;var m=l.selectAll("g.nv-distribution").data([a]),n=m.enter().append("g").attr("class","nvd3 nv-distribution"),o=n.append("g"),p=m.select("g");m.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});q.enter().append("g"),q.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return g(a,b)});var r=q.selectAll("line.nv-dist"+e).data(function(a){return a.values});r.enter().append("line").attr(e+"1",function(a,b){return j(f(a,b))}).attr(e+"2",function(a,b){return j(f(a,b))}),d3.transition(q.exit().selectAll("line.nv-dist"+e)).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}).style("stroke-opacity",0).remove(),r.attr("class",function(a,b){return"nv-dist"+e+" nv-dist"+e+"-"+b}).attr(k+"1",0).attr(k+"2",d),d3.transition(r).attr(e+"1",function(a,b){return h(f(a,b))}).attr(e+"2",function(a,b){return h(f(a,b))}),j=h.copy()});return k}var b={top:0,right:0,bottom:0,left:0},c=400,d=8,e="x",f=function(a){return a[e]},g=a.utils.defaultColor(),h=d3.scale.linear(),i,j;k.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return k},k.width=function(a){if(!arguments.length)return c;c=a;return k},k.axis=function(a){if(!arguments.length)return e;e=a;return k},k.size=function(a){if(!arguments.length)return d;d=a;return k},k.getData=function(a){if(!arguments.length)return f;f=d3.functor(a);return k},k.scale=function(a){if(!arguments.length)return h;h=a;return k},k.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b);return k};return k},a.models.indentedTree=function(){function o(a){a.each(function(b){function C(a){var b=a.values||a._values;return b&&b.length}function B(a){return a._values&&a._values.length}function A(a){return a._values&&a._values.length?l:a.values&&a.values.length?m:""}function z(a,b,c){d3.event.stopPropagation();if(d3.event.shiftKey&&!c){d3.event.shiftKey=!1,a.values&&a.values.forEach(function(a){(a.values||a._values)&&z(a,0,!0)});return!0}if(!C(a))return!0;a.values?(a._values=a.values,a.values=null):(a.values=a._values,a._values=null),o.update()}var c=0,e=1,f=d3.layout.tree().children(function(a){return a.values}).size([d,i]);o.update=function(){a.transition().call(o)},o.container=this,b[0]||(b[0]={key:h});var p=f.nodes(b[0]),q=d3.select(this).selectAll("div").data([[p]]),r=q.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),s=r.append("table"),t=q.select("table").attr("width","100%").attr("class",k);if(g){var u=s.append("thead"),v=u.append("tr");j.forEach(function(a){v.append("th").attr("width",a.width?a.width:"10%").style("text-align",a.type=="numeric"?"right":"left").append("span").text(a.label)})}var w=t.selectAll("tbody").data(function(a){return a});w.enter().append("tbody"),e=d3.max(p,function(a){return a.depth}),f.size([d,e*i]);var x=w.selectAll("tr").data(function(a){return a},function(a){return a.id||a.id==++c});x.exit().remove(),x.select("img.nv-treeicon").attr("src",A).classed("folded",B);var y=x.enter().append("tr");j.forEach(function(a,b){var c=y.append("td").style("padding-left",function(a){return(b?0:a.depth*i+12+(A(a)?0:16))+"px"},"important").style("text-align",a.type=="numeric"?"right":"left");b==0&&c.append("img").classed("nv-treeicon",!0).classed("nv-folded",B).attr("src",A).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return A(a)?"inline-block":"none"}).on("click",z),c.append("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"}),a.showCount&&c.append("span").attr("class","nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.length||a._values&&a._values.length)+")":""}),a.click&&c.select("span").on("click",a.click)}),x.order().on("click",function(a){n.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){n.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){n.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){n.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})});return o}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e4),g=!0,h="No Data Available.",i=20,j=[{key:"key",label:"Name",type:"text"}],k=null,l="images/grey-plus.png",m="images/grey-minus.png",n=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout");o.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return o},o.width=function(a){if(!arguments.length)return c;c=a;return o},o.height=function(a){if(!arguments.length)return d;d=a;return o},o.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b),scatter.color(e);return o},o.id=function(a){if(!arguments.length)return f;f=a;return o},o.header=function(a){if(!arguments.length)return g;g=a;return o},o.noData=function(a){if(!arguments.length)return h;h=a;return o},o.columns=function(a){if(!arguments.length)return j;j=a;return o},o.tableClass=function(a){if(!arguments.length)return k;k=a;return o},o.iconOpen=function(a){if(!arguments.length)return l;l=a;return o},o.iconClose=function(a){if(!arguments.length)return m;m=a;return o};return o},a.models.legend=function(){function i(a){a.each(function(a){var i=c-b.left-b.right,j=d3.select(this),l=j.selectAll("g.nv-legend").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-legend").append("g"),n=l.select("g");l.attr("transform","translate("+b.left+","+b.top+")");var o=n.selectAll(".nv-series").data(function(a){return a}),p=o.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){h.legendMouseover(a,b)}).on("mouseout",function(a,b){h.legendMouseout(a,b)}).on("click",function(a,b){h.legendClick(a,b)}).on("dblclick",function(a,b){h.legendDblclick(a,b)});p.append("circle").style("stroke-width",2).attr("r",5),p.append("text").attr("text-anchor","start").attr("dy",".32em").attr("dx","8"),o.classed("disabled",function(a){return a.disabled}),o.exit().remove(),o.select("circle").style("fill",function(a,b){return a.color||f(a,b)}).style("stroke",function(a,b){return a.color||f(a,b)}),o.select("text").text(e);if(g){var q=[];o.each(function(a,b){q.push(d3.select(this).select("text").node().getComputedTextLength()+28)});var r=0,s=0,t=[];while(si&&r>1){t=[],r--;for(k=0;k(t[k%r]||0)&&(t[k%r]=q[k]);s=t.reduce(function(a,b,c,d){return a+b})}var u=[];for(var v=0,w=0;vz&&(z=y);return"translate("+A+","+x+")"}),n.attr("transform","translate("+(c-b.right-z)+","+b.top+")"),d=b.top+b.bottom+x+15}});return i}var b={top:5,right:0,bottom:5,left:0},c=400,d=20,e=function(a){return a.key},f=a.utils.defaultColor(),g=!0,h=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout");i.dispatch=h,i.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return i},i.width=function(a){if(!arguments.length)return c;c=a;return i},i.height=function(a){if(!arguments.length)return d;d=a;return i},i.key=function(a){if(!arguments.length)return e;e=a;return i},i.color=function(b){if(!arguments.length)return f;f=a.utils.getColor(b);return i},i.align=function(a){if(!arguments.length)return g;g=a;return i};return i},a.models.line=function(){function q(a){a.each(function(a){var q=d-c.left-c.right,r=e-c.top-c.bottom,s=d3.select(this);l=b.xScale(),m=b.yScale(),o=o||l,p=p||m;var t=s.selectAll("g.nv-wrap.nv-line").data([a]),u=t.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),v=u.append("defs"),w=u.append("g"),z=t.select("g");w.append("g").attr("class","nv-groups"),w.append("g").attr("class","nv-scatterWrap"),t.attr("transform","translate("+c.left+","+c.top+")"),b.width(q).height(r);var A=t.select(".nv-scatterWrap");d3.transition(A).call(b),v.append("clipPath").attr("id","nv-edge-clip-"+b.id()).append("rect"),t.select("#nv-edge-clip-"+b.id()+" rect").attr("width",q).attr("height",r),z.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":""),A.attr("clip-path",k?"url(#nv-edge-clip-"+b.id()+")":"");var B=t.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(B.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return f(a,b)}).style("stroke",function(a,b){return f(a,b)}),d3.transition(B).style("stroke-opacity",1).style("fill-opacity",.5);var C=B.selectAll("path.nv-area").data(function(a){return j(a)?[a]:[]});C.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(B.exit().selectAll("path.nv-area")).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])}),d3.transition(C).attr("d",function(a){return d3.svg.area().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y0(function(a,b){return p(h(a,b))}).y1(function(a,b){return p(m.domain()[0]<=0?m.domain()[1]>=0?0:m.domain()[1]:m.domain()[0])}).apply(this,[a.values])});var D=B.selectAll("path.nv-line").data(function(a){return[a.values]});D.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return o(g(a,b))}).y(function(a,b){return p(h(a,b))})),d3.transition(B.exit().selectAll("path.nv-line")).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),d3.transition(D).attr("d",d3.svg.line().interpolate(n).defined(i).x(function(a,b){return l(g(a,b))}).y(function(a,b){return m(h(a,b))})),o=l.copy(),p=m.copy()});return q}var b=a.models.scatter(),c={top:0,right:0,bottom:0,left:0},d=960,e=500,f=a.utils.defaultColor(),g=function(a){return a.x},h=function(a){return a.y},i=function(a,b){return!isNaN(h(a,b))&&h(a,b)!==null},j=function(a){return a.area},k=!1,l,m,n="linear";b.size(16).sizeDomain([16,256]);var o,p;q.dispatch=b.dispatch,q.scatter=b,d3.rebind(q,b,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","forceX","forceY","forceSize","clipVoronoi","clipRadius"),q.margin=function(a){if(!arguments.length)return c;c.top=typeof a.top!="undefined"?a.top:c.top,c.right=typeof a.right!="undefined"?a.right:c.right,c.bottom=typeof a.bottom!="undefined"?a.bottom:c.bottom,c.left=typeof a.left!="undefined"?a.left:c.left;return q},q.width=function(a){if(!arguments.length)return d;d=a;return q},q.height=function(a){if(!arguments.length)return e;e=a;return q},q.x=function(a){if(!arguments.length)return g;g=a,b.x(a);return q},q.y=function(a){if(!arguments.length)return h;h=a,b.y(a);return q},q.clipEdge=function(a){if(!arguments.length)return k;k=a;return q},q.color=function(c){if(!arguments.length)return f;f=a.utils.getColor(c),b.color(f);return q},q.interpolate=function(a){if(!arguments.length)return n;n=a;return q},q.defined=function(a){if(!arguments.length)return i;i=a;return q},q.isArea=function(a){if(!arguments.length)return j;j=d3.functor(a);return q};return q},a.models.lineChart=function(){function r(a){a.each(function(l){var s=d3.select(this),t=this,u=(h||parseInt(s.style("width"))||960)-f.left-f.right,v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom;r.update=function(){r(a)},r.container=this;if(!l||!l.length||!l.filter(function(a){return a.values.length}).length){var w=s.selectAll(".nv-noData").data([o]);w.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),w.attr("x",f.left+u/2).attr("y",f.top+v/2).text(function(a){return a});return r}s.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale();var z=s.selectAll("g.nv-wrap.nv-lineChart").data([l]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),B=z.select("g");A.append("g").attr("class","nv-x nv-axis"),A.append("g").attr("class","nv-y nv-axis"),A.append("g").attr("class","nv-linesWrap"),A.append("g").attr("class","nv-legendWrap"),j&&(e.width(u),B.select(".nv-legendWrap").datum(l).call(e),f.top!=e.height()&&(f.top=e.height(),v=(i||parseInt(s.style("height"))||400)-f.top-f.bottom),z.select(".nv-legendWrap").attr("transform","translate(0,"+ -f.top+")")),z.attr("transform","translate("+f.left+","+f.top+")"),b.width(u).height(v).color(l.map(function(a,b){return a.color||g(a,b)}).filter(function(a,b){return!l[b].disabled}));var C=B.select(".nv-linesWrap").datum(l.filter(function(a){return!a.disabled}));d3.transition(C).call(b),c.scale(m).ticks(u/100).tickSize(-v,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(B.select(".nv-x.nv-axis")).call(c),d.scale(n).ticks(v/36).tickSize(-u,0),d3.transition(B.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,l.filter(function(a){return!a.disabled}).length||l.map(function(a){a.disabled=!1,z.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(r)}),p.on("tooltipShow",function(a){k&&q(a,t.parentNode)})});return r}var b=a.models.line(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f={top:30,right:20,bottom:50,left:60},g=a.utils.defaultColor(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},m,n,o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left");var q=function(e,f){if(f){var g=d3.select(f).select("svg"),h=g.attr("viewBox");if(h){h=h.split(" ");var i=parseInt(g.style("width"))/h[2];e.pos[0]=e.pos[0]*i,e.pos[1]=e.pos[1]*i}}var j=e.pos[0]+(f.offsetLeft||0),k=e.pos[1]+(f.offsetTop||0),m=c.tickFormat()(b.x()(e.point,e.pointIndex)),n=d.tickFormat()(b.y()(e.point,e.pointIndex)),o=l(e.series.key,m,n,e,r);a.tooltip.show([j,k],o,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){k&&a.tooltip.cleanup()}),r.dispatch=p,r.lines=b,r.legend=e,r.xAxis=c,r.yAxis=d,d3.rebind(r,b,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate"),r.margin=function(a){if(!arguments.length)return f;f.top=typeof a.top!="undefined"?a.top:f.top,f.right=typeof a.right!="undefined"?a.right:f.right,f.bottom=typeof a.bottom!="undefined"?a.bottom:f.bottom,f.left=typeof a.left!="undefined"?a.left:f.left;return r},r.width=function(a){if(!arguments.length)return h;h=a;return r},r.height=function(a){if(!arguments.length)return i;i=a;return r},r.color=function(b){if(!arguments.length)return g;g=a.utils.getColor(b),e.color(g);return r},r.showLegend=function(a){if(!arguments.length)return j;j=a;return r},r.tooltips=function(a){if(!arguments.length)return k;k=a;return r},r.tooltipContent=function(a){if(!arguments.length)return l;l=a;return r},r.noData=function(a){if(!arguments.length)return o;o=a;return r};return r},a.models.linePlusBarChart=function(){function w(a){a.each(function(k){var l=d3.select(this),p=this,y=(i||parseInt(l.style("width"))||960)-h.left-h.right,z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom;w.update=function(){w(a)},w.container=this;if(!k||!k.length||!k.filter(function(a){return a.values.length}).length){var A=l.selectAll(".nv-noData").data([t]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",h.left+y/2).attr("y",h.top+z/2).text(function(a){return a});return w}l.selectAll(".nv-noData").remove(),q=b.xScale(),r=c.yScale(),s=b.yScale();var B=k.filter(function(a){return!a.disabled&&a.bar}),C=k.filter(function(a){return!a.bar}),D=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([k]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y1 nv-axis"),E.append("g").attr("class","nv-y2 nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-linesWrap"),E.append("g").attr("class","nv-legendWrap"),n&&(g.width(y/2),F.select(".nv-legendWrap").datum(k.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)");return a})).call(g),h.top!=g.height()&&(h.top=g.height(),z=(j||parseInt(l.style("height"))||400)-h.top-h.bottom),F.select(".nv-legendWrap").attr("transform","translate("+y/2+","+ -h.top+")")),D.attr("transform","translate("+h.left+","+h.top+")"),b.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&!k[b].bar})),c.width(y).height(z).color(k.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!k[b].disabled&&k[b].bar}));var G=F.select(".nv-barsWrap").datum(B.length?B:[{values:[]}]),H=F.select(".nv-linesWrap").datum(C[0].disabled?[{values:[]}]:C);d3.transition(G).call(c),d3.transition(H).call(b),d.scale(q).ticks(y/100).tickSize(-z,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(d),e.scale(r).ticks(z/36).tickSize(-y,0),d3.transition(F.select(".nv-y1.nv-axis")).style("opacity",B.length?1:0).call(e),f.scale(s).ticks(z/36).tickSize(B.length?0:-y,0),F.select(".nv-y2.nv-axis").style("opacity",C.length?1:0).attr("transform","translate("+q.range()[1]+",0)"),d3.transition(F.select(".nv-y2.nv-axis")).call(f),g.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,k.filter(function(a){return!a.disabled}).length||k.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(w)}),u.on("tooltipShow",function(a){o&&v(a,p.parentNode)})});return w}var b=a.models.line(),c=a.models.historicalBar(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.legend(),h={top:30,right:60,bottom:50,left:60},i=null,j=null,k=function(a){return a.x},l=function(a){return a.y},m=a.utils.defaultColor(),n=!0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},q,r,s,t="No Data Available.",u=d3.dispatch("tooltipShow","tooltipHide");b.clipEdge(!1),d.orient("bottom").tickPadding(7),e.orient("left"),f.orient("right");var v=function(c,g){var h=c.pos[0]+(g.offsetLeft||0),i=c.pos[1]+(g.offsetTop||0),j=d.tickFormat()(b.x()(c.point,c.pointIndex)),k=(c.series.bar?e:f).tickFormat()(b.y()(c.point,c.pointIndex)),l=p(c.series.key,j,k,c,w);a.tooltip.show([h,i],l,c.value<0?"n":"s",null,g)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),c.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],u.tooltipShow(a)}),c.dispatch.on("elementMouseout.tooltip",function(a){u.tooltipHide(a)}),u.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),w.dispatch=u,w.legend=g,w.lines=b,w.bars=c,w.xAxis=d,w.y1Axis=e,w.y2Axis=f,d3.rebind(w,b,"defined","size","clipVoronoi","interpolate"),w.x=function(a){if(!arguments.length)return k;k=a,b.x(a),c.x(a);return w},w.y=function(a){if(!arguments.length)return l;l=a,b.y(a),c.y(a);return w},w.margin=function(a){if(!arguments.length)return h;h.top=typeof a.top!="undefined"?a.top:h.top,h.right=typeof a.right!="undefined"?a.right:h.right,h.bottom=typeof a.bottom!="undefined"?a.bottom:h.bottom,h.left=typeof a.left!="undefined"?a.left:h.left;return w},w.width=function(a){if(!arguments.length)return i;i=a;return w},w.height=function(a){if(!arguments.length)return j;j=a;return w},w.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b),g.color(m);return w},w.showLegend=function(a){if(!arguments.length)return n;n=a;return w},w.tooltips=function(a){if(!arguments.length)return o;o=a;return w},w.tooltipContent=function(a){if(!arguments.length)return p;p=a;return w},w.noData=function(a){if(!arguments.length)return t;t=a;return w};return w},a.models.lineWithFocusChart=function(){function A(a){a.each(function(w){function R(){u=i.empty()?null:i.extent(),extent=i.empty()?r.domain():i.extent(),y.brush({extent:extent,brush:i}),Q();var a=J.select(".nv-focus .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}).map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return b.x()(a,c)>=extent[0]&&b.x()(a,c)<=extent[1]})}}));d3.transition(a).call(b),d3.transition(J.select(".nv-focus .nv-x.nv-axis")).call(d),d3.transition(J.select(".nv-focus .nv-y.nv-axis")).call(e)}function Q(){i.empty()||i.extent(u),N.data([i.empty()?r.domain():u]).each(function(a,b){var c=r(a[0])-p.range()[0],d=p.range()[1]-r(a[1]);d3.select(this).select(".left").attr("width",c<0?0:c),d3.select(this).select(".right").attr("x",r(a[1])).attr("width",d<0?0:d)})}function P(a){var b=+(a=="e"),c=b?1:-1,d=F/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"Z"+"M"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}var B=d3.select(this),C=this,D=(m||parseInt(B.style("width"))||960)-j.left-j.right,E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o,F=o-k.top-k.bottom;A.update=function(){A(a)},A.container=this;if(!w||!w.length||!w.filter(function(a){return a.values.length}).length){var G=B.selectAll(".nv-noData").data([x]);G.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),G.attr("x",j.left+D/2).attr("y",j.top+E/2).text(function(a){return a});return A}B.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale(),r=c.xScale(),s=c.yScale();var H=B.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([w]),I=H.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),J=H.select("g");I.append("g").attr("class","nv-legendWrap");var K=I.append("g").attr("class","nv-focus");K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-linesWrap");var L=I.append("g").attr("class","nv-context");L.append("g").attr("class","nv-x nv-axis"),L.append("g").attr("class","nv-y nv-axis"),L.append("g").attr("class","nv-linesWrap"),L.append("g").attr("class","nv-brushBackground"),L.append("g").attr("class","nv-x nv-brush"),t&&(h.width(D),J.select(".nv-legendWrap").datum(w).call(h),j.top!=h.height()&&(j.top=h.height(),E=(n||parseInt(B.style("height"))||400)-j.top-j.bottom-o),J.select(".nv-legendWrap").attr("transform","translate(0,"+ -j.top+")")),H.attr("transform","translate("+j.left+","+j.top+")"),b.width(D).height(E).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),c.defined(b.defined()).width(D).height(F).color(w.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!w[b].disabled})),J.select(".nv-context").attr("transform","translate(0,"+(E+j.bottom+k.top)+")");var M=J.select(".nv-context .nv-linesWrap").datum(w.filter(function(a){return!a.disabled}));d3.transition(M).call(c),d.scale(p).ticks(D/100).tickSize(-E,0),e.scale(q).ticks(E/36).tickSize(-D,0),J.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+E+")"),i.x(r).on("brush",R),u&&i.extent(u);var N=J.select(".nv-brushBackground").selectAll("g").data([u||i.extent()]),O=N.enter().append("g");O.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",F),O.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",F),gBrush=J.select(".nv-x.nv-brush").call(i),gBrush.selectAll("rect").attr("height",F),gBrush.selectAll(".resize").append("path").attr("d",P),R(),f.scale(r).ticks(D/100).tickSize(-F,0),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),d3.transition(J.select(".nv-context .nv-x.nv-axis")).call(f),g.scale(s).ticks(F/36).tickSize(-D,0),d3.transition(J.select(".nv-context .nv-y.nv-axis")).call(g),J.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+s.range()[0]+")"),h.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w.filter(function(a){return!a.disabled}).length||w.map(function(a){a.disabled=!1,H.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(A)}),y.on("tooltipShow",function(a){v&&z(a,C.parentNode)})});return A}var b=a.models.line(),c=a.models.line(),d=a.models.axis(),e=a.models.axis(),f=a.models.axis(),g=a.models.axis(),h=a.models.legend(),i=d3.svg.brush(),j={top:30,right:30,bottom:30,left:60},k={top:0,right:30,bottom:20,left:60},l=a.utils.defaultColor(),m=null,n=null,o=100,p,q,r,s,t=!0,u=null,v=!0,w=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},x="No Data Available.",y=d3.dispatch("tooltipShow","tooltipHide","brush");b.clipEdge(!0),c.interactive(!1),d.orient("bottom").tickPadding(5),e.orient("left"),f.orient("bottom").tickPadding(5),g.orient("left");var z=function(c,f){var g=c.pos[0]+(f.offsetLeft||0),h=c.pos[1]+(f.offsetTop||0),i=d.tickFormat()(b.x()(c.point,c.pointIndex)),j=e.tickFormat()(b.y()(c.point,c.pointIndex)),k=w(c.series.key,i,j,c,A);a.tooltip.show([g,h],k,null,null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],y.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){v&&a.tooltip.cleanup()}),A.dispatch=y,A.legend=h,A.lines=b,A.lines2=c,A.xAxis=d,A.yAxis=e,A.x2Axis=f,A.y2Axis=g,d3.rebind(A,b,"defined","isArea","size","xDomain","yDomain","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),A.x=function(a){if(!arguments.length)return b.x;b.x(a),c.x(a);return A},A.y=function(a){if(!arguments.length)return b.y;b.y(a),c.y(a);return A},A.margin=function(a){if(!arguments.length)return j;j.top=typeof a.top!="undefined"?a.top:j.top,j.right=typeof a.right!="undefined"?a.right:j.right,j.bottom=typeof a.bottom!="undefined"?a.bottom:j.bottom,j.left=typeof a.left!="undefined"?a.left:j.left;return A},A.margin2=function(a){if(!arguments.length)return k;k=a;return A},A.width=function(a){if(!arguments.length)return m;m=a;return A},A.height=function(a){if(!arguments.length)return n;n=a;return A},A.height2=function(a){if(!arguments.length)return o;o=a;return A},A.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),h.color(l);return A},A.showLegend=function(a){if(!arguments.length)return t;t=a;return A},A.tooltips=function(a){if(!arguments.length)return v;v=a;return A},A.tooltipContent=function(a){if(!arguments.length)return w;w=a;return A},A.interpolate=function(a){if(!arguments.length)return b.interpolate();b.interpolate(a),c.interpolate(a);return A},A.noData=function(a){if(!arguments.length)return x;x=a;return A},A.xTickFormat=function(a){if(!arguments.length)return d.tickFormat();d.tickFormat(a),f.tickFormat(a);return A},A.yTickFormat=function(a){if(!arguments.length)return e.tickFormat();e.tickFormat(a),g.tickFormat(a);return A};return A},a.models. +multiBar=function(){function t(a){a.each(function(a){var t=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=o&&p?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});e.domain(d3.merge(w).map(function(a){return a.x})).rangeBands([0,t],.1),f.domain(p||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))).range([u,0]);if(e.domain()[0]===e.domain()[1]||f.domain()[0]===f.domain()[1])singlePoint=!0;e.domain()[0]===e.domain()[1]&&(e.domain()[0]?e.domain([e.domain()[0]-e.domain()[0]*.01,e.domain()[1]+e.domain()[1]*.01]):e.domain([-1,1])),f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]+f.domain()[0]*.01,f.domain()[1]-f.domain()[1]*.01]):f.domain([-1,1])),r=r||e,s=s||f;var z=v.selectAll("g.nv-wrap.nv-multibar").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")"),B.append("clipPath").attr("id","nv-edge-clip-"+g).append("rect"),z.select("#nv-edge-clip-"+g+" rect").attr("width",t).attr("height",u),D.attr("clip-path",k?"url(#nv-edge-clip-"+g+")":"");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).selectAll("rect.nv-bar").delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a){return l?s(a.y0):s(0)}).attr("height",0).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return m(a,b)}).style("stroke",function(a,b){return m(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("rect.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("rect").attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return l?0:d*e.rangeBand()/a.length}).attr("y",function(a){return s(l?a.y0:0)}).attr("height",0).attr("width",e.rangeBand()/(l?1:a.length));F.style("fill",function(a,b,c){return m(a,c,b)}).style("stroke",function(a,b,c){return m(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),q.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),q.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){q.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){q.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[e(h(b,c))+e.rangeBand()*(l?a.length/2:b.series+.5)/a.length,f(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(a,b){return"translate("+e(h(a,b))+",0)"}),l?d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("y",function(a,b){return f(i(a,b)+(l?a.y0:0))}).attr("height",function(a,b){return Math.max(Math.abs(f(a.y+(l?a.y0:0))-f(l?a.y0:0)),1)}).each("end",function(){d3.transition(d3.select(this)).attr("x",function(b,c){return l?0:b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/(l?1:a.length))}):d3.transition(F).delay(function(b,c){return c*n/a[0].values.length}).attr("x",function(b,c){return b.series*e.rangeBand()/a.length}).attr("width",e.rangeBand()/a.length).each("end",function(){d3.transition(d3.select(this)).attr("y",function(a,b){return i(a,b)<0?f(0):f(0)-f(i(a,b))<1?f(0)-1:f(i(a,b))}).attr("height",function(a,b){return Math.max(Math.abs(f(i(a,b))-f(0)),1)})}),r=e.copy(),s=f.copy()});return t}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=d3.scale.ordinal(),f=d3.scale.linear(),g=Math.floor(Math.random()*1e4),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=!0,l=!1,m=a.utils.defaultColor(),n=1200,o,p,q=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),r,s;t.dispatch=q,t.x=function(a){if(!arguments.length)return h;h=a;return t},t.y=function(a){if(!arguments.length)return i;i=a;return t},t.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return t},t.width=function(a){if(!arguments.length)return c;c=a;return t},t.height=function(a){if(!arguments.length)return d;d=a;return t},t.xScale=function(a){if(!arguments.length)return e;e=a;return t},t.yScale=function(a){if(!arguments.length)return f;f=a;return t},t.xDomain=function(a){if(!arguments.length)return o;o=a;return t},t.yDomain=function(a){if(!arguments.length)return p;p=a;return t},t.forceY=function(a){if(!arguments.length)return j;j=a;return t},t.stacked=function(a){if(!arguments.length)return l;l=a;return t},t.clipEdge=function(a){if(!arguments.length)return k;k=a;return t},t.color=function(b){if(!arguments.length)return m;m=a.utils.getColor(b);return t},t.id=function(a){if(!arguments.length)return g;g=a;return t},t.delay=function(a){if(!arguments.length)return n;n=a;return t};return t},a.models.multiBarChart=function(){function v(a){a.each(function(p){var w=d3.select(this),z=this,A=(h||parseInt(w.style("width"))||960)-g.left-g.right,B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom;v.update=function(){a.transition().call(v)},v.container=this;if(!p||!p.length||!p.filter(function(a){return a.values.length}).length){var C=w.selectAll(".nv-noData").data([s]);C.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),C.attr("x",g.left+A/2).attr("y",g.top+B/2).text(function(a){return a});return v}w.selectAll(".nv-noData").remove(),q=b.xScale(),r=b.yScale();var D=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([p]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),F=D.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-controlsWrap"),l&&(e.width(A/2),F.select(".nv-legendWrap").datum(p).call(e),g.top!=e.height()&&(g.top=e.height(),B=(i||parseInt(w.style("height"))||400)-g.top-g.bottom),F.select(".nv-legendWrap").attr("transform","translate("+A/2+","+ -g.top+")"));if(k){var G=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),F.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+ -g.top+")").call(f)}D.attr("transform","translate("+g.left+","+g.top+")"),b.width(A).height(B).color(p.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!p[b].disabled}));var H=F.select(".nv-barsWrap").datum(p.filter(function(a){return!a.disabled}));d3.transition(H).call(b),c.scale(q).ticks(A/100).tickSize(-B,0),F.select(".nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),d3.transition(F.select(".nv-x.nv-axis")).call(c);var I=F.select(".nv-x.nv-axis > g").selectAll("g");I.selectAll("line, text").style("opacity",1),m&&I.filter(function(a,b){return b%Math.ceil(p[0].values.length/(A/100))!==0}).selectAll("text, line").style("opacity",0),n&&I.selectAll("text").attr("transform",function(a,b,c){return"rotate("+n+" 0,0)"}).attr("text-transform",n>0?"start":"end"),F.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1),d.scale(r).ticks(B/36).tickSize(-A,0),d3.transition(F.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,p.filter(function(a){return!a.disabled}).length||p.map(function(a){a.disabled=!1,D.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(v)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){G=G.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(v)}}),t.on("tooltipShow",function(a){o&&u(a,z.parentNode)})});return v}var b=a.models.multiBar(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g={top:30,right:20,bottom:30,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!0,n=0,o=!0,p=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" on "+b+"

"},q,r,s="No Data Available.",t=d3.dispatch("tooltipShow","tooltipHide");b.stacked(!1),c.orient("bottom").tickPadding(7).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("left").tickFormat(d3.format(",.1f"));var u=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=p(e.series.key,i,j,e,v);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],t.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){t.tooltipHide(a)}),t.on("tooltipHide",function(){o&&a.tooltip.cleanup()}),v.dispatch=t,v.multibar=b,v.legend=e,v.xAxis=c,v.yAxis=d,d3.rebind(v,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","stacked","delay"),v.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return v},v.width=function(a){if(!arguments.length)return h;h=a;return v},v.height=function(a){if(!arguments.length)return i;i=a;return v},v.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return v},v.showControls=function(a){if(!arguments.length)return k;k=a;return v},v.showLegend=function(a){if(!arguments.length)return l;l=a;return v},v.reduceXTicks=function(a){if(!arguments.length)return m;m=a;return v},v.rotateLabels=function(a){if(!arguments.length)return n;n=a;return v},v.tooltip=function(a){if(!arguments.length)return p;p=a;return v},v.tooltips=function(a){if(!arguments.length)return o;o=a;return v},v.tooltipContent=function(a){if(!arguments.length)return p;p=a;return v},v.noData=function(a){if(!arguments.length)return s;s=a;return v};return v},a.models.multiBarHorizontal=function(){function v(a){a.each(function(a){var e=c-b.left-b.right,p=d-b.top-b.bottom,v=d3.select(this);l&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(i)(a)),a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var w=q&&r?[]:a.map(function(a){return a.values.map(function(a,b){return{x:h(a,b),y:i(a,b),y0:a.y0}})});f.domain(q||d3.merge(w).map(function(a){return a.x})).rangeBands([0,p],.1),g.domain(r||d3.extent(d3.merge(w).map(function(a){return a.y+(l?a.y0:0)}).concat(j))),m&&!l?g.range([g.domain()[0]<0?n:0,e-(g.domain()[1]>0?n:0)]):g.range([0,e]),t=t||f,u=u||d3.scale.linear().domain(g.domain()).range([g(0),g(0)]);var z=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-groups"),z.attr("transform","translate("+b.left+","+b.top+")");var E=z.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(E.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return k(a,b)}).style("stroke",function(a,b){return k(a,b)}),d3.transition(E).style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+u(l?b.y0:0)+","+(l?0:d*f.rangeBand()/a.length+f(h(b,c)))+")"});G.append("rect").attr("width",0).attr("height",f.rangeBand()/(l?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),s.elementMouseover({value:i(b,c),point:b,series:a[b.series],pos:[g(i(b,c)+(l?b.y0:0)),f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),s.elementMouseout({value:i(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){s.elementClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){s.elementDblClick({value:i(b,c),point:b,series:a[b.series],pos:[f(h(b,c))+f.rangeBand()*(l?a.length/2:b.series+.5)/a.length,g(i(b,c)+(l?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),m&&!l?(G.append("text").attr("text-anchor",function(a,b){return i(a,b)<0?"end":"start"}),F.select("text").attr("y",f.rangeBand()/2).attr("dy","-.32em").text(function(a,b){return o(i(a,b))}),d3.transition(F).select("text").attr("x",function(a,b){return i(a,b)<0?-4:g(i(a,b))-g(0)+4})):F.selectAll("text").remove(),F.attr("class",function(a,b){return i(a,b)<0?"nv-bar negative":"nv-bar positive"}),l?d3.transition(F).attr("transform",function(a,b){return"translate("+g(a.y0)+","+f(h(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(g(i(a,b)+a.y0)-g(a.y0))}).attr("height",f.rangeBand()):d3.transition(F).attr("transform",function(b,c){return"translate("+(i(b,c)<0?g(i(b,c)):g(0))+","+(b.series*f.rangeBand()/a.length+f(h(b,c)))+")"}).select("rect").attr("height",f.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(g(i(a,b))-g(0)),1)}),t=f.copy(),u=g.copy()});return v}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.ordinal(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=[0],k=a.utils.defaultColor(),l=!1,m=!1,n=60,o=d3.format(",.2f"),p=1200,q,r,s=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),t,u;v.dispatch=s,v.x=function(a){if(!arguments.length)return h;h=a;return v},v.y=function(a){if(!arguments.length)return i;i=a;return v},v.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return v},v.width=function(a){if(!arguments.length)return c;c=a;return v},v.height=function(a){if(!arguments.length)return d;d=a;return v},v.xScale=function(a){if(!arguments.length)return f;f=a;return v},v.yScale=function(a){if(!arguments.length)return g;g=a;return v},v.xDomain=function(a){if(!arguments.length)return q;q=a;return v},v.yDomain=function(a){if(!arguments.length)return r;r=a;return v},v.forceY=function(a){if(!arguments.length)return j;j=a;return v},v.stacked=function(a){if(!arguments.length)return l;l=a;return v},v.color=function(b){if(!arguments.length)return k;k=a.utils.getColor(b);return v},v.id=function(a){if(!arguments.length)return e;e=a;return v},v.delay=function(a){if(!arguments.length)return p;p=a;return v},v.showValues=function(a){if(!arguments.length)return m;m=a;return v},v.valueFormat=function(a){if(!arguments.length)return o;o=a;return v},v.valuePadding=function(a){if(!arguments.length)return n;n=a;return v};return v},a.models.multiBarHorizontalChart=function(){function u(a){a.each(function(m){var o=d3.select(this),v=this,w=(h||parseInt(o.style("width"))||960)-g.left-g.right,z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom;u.update=function(){a.transition().call(u)},u.container=this;if(!m||!m.length||!m.filter(function(a){return a.values.length}).length){var A=o.selectAll(".nv-noData").data([r]);A.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),A.attr("x",g.left+w/2).attr("y",g.top+z/2).text(function(a){return a});return u}o.selectAll(".nv-noData").remove(),p=b.xScale(),q=b.yScale();var B=o.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([m]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),D=B.select("g");C.append("g").attr("class","nv-x nv-axis"),C.append("g").attr("class","nv-y nv-axis"),C.append("g").attr("class","nv-barsWrap"),C.append("g").attr("class","nv-legendWrap"),C.append("g").attr("class","nv-controlsWrap"),l&&(e.width(w/2),D.select(".nv-legendWrap").datum(m).call(e),g.top!=e.height()&&(g.top=e.height(),z=(i||parseInt(o.style("height"))||400)-g.top-g.bottom),D.select(".nv-legendWrap").attr("transform","translate("+w/2+","+ -g.top+")"));if(k){var E=[{key:"Grouped",disabled:b.stacked()},{key:"Stacked",disabled:!b.stacked()}];f.width(180).color(["#444","#444","#444"]),D.select(".nv-controlsWrap").datum(E).attr("transform","translate(0,"+ -g.top+")").call(f)}B.attr("transform","translate("+g.left+","+g.top+")"),b.width(w).height(z).color(m.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!m[b].disabled}));var F=D.select(".nv-barsWrap").datum(m.filter(function(a){return!a.disabled}));d3.transition(F).call(b),c.scale(p).ticks(z/24).tickSize(-w,0),d3.transition(D.select(".nv-x.nv-axis")).call(c);var G=D.select(".nv-x.nv-axis").selectAll("g");G.selectAll("line, text").style("opacity",1),d.scale(q).ticks(w/100).tickSize(-z,0),D.select(".nv-y.nv-axis").attr("transform","translate(0,"+z+")"),d3.transition(D.select(".nv-y.nv-axis")).call(d),e.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,m.filter(function(a){return!a.disabled}).length||m.map(function(a){a.disabled=!1,B.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(u)}),f.dispatch.on("legendClick",function(c,d){if(!!c.disabled){E=E.map(function(a){a.disabled=!0;return a}),c.disabled=!1;switch(c.key){case"Grouped":b.stacked(!1);break;case"Stacked":b.stacked(!0)}a.transition().call(u)}}),s.on("tooltipShow",function(a){n&&t(a,v.parentNode)})});return u}var b=a.models.multiBarHorizontal(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend().height(30),f=a.models.legend().height(30),g={top:30,right:20,bottom:50,left:60},h=null,i=null,j=a.utils.defaultColor(),k=!0,l=!0,m=!1,n=!0,o=function(a,b,c,d,e){return"

"+a+" - "+b+"

"+"

"+c+"

"},p,q,r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");b.stacked(m),c.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),d.orient("bottom").tickFormat(d3.format(",.1f"));var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=o(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"e":"w",null,f)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){n&&a.tooltip.cleanup()}),u.dispatch=s,u.multibar=b,u.legend=e,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","xDomain","yDomain","forceX","forceY","clipEdge","id","delay","showValues","valueFormat","stacked"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return h;h=a;return u},u.height=function(a){if(!arguments.length)return i;i=a;return u},u.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b),e.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return o;o=a;return u},u.tooltips=function(a){if(!arguments.length)return n;n=a;return u},u.tooltipContent=function(a){if(!arguments.length)return o;o=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u};return u},a.models.multiChart=function(){function y(a){a.each(function(h){var j=d3.select(this),z=this,A=(d||parseInt(j.style("width"))||960)-b.left-b.right,B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom,C=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==1}),D=h.filter(function(a){return!a.disabled&&a.type=="line"&&a.yAxis==2}),E=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==1}),F=h.filter(function(a){return!a.disabled&&a.type=="bar"&&a.yAxis==2}),G=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==1}),H=h.filter(function(a){return!a.disabled&&a.type=="area"&&a.yAxis==2}),I=h.filter(function(a){return!a.disabled&&a.yAxis==1}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),J=h.filter(function(a){return!a.disabled&&a.yAxis==2}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});i.domain(d3.extent(d3.merge(I.concat(J)),function(a){return a.x})).range([0,A]);var K=j.selectAll("g.wrap.multiChart").data([h]),L=K.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");L.append("g").attr("class","x axis"),L.append("g").attr("class","y1 axis"),L.append("g").attr("class","y2 axis"),L.append("g").attr("class","lines1Wrap"),L.append("g").attr("class","lines2Wrap"),L.append("g").attr("class","bars1Wrap"),L.append("g").attr("class","bars2Wrap"),L.append("g").attr("class","stack1Wrap"),L.append("g").attr("class","stack2Wrap"),L.append("g").attr("class","legendWrap");var M=K.select("g");f&&(v.width(A/2),M.select(".legendWrap").datum(h.map(function(a){a.originalKey=a.originalKey===undefined?a.key:a.originalKey,a.key=a.originalKey+(a.yAxis==1?"":" (right axis)");return a})).call(v),b.top!=v.height()&&(b.top=v.height(),B=(e||parseInt(j.style("height"))||400)-b.top-b.bottom),M.select(".legendWrap").attr("transform","translate("+A/2+","+ -b.top+")")),m.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="line"})),n.width(A).height(B).interpolate("monotone").color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="line"})),o.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="bar"})),p.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="bar"})),q.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==1&&h[b].type=="area"})),r.width(A).height(B).color(h.map(function(a,b){return a.color||c[b%c.length]}).filter(function(a,b){return!h[b].disabled&&h[b].yAxis==2&&h[b].type=="area"})),M.attr("transform","translate("+b.left+","+b.top+")");var N=M.select(".lines1Wrap").datum(C),O=M.select(".bars1Wrap").datum(E),P=M.select(".stack1Wrap").datum(G),Q=M.select(".lines2Wrap").datum(D),R=M.select(".bars2Wrap").datum(F),S=M.select(".stack2Wrap").datum(H),T=G.length?G.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];k.domain(d3.extent(d3.merge(I).concat(T),function(a){return a.y})).range([0,B]),l.domain(d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,B]),m.yDomain(k.domain()),o.yDomain(k.domain()),q.yDomain(k.domain()),n.yDomain(l.domain()),p.yDomain(l.domain()),r.yDomain(l.domain()),G.length&&d3.transition(P).call(q),H.length&&d3.transition(S).call(r),E.length&&d3.transition(O).call(o),F.length&&d3.transition(R).call(p),C.length&&d3.transition(N).call(m),D.length&&d3.transition(Q).call(n),s.ticks(A/100).tickSize(-B,0),M.select(".x.axis").attr("transform","translate(0,"+B+")"),d3.transition(M.select(".x.axis")).call(s),t.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y1.axis")).call(t),u.ticks(B/36).tickSize(-A,0),d3.transition(M.select(".y2.axis")).call(u),M.select(".y2.axis").style("opacity",J.length?1:0).attr("transform","translate("+i.range()[1]+",0)"),v.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,h.filter(function(a){return!a.disabled}).length||h.map(function(a){a.disabled=!1,K.selectAll(".series").classed("disabled",!1);return a}),a.transition().call(y)}),w.on("tooltipShow",function(a){g&&x(a,z.parentNode)})}),y.update=function(){y(a)},y.container=this;return y}var b={top:30,right:20,bottom:50,left:60},c=d3.scale.category20().range(),d=null,e=null,f=!0,g=!0,h=function(a,b,c,d,e){return"

"+a+"

"+"

"+c+" at "+b+"

"},i,j,i=d3.scale.linear(),k=d3.scale.linear(),l=d3.scale.linear(),m=a.models.line().yScale(k),n=a.models.line().yScale(l),o=a.models.multiBar().stacked(!1).yScale(k),p=a.models.multiBar().stacked(!1).yScale(l),q=a.models.stackedArea().yScale(k),r=a.models.stackedArea().yScale(l),s=a.models.axis().scale(i).orient("bottom").tickPadding(5),t=a.models.axis().scale(k).orient("left"),u=a.models.axis().scale(l).orient("right"),v=a.models.legend().height(30),w=d3.dispatch("tooltipShow","tooltipHide"),x=function(b,c){var d=b.pos[0]+(c.offsetLeft||0),e=b.pos[1]+(c.offsetTop||0),f=s.tickFormat()(m.x()(b.point,b.pointIndex)),g=(b.series.bar?t:u).tickFormat()(m.y()(b.point,b.pointIndex)),i=h(b.series.key,f,g,b,y);a.tooltip.show([d,e],i,undefined,undefined,c.offsetParent)};m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),q.dispatch.on("tooltipShow",function(a){if(!Math.round(q.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),q.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),r.dispatch.on("tooltipShow",function(a){if(!Math.round(r.y()(a.point)*100)){setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0);return!1}a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),r.dispatch.on("tooltipHide",function(a){w.tooltipHide(a)}),m.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),m.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),n.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+b.left,a.pos[1]+b.top],w.tooltipShow(a)}),n.dispatch.on("elementMouseout.tooltip",function(a){w.tooltipHide(a)}),w.on("tooltipHide",function(){g&&a.tooltip.cleanup()}),y.dispatch=w,y.lines1=m,y.lines2=n,y.bars1=o,y.bars2=p,y.stack1=q,y.stack2=r,y.xAxis=s,y.yAxis1=t,y.yAxis2=u,y.x=function(a){if(!arguments.length)return getX;getX=a,m.x(a),o.x(a);return y},y.y=function(a){if(!arguments.length)return getY;getY=a,m.y(a),o.y(a);return y},y.margin=function(a){if(!arguments.length)return b;b=a;return y},y.width=function(a){if(!arguments.length)return d;d=a;return y},y.height=function(a){if(!arguments.length)return e;e=a;return y},y.color=function(a){if(!arguments.length)return c;c=a,v.color(a);return y},y.showLegend=function(a){if(!arguments.length)return f;f=a;return y},y.tooltips=function(a){if(!arguments.length)return g;g=a;return y},y.tooltipContent=function(a){if(!arguments.length)return h;h=a;return y};return y},a.models.ohlcBar=function(){function u(a){a.each(function(a){var q=c-b.left-b.right,u=d-b.top-b.bottom,v=d3.select(this);f.domain(r||d3.extent(a[0].values.map(h).concat(n))).range([0,q]),g.domain(s||[d3.min(a[0].values.map(m).concat(o)),d3.max(a[0].values.map(l).concat(o))]).range([u,0]);if(f.domain()[0]===f.domain()[1]||g.domain()[0]===g.domain()[1])singlePoint=!0;f.domain()[0]===f.domain()[1]&&(f.domain()[0]?f.domain([f.domain()[0]-f.domain()[0]*.01,f.domain()[1]+f.domain()[1]*.01]):f.domain([-1,1])),g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]+g.domain()[0]*.01,g.domain()[1]-g.domain()[1]*.01]):g.domain([-1,1]));var w=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),z=w.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),A=z.append("defs"),B=z.append("g"),C=w.select("g");B.append("g").attr("class","nv-ticks"),w.attr("transform","translate("+b.left+","+b.top+")"),v.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:e})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+e).append("rect"),w.select("#nv-chart-clip-path-"+e+" rect").attr("width",q).attr("height",u),C.attr("clip-path",p?"url(#nv-chart-clip-path-"+e+")":"");var D=w.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});D.exit().remove();var E=D.enter().append("path").attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"}).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[f(h(b,c)),g(i(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){t.elementClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()}).on("dblclick",function(a,b){t.elementDblClick({value:i(a,b),data:a,index:b,pos:[f(h(a,b)),g(i(a,b))],e:d3.event,id:e}),d3.event.stopPropagation()});D.attr("class",function(a,b,c){return(j(a,b)>k(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(D).attr("transform",function(a,b){return"translate("+f(h(a,b))+","+g(l(a,b))+")"}).attr("d",function(b,c){var d=q/a[0].values.length*.9;return"m0,0l0,"+(g(j(b,c))-g(l(b,c)))+"l"+ -d/2+",0l"+d/2+",0l0,"+(g(m(b,c))-g(j(b,c)))+"l0,"+(g(k(b,c))-g(m(b,c)))+"l"+d/2+",0l"+ -d/2+",0z"})});return u}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=Math.floor(Math.random()*1e4),f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=function(a){return a.open},k=function(a){return a.close},l=function(a){return a.high},m=function(a){return a.low},n=[],o=[],p=!0,q=a.utils.defaultColor(),r,s,t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");u.dispatch=t,u.x=function(a){if(!arguments.length)return h;h=a;return u},u.y=function(a){if(!arguments.length)return i;i=a;return u},u.open=function(a){if(!arguments.length)return j;j=a;return u},u.close=function(a){if(!arguments.length)return k;k=a;return u},u.high=function(a){if(!arguments.length)return l;l=a;return u},u.low=function(a){if(!arguments.length)return m;m=a;return u},u.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"? +a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return u},u.width=function(a){if(!arguments.length)return c;c=a;return u},u.height=function(a){if(!arguments.length)return d;d=a;return u},u.xScale=function(a){if(!arguments.length)return f;f=a;return u},u.yScale=function(a){if(!arguments.length)return g;g=a;return u},u.xDomain=function(a){if(!arguments.length)return r;r=a;return u},u.yDomain=function(a){if(!arguments.length)return s;s=a;return u},u.forceX=function(a){if(!arguments.length)return n;n=a;return u},u.forceY=function(a){if(!arguments.length)return o;o=a;return u},u.clipEdge=function(a){if(!arguments.length)return p;p=a;return u},u.color=function(b){if(!arguments.length)return q;q=a.utils.getColor(b);return u},u.id=function(a){if(!arguments.length)return e;e=a;return u};return u},a.models.pie=function(){function p(a){a.each(function(a){function E(a){a.innerRadius=0;var b=d3.interpolate({startAngle:0,endAngle:0},a);return function(a){return w(b(a))}}function D(a){n||(a.innerRadius=0);var b=d3.interpolate(this._current,a);this._current=b(0);return function(a){return w(b(a))}}function C(a){var b=(a.startAngle+a.endAngle)*90/Math.PI-90;return b>90?b-180:b}var j=c-b.left-b.right,p=d-b.top-b.bottom,q=Math.min(j,p)/2,r=d3.select(this),s=r.selectAll(".nv-wrap.nv-pie").data([e(a[0])]),t=s.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+h),u=t.append("g"),v=s.select("g");u.append("g").attr("class","nv-pie"),s.attr("transform","translate("+b.left+","+b.top+")"),v.select(".nv-pie").attr("transform","translate("+j/2+","+p/2+")"),r.on("click",function(a,b){o.chartClick({data:a,index:b,pos:d3.event,id:h})});var w=d3.svg.arc().outerRadius(q-q/5);n&&w.innerRadius(q/2);var x=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:g(a)}),y=s.select(".nv-pie").selectAll(".nv-slice").data(x);y.exit().remove();var z=y.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),o.elementMouseover({label:f(a.data),value:g(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:h})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),o.elementMouseout({label:f(a.data),value:g(a.data),point:a.data,index:b,id:h})}).on("click",function(a,b){o.elementClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()}).on("dblclick",function(a,b){o.elementDblClick({label:f(a.data),value:g(a.data),point:a.data,index:b,pos:d3.event,id:h}),d3.event.stopPropagation()});y.attr("fill",function(a,b){return i(a,b)}).attr("stroke",function(a,b){return i(a,b)});var A=z.append("path").each(function(a){this._current=a});d3.transition(y.select("path")).attr("d",w).attrTween("d",D);if(k){var B=w;l&&(B=d3.svg.arc().outerRadius(w.outerRadius())),z.append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor","middle").style("fill","#000")}),y.select(".nv-label").transition().attr("transform",function(a){a.outerRadius=q+10,a.innerRadius=q+15;return"translate("+B.centroid(a)+")"}),y.each(function(a,b){var c=d3.select(this);c.select(".nv-label text").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI);return a.value&&c>m?f(a.data):""});var d=c.select("text").node().getBBox();c.select(".nv-label rect").attr("width",d.width+10).attr("height",d.height+10).attr("transform",function(){return"translate("+[d.x-5,d.y-5]+")"})})}});return p}var b={top:0,right:0,bottom:0,left:0},c=500,d=500,e=function(a){return a.values},f=function(a){return a.x},g=function(a){return a.y},h=Math.floor(Math.random()*1e4),i=a.utils.defaultColor(),j=d3.format(",.2f"),k=!0,l=!1,m=.02,n=!1,o=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");p.dispatch=o,p.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return p},p.width=function(a){if(!arguments.length)return c;c=a;return p},p.height=function(a){if(!arguments.length)return d;d=a;return p},p.values=function(a){if(!arguments.length)return e;e=a;return p},p.x=function(a){if(!arguments.length)return f;f=a;return p},p.y=function(a){if(!arguments.length)return g;g=d3.functor(a);return p},p.showLabels=function(a){if(!arguments.length)return k;k=a;return p},p.donutLabelsOutside=function(a){if(!arguments.length)return l;l=a;return p},p.donut=function(a){if(!arguments.length)return n;n=a;return p},p.id=function(a){if(!arguments.length)return h;h=a;return p},p.color=function(b){if(!arguments.length)return i;i=a.utils.getColor(b);return p},p.valueFormat=function(a){if(!arguments.length)return j;j=a;return p},p.labelThreshold=function(a){if(!arguments.length)return m;m=a;return p};return p},a.models.pieChart=function(){function n(a){a.each(function(h){var i=d3.select(this),j=this,m=(e||parseInt(i.style("width"))||960)-d.left-d.right,o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom;n.update=function(){n(a)},n.container=this;if(!h||!h.length){var p=i.selectAll(".nv-noData").data([k]);p.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),p.attr("x",d.left+m/2).attr("y",d.top+o/2).text(function(a){return a});return n}i.selectAll(".nv-noData").remove();var q=i.selectAll("g.nv-wrap.nv-pieChart").data([h]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),s=q.select("g");r.append("g").attr("class","nv-pieWrap"),r.append("g").attr("class","nv-legendWrap"),g&&(c.width(m).key(b.x()),q.select(".nv-legendWrap").datum(b.values()(h[0])).call(c),d.top!=c.height()&&(d.top=c.height(),o=(f||parseInt(i.style("height"))||400)-d.top-d.bottom),q.select(".nv-legendWrap").attr("transform","translate(0,"+ -d.top+")")),q.attr("transform","translate("+d.left+","+d.top+")"),b.width(m).height(o);var t=s.select(".nv-pieWrap").datum(h);d3.transition(t).call(b),c.dispatch.on("legendClick",function(c,d,e){c.disabled=!c.disabled,b.values()(h[0]).filter(function(a){return!a.disabled}).length||b.values()(h[0]).map(function(a){a.disabled=!1,q.selectAll(".nv-series").classed("disabled",!1);return a}),a.transition().call(n)}),b.dispatch.on("elementMouseout.tooltip",function(a){l.tooltipHide(a)})});return n}var b=a.models.pie(),c=a.models.legend(),d={top:30,right:20,bottom:20,left:20},e=null,f=null,g=!0,h=a.utils.defaultColor(),i=!0,j=function(a,b,c,d){return"

"+a+"

"+"

"+b+"

"},k="No Data Available.",l=d3.dispatch("tooltipShow","tooltipHide"),m=function(c,d){var e=c.pos[0]+(d&&d.offsetLeft||0),f=c.pos[1]+(d&&d.offsetTop||0),g=b.valueFormat()(b.y()(c.point)),h=j(b.x()(c.point),g,c,n);a.tooltip.show([e,f],h,c.value<0?"n":"s",null,d)};b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+d.left,a.pos[1]+d.top],l.tooltipShow(a)}),l.on("tooltipShow",function(a){i&&m(a)}),l.on("tooltipHide",function(){i&&a.tooltip.cleanup()}),n.dispatch=l,n.pie=b,d3.rebind(n,b,"valueFormat","values","x","y","id","showLabels","donutLabelsOutside","donut","labelThreshold"),n.margin=function(a){if(!arguments.length)return d;d.top=typeof a.top!="undefined"?a.top:d.top,d.right=typeof a.right!="undefined"?a.right:d.right,d.bottom=typeof a.bottom!="undefined"?a.bottom:d.bottom,d.left=typeof a.left!="undefined"?a.left:d.left;return n},n.width=function(a){if(!arguments.length)return e;e=a;return n},n.height=function(a){if(!arguments.length)return f;f=a;return n},n.color=function(d){if(!arguments.length)return h;h=a.utils.getColor(d),c.color(h),b.color(h);return n},n.showLegend=function(a){if(!arguments.length)return g;g=a;return n},n.tooltips=function(a){if(!arguments.length)return i;i=a;return n},n.tooltipContent=function(a){if(!arguments.length)return j;j=a;return n},n.noData=function(a){if(!arguments.length)return k;k=a;return n};return n},a.models.scatter=function(){function H(a){a.each(function(a){function Q(){if(!q)return!1;var c,d=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){return[g(j(a,c))*(Math.random()/1e12+1),h(k(a,c))*(Math.random()/1e12+1),b,c,a]}).filter(function(a,b){return r(a[4],b)})}));if(t){N.append("clipPath").attr("id","nv-points-clip-"+f);var e=L.select("#nv-points-clip-"+f).selectAll("circle").data(d);e.enter().append("circle").attr("r",u),e.exit().remove(),e.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),L.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+f+")")}if(B===!0){d.length<3&&(d.push([g.range()[0]-20,h.range()[0]-20,null,null]),d.push([g.range()[1]+20,h.range()[1]+20,null,null]));var i=d3.geom.voronoi(d).map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}}),l=L.select(".nv-point-paths").selectAll("path").data(i);l.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),l.exit().remove(),l.attr("d",function(a){return"M"+a.data.join(",")+"Z"}),c=l}else{var m=d.map(function(a,b){return{data:a,series:d[b][2],point:d[b][3]}});c=L.select(".nv-groups").selectAll(".nv-group").selectAll("path.nv-point").data(m).style("pointer-events","auto")}c.on("click",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementClick({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseover",function(c){if(G)return 0;var d=a[c.series],e=d.values[c.point];A.elementMouseover({point:e,series:d,pos:[g(j(e,c.point))+b.left,h(k(e,c.point))+b.top],seriesIndex:c.series,pointIndex:c.point})}).on("mouseout",function(b,c){if(G)return 0;var d=a[b.series],e=d.values[b.point];A.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:b.point})}),G=!1}var H=c-b.left-b.right,I=d-b.top-b.bottom,J=d3.select(this);a=a.map(function(a,b){a.values=a.values.map(function(a){a.series=b;return a});return a});var K=v&&w&&x?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:j(a,b),y:k(a,b),size:l(a,b)}})}));g.domain(v||d3.extent(K.map(function(a){return a.x}).concat(n))).range([0,H]),h.domain(w||d3.extent(K.map(function(a){return a.y}).concat(o))).range([I,0]),i.domain(x||d3.extent(K.map(function(a){return a.size}).concat(p))).range(y||[16,256]);if(g.domain()[0]===g.domain()[1]||h.domain()[0]===h.domain()[1])z=!0;g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-g.domain()[0]*.01,g.domain()[1]+g.domain()[1]*.01]):g.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+h.domain()[0]*.01,h.domain()[1]-h.domain()[1]*.01]):h.domain([-1,1])),C=C||g,D=D||h,E=E||i;var L=J.selectAll("g.nv-wrap.nv-scatter").data([a]),M=L.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+f+(z?" nv-single-point":"")),N=M.append("defs"),O=M.append("g"),P=L.select("g");O.append("g").attr("class","nv-groups"),O.append("g").attr("class","nv-point-paths"),L.attr("transform","translate("+b.left+","+b.top+")"),N.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),L.select("#nv-edge-clip-"+f+" rect").attr("width",H).attr("height",I),P.attr("clip-path",s?"url(#nv-edge-clip-"+f+")":""),G=!0;var R=L.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),d3.transition(R.exit()).style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),R.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),d3.transition(R).style("fill",function(a,b){return e(a,b)}).style("stroke",function(a,b){return e(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5);var S=R.selectAll("path.nv-point").data(function(a){return a.values});S.enter().append("path").attr("transform",function(a,b){return"translate("+C(j(a,b))+","+D(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),S.exit().remove(),d3.transition(R.exit().selectAll("path.nv-point")).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).remove(),S.attr("class",function(a,b){return"nv-point nv-point-"+b}),d3.transition(S).attr("transform",function(a,b){return"translate("+g(j(a,b))+","+h(k(a,b))+")"}).attr("d",d3.svg.symbol().type(m).size(function(a,b){return i(l(a,b))})),clearTimeout(F),F=setTimeout(Q,1e3),C=g.copy(),D=h.copy(),E=i.copy()});return H}var b={top:0,right:0,bottom:0,left:0},c=960,d=500,e=a.utils.defaultColor(),f=Math.floor(Math.random()*1e5),g=d3.scale.linear(),h=d3.scale.linear(),i=d3.scale.linear(),j=function(a){return a.x},k=function(a){return a.y},l=function(a){return a.size||1},m=function(a){return a.shape||"circle"},n=[],o=[],p=[],q=!0,r=function(a){return!a.notActive},s=!1,t=!0,u=function(){return 25},v=null,w=null,x=null,y=null,z=!1,A=d3.dispatch("elementClick","elementMouseover","elementMouseout"),B=!0,C,D,E,F,G=!1;A.on("elementMouseover.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!0)}),A.on("elementMouseout.point",function(a){q&&d3.select(".nv-chart-"+f+" .nv-series-"+a.seriesIndex+" .nv-point-"+a.pointIndex).classed("hover",!1)}),H.dispatch=A,H.x=function(a){if(!arguments.length)return j;j=d3.functor(a);return H},H.y=function(a){if(!arguments.length)return k;k=d3.functor(a);return H},H.size=function(a){if(!arguments.length)return l;l=d3.functor(a);return H},H.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return H},H.width=function(a){if(!arguments.length)return c;c=a;return H},H.height=function(a){if(!arguments.length)return d;d=a;return H},H.xScale=function(a){if(!arguments.length)return g;g=a;return H},H.yScale=function(a){if(!arguments.length)return h;h=a;return H},H.zScale=function(a){if(!arguments.length)return i;i=a;return H},H.xDomain=function(a){if(!arguments.length)return v;v=a;return H},H.yDomain=function(a){if(!arguments.length)return w;w=a;return H},H.sizeDomain=function(a){if(!arguments.length)return x;x=a;return H},H.sizeRange=function(a){if(!arguments.length)return y;y=a;return H},H.forceX=function(a){if(!arguments.length)return n;n=a;return H},H.forceY=function(a){if(!arguments.length)return o;o=a;return H},H.forceSize=function(a){if(!arguments.length)return p;p=a;return H},H.interactive=function(a){if(!arguments.length)return q;q=a;return H},H.pointActive=function(a){if(!arguments.length)return r;r=a;return H},H.clipEdge=function(a){if(!arguments.length)return s;s=a;return H},H.clipVoronoi=function(a){if(!arguments.length)return t;t=a;return H},H.useVoronoi=function(a){if(!arguments.length)return B;B=a,B===!1&&(t=!1);return H},H.clipRadius=function(a){if(!arguments.length)return u;u=a;return H},H.color=function(b){if(!arguments.length)return e;e=a.utils.getColor(b);return H},H.shape=function(a){if(!arguments.length)return m;m=a;return H},H.id=function(a){if(!arguments.length)return f;f=a;return H},H.singlePoint=function(a){if(!arguments.length)return z;z=a;return H};return H},a.models.scatterChart=function(){function G(a){a.each(function(x){function Q(){if(v){N.select(".nv-point-paths").style("pointer-events","all");return!1}N.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(u).focus(a[0]),n.distortion(u).focus(a[1]),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d),N.select(".nv-distributionX").datum(x.filter(function(a){return!a.disabled})).call(g),N.select(".nv-distributionY").datum(x.filter(function(a){return!a.disabled})).call(h)}var y=d3.select(this),z=this,H=(j||parseInt(y.style("width"))||960)-i.left-i.right,I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom;G.update=function(){G(a)},G.container=this;if(!x||!x.length||!x.filter(function(a){return a.values.length}).length){var J=y.selectAll(".nv-noData").data([B]);J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",i.left+H/2).attr("y",i.top+I/2).text(function(a){return a});return G}y.selectAll(".nv-noData").remove(),C=C||m,D=D||n;var K=y.selectAll("g.nv-wrap.nv-scatterChart").data([x]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),M=L.append("g"),N=K.select("g");M.append("rect").attr("class","nvd3 nv-background"),M.append("g").attr("class","nv-x nv-axis"),M.append("g").attr("class","nv-y nv-axis"),M.append("g").attr("class","nv-scatterWrap"),M.append("g").attr("class","nv-distWrap"),M.append("g").attr("class","nv-legendWrap"),M.append("g").attr("class","nv-controlsWrap"),s&&(e.width(H/2),K.select(".nv-legendWrap").datum(x).call(e),i.top!=e.height()&&(i.top=e.height(),I=(k||parseInt(y.style("height"))||400)-i.top-i.bottom),K.select(".nv-legendWrap").attr("transform","translate("+H/2+","+ -i.top+")")),t&&(f.width(180).color(["#444"]),N.select(".nv-controlsWrap").datum(F).attr("transform","translate(0,"+ -i.top+")").call(f)),K.attr("transform","translate("+i.left+","+i.top+")"),b.width(H).height(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),K.select(".nv-scatterWrap").datum(x.filter(function(a){return!a.disabled})).call(b);if(o){var O=m.domain()[1]-m.domain()[0];m.domain([m.domain()[0]-o*O,m.domain()[1]+o*O])}if(p){var P=n.domain()[1]-n.domain()[0];n.domain([n.domain()[0]-p*P,n.domain()[1]+p*P])}c.scale(m).ticks(c.ticks()&&c.ticks().length?c.ticks():H/100).tickSize(-I,0),N.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():I/36).tickSize(-H,0),N.select(".nv-y.nv-axis").call(d),q&&(g.getData(b.x()).scale(m).width(H).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),N.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(x.filter(function(a){return!a.disabled})).call(g)),r&&(h.getData(b.y()).scale(n).width(I).color(x.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!x[b].disabled})),M.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),N.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(x.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(N.select(".nv-background").attr("width",H).attr("height",I),N.select(".nv-background").on("mousemove",Q),N.select(".nv-background").on("click",function(){v=!v}),b.dispatch.on("elementClick.freezeFisheye",function(){v=!v})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,u=e.disabled?0:2.5,N.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),N.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(u).focus(0),n.distortion(u).focus(0),N.select(".nv-scatterWrap").call(b),N.select(".nv-x.nv-axis").call(c),N.select(".nv-y.nv-axis").call(d)):v=!1,G(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,x.filter(function(a){return!a.disabled}).length||x.map(function(a){a.disabled=!1,K.selectAll(".nv-series").classed("disabled",!1);return a}),G(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-I),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],A.tooltipShow(a)}),A.on("tooltipShow",function(a){w&&E(a,z.parentNode)}),C=m.copy(),D=n.copy()});return G}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=0,p=0,q=!1,r=!1,s=!0,t=!!d3.fisheye,u=0,v=!1,w=!0,x=function(a,b,c){return""+b+""},y=function(a,b,c){return""+c+""},z=null,A=d3.dispatch("tooltipShow","tooltipHide"),B="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var C,D,E=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));x!=null&&a.tooltip.show([j,k],x(e.series.key,p,q,e,G),"n",1,f,"x-nvtooltip"),y!=null&&a.tooltip.show([l,o],y(e.series.key,p,q,e,G),"e",1,f,"y-nvtooltip"),z!=null&&a.tooltip.show([g,h],z(e.series.key,p,q,e,G),e.value<0?"n":"s",null,f)},F=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),A.on("tooltipHide",function(){w&&a.tooltip.cleanup()}),G.dispatch=A,G.scatter=b,G.legend=e,G.controls=f,G.xAxis=c,G.yAxis=d,G.distX=g,G.distY=h,d3.rebind(G,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),G.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return G},G.width=function(a){if(!arguments.length)return j;j=a;return G},G.height=function(a){if(!arguments.length)return k;k=a;return G},G.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return G},G.showDistX=function(a){if(!arguments.length)return q;q=a;return G},G.showDistY=function(a){if(!arguments.length)return r;r=a;return G},G.showControls=function(a){if(!arguments.length)return t;t=a;return G},G.showLegend=function(a){if(!arguments.length)return s;s=a;return G},G.fisheye=function(a){if(!arguments.length)return u;u=a;return G},G.xPadding=function(a){if(!arguments.length)return o;o=a;return G},G.yPadding=function(a){if(!arguments.length)return p;p=a;return G},G.tooltips=function(a){if(!arguments.length)return w;w=a;return G},G.tooltipContent=function(a){if(!arguments.length)return z;z=a;return G},G.tooltipXContent=function(a){if(!arguments.length)return x;x=a;return G},G.tooltipYContent=function(a){if(!arguments.length)return y;y=a;return G},G.noData=function(a){if(!arguments.length)return B;B=a;return G};return G},a.models.scatterPlusLineChart=function(){function E(a){a.each(function(v){function O(){if(t){L.select(".nv-point-paths").style("pointer-events","all");return!1}L.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);m.distortion(s).focus(a[0]),n.distortion(s).focus(a[1]),L.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d),L.select(".nv-distributionX").datum(v.filter(function(a){return!a.disabled})).call(g),L.select(".nv-distributionY").datum(v.filter(function(a){return!a.disabled})).call(h)}var w=d3.select(this),x=this,F=(j||parseInt(w.style("width"))||960)-i.left-i.right,G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom;E.update=function(){E(a)},E.container=this;if(!v||!v.length||!v.filter(function(a){return a.values.length}).length){var H=w.selectAll(".nv-noData").data([z]);H.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),H.attr("x",i.left+F/2).attr("y",i.top+G/2).text(function(a){return a});return E}w.selectAll(".nv-noData").remove(),m=b.xScale(),n=b.yScale(),A=A||m,B=B||n;var I=w.selectAll("g.nv-wrap.nv-scatterChart").data([v]),J=I.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),K=J.append("g"),L=I.select("g");K.append("rect").attr("class","nvd3 nv-background"),K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-scatterWrap"),K.append("g").attr("class","nv-regressionLinesWrap"),K.append("g").attr("class","nv-distWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),I.attr("transform","translate("+i.left+","+i.top+")"),q&&(e.width(F/2),I.select(".nv-legendWrap").datum(v).call(e),i.top!=e.height()&&(i.top=e.height(),G=(k||parseInt(w.style("height"))||400)-i.top-i.bottom),I.select(".nv-legendWrap").attr("transform","translate("+F/2+","+ -i.top+")")),r&&(f.width(180).color(["#444"]),L.select(".nv-controlsWrap").datum(D).attr("transform","translate(0,"+ -i.top+")").call(f)),b.width(F).height(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),I.select(".nv-scatterWrap").datum(v.filter(function(a){return!a.disabled})).call(b),I.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var M=I.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a}),N=M.enter().append("g").attr("class","nv-regLines").append("line").attr("class","nv-regLine").style("stroke-opacity",0);M.selectAll(".nv-regLines line").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(a,b){return n(m.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return n(m.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return l(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||typeof a.slope=="undefined"||typeof a.intercept=="undefined"?0:1}),c.scale(m).ticks(c.ticks()?c.ticks():F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")").call(c),d.scale(n).ticks(d.ticks()?d.ticks():G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").call(d),o&&(g.getData(b.x()).scale(m).width(F).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),L.select(".nv-distributionX").attr("transform","translate(0,"+n.range()[0]+")").datum(v.filter(function(a){return!a.disabled})).call(g)),p&&(h.getData(b.y()).scale(n).width(G).color(v.map(function(a,b){return a.color||l(a,b)}).filter(function(a,b){return!v[b].disabled})),K.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),L.select(".nv-distributionY").attr("transform","translate(-"+h.size()+",0)").datum(v.filter(function(a){return!a.disabled})).call(h)),d3.fisheye&&(L.select(".nv-background").attr("width",F).attr("height",G),L.select(".nv-background").on("mousemove",O),L.select(".nv-background").on("click",function(){t=!t}),b.dispatch.on("elementClick.freezeFisheye",function(){t=!t})),f.dispatch.on("legendClick",function(e,f){e.disabled=!e.disabled,s=e.disabled?0:2.5,L.select(".nv-background").style("pointer-events",e.disabled?"none":"all"),L.select(".nv-point-paths").style("pointer-events",e.disabled?"all":"none"),e.disabled?(m.distortion(s).focus(0),n.distortion(s).focus(0),L.select(".nv-scatterWrap").call(b),L.select(".nv-x.nv-axis").call(c),L.select(".nv-y.nv-axis").call(d)):t=!1,E(a)}),e.dispatch.on("legendClick",function(b,c,d){b.disabled=!b.disabled,v.filter(function(a){return!a.disabled}).length||v.map(function(a){a.disabled=!1,I.selectAll(".nv-series").classed("disabled",!1);return a}),E(a)}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-G),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+g.size()),a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],y.tooltipShow(a)}),y.on("tooltipShow",function(a){u&&C(a,x.parentNode)}),A=m.copy(),B=n.copy()});return E}var b=a.models.scatter(),c=a.models.axis(),d=a.models.axis(),e=a.models.legend(),f=a.models.legend(),g=a.models.distribution(),h=a.models.distribution(),i={top:30,right:20,bottom:50,left:75},j=null,k=null,l=a.utils.defaultColor(),m=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),o=!1,p=!1,q=!0,r=!!d3.fisheye,s=0,t=!1,u=!0,v=function(a,b,c){return""+b+""},w=function(a,b,c){return""+c+""},x=function(a,b,c,d){return"

"+a+"

"+"

"+d+"

"},y=d3.dispatch("tooltipShow","tooltipHide"),z="No Data Available.";b.xScale(m).yScale(n),c.orient("bottom").tickPadding(10),d.orient("left").tickPadding(10),g.axis("x"),h.axis("y");var A,B,C=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),j=e.pos[0]+(f.offsetLeft||0),k=n.range()[0]+i.top+(f.offsetTop||0),l=m.range()[0]+i.left+(f.offsetLeft||0),o=e.pos[1]+(f.offsetTop||0),p=c.tickFormat()(b.x()(e.point,e.pointIndex)),q=d.tickFormat()(b.y()(e.point,e.pointIndex));v!=null&&a.tooltip.show([j,k],v(e.series.key,p,q,e,E),"n",1,f,"x-nvtooltip"),w!=null&&a.tooltip.show([l,o],w(e.series.key,p,q,e,E),"e",1,f,"y-nvtooltip"),x!=null&&a.tooltip.show([g,h],x(e.series.key,p,q,e.point.tooltip,e,E),e.value<0?"n":"s",null,f)},D=[{key:"Magnify",disabled:!0}];b.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",h.size())}),y.on("tooltipHide",function(){u&&a.tooltip.cleanup()}),E.dispatch=y,E.scatter=b,E.legend=e,E.controls=f,E.xAxis=c,E.yAxis=d,E.distX=g,E.distY=h,d3.rebind(E,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),E.margin=function(a){if(!arguments.length)return i;i.top=typeof a.top!="undefined"?a.top:i.top,i.right=typeof a.right!="undefined"?a.right:i.right,i.bottom=typeof a.bottom!="undefined"?a.bottom:i.bottom,i.left=typeof a.left!="undefined"?a.left:i.left;return E},E.width=function(a){if(!arguments.length)return j;j=a;return E},E.height=function(a){if(!arguments.length)return k;k=a;return E},E.color=function(b){if(!arguments.length)return l;l=a.utils.getColor(b),e.color(l),g.color(l),h.color(l);return E},E.showDistX=function(a){if(!arguments.length)return o;o=a;return E},E.showDistY=function(a){if(!arguments.length)return p;p=a;return E},E.showControls=function(a){if(!arguments.length)return r;r=a;return E},E.showLegend=function(a){if(!arguments.length)return q;q=a;return E},E.fisheye=function(a){if(!arguments.length)return s;s=a;return E},E.tooltips=function(a){if(!arguments.length)return u;u=a;return E},E.tooltipContent=function(a){if(!arguments.length)return x;x=a;return E},E.tooltipXContent=function(a){if(!arguments.length)return v;v=a;return E},E.tooltipYContent=function(a){if(!arguments.length)return w;w=a;return E},E.noData=function(a){if(!arguments.length)return z;z=a;return E};return E},a.models.sparkline=function(){function m(a){a.each(function(a){var e=c-b.left-b.right,m=d-b.top-b.bottom,n=d3.select(this);f.domain(k||d3.extent(a,h)).range([0,e]),g.domain(l||d3.extent(a,i)).range([m,0]);var o=n.selectAll("g.nv-wrap.nv-sparkline").data([a]),p=o.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline"),q=p.append("g"),r=o.select("g");o.attr("transform","translate("+b.left+","+b.top+")");var s=o.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||j(a,b)}).attr("d",d3.svg.line().x(function(a,b){return f(h(a,b))}).y(function(a,b){return g(i(a,b))}));var t=o.selectAll("circle.nv-point").data(function(a){function c(b){if(b!=-1){var c=a[b];c.pointIndex=b;return c}return null}var b=a.map(function(a,b){return i(a,b)}),d=c(b.lastIndexOf(g.domain()[1])),e=c(b.indexOf(g.domain()[0])),f=c(b.length-1);return[e,d,f].filter +(function(a){return a!=null})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return f(h(a,a.pointIndex))}).attr("cy",function(a,b){return g(i(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return h(a,a.pointIndex)==f.domain()[1]?"nv-point nv-currentValue":i(a,a.pointIndex)==g.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})});return m}var b={top:2,right:0,bottom:2,left:0},c=400,d=32,e=!0,f=d3.scale.linear(),g=d3.scale.linear(),h=function(a){return a.x},i=function(a){return a.y},j=a.utils.getColor(["#000"]),k,l;m.margin=function(a){if(!arguments.length)return b;b.top=typeof a.top!="undefined"?a.top:b.top,b.right=typeof a.right!="undefined"?a.right:b.right,b.bottom=typeof a.bottom!="undefined"?a.bottom:b.bottom,b.left=typeof a.left!="undefined"?a.left:b.left;return m},m.width=function(a){if(!arguments.length)return c;c=a;return m},m.height=function(a){if(!arguments.length)return d;d=a;return m},m.x=function(a){if(!arguments.length)return h;h=d3.functor(a);return m},m.y=function(a){if(!arguments.length)return i;i=d3.functor(a);return m},m.xScale=function(a){if(!arguments.length)return f;f=a;return m},m.yScale=function(a){if(!arguments.length)return g;g=a;return m},m.xDomain=function(a){if(!arguments.length)return k;k=a;return m},m.yDomain=function(a){if(!arguments.length)return l;l=a;return m},m.animate=function(a){if(!arguments.length)return e;e=a;return m},m.color=function(b){if(!arguments.length)return j;j=a.utils.getColor(b);return m};return m},a.models.sparklinePlus=function(){function n(a){a.each(function(l){function D(){function d(a,c){var d=Math.abs(b.x()(a[0],0)-c),e=0;for(var f=0;f"+a+""+"

"+c+" on "+b+"

"},o,p,q=d3.format(",.2f"),r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide");c.orient("bottom").tickPadding(7),d.orient("left"),b.scatter.pointActive(function(a){return!!Math.round(b.y()(a)*100)});var t=function(e,f){var g=e.pos[0]+(f.offsetLeft||0),h=e.pos[1]+(f.offsetTop||0),i=c.tickFormat()(b.x()(e.point,e.pointIndex)),j=d.tickFormat()(b.y()(e.point,e.pointIndex)),k=n(e.series.key,i,j,e,u);a.tooltip.show([g,h],k,e.value<0?"n":"s",null,f)};b.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+g.left,a.pos[1]+g.top],s.tooltipShow(a)}),b.dispatch.on("tooltipHide",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){m&&a.tooltip.cleanup()}),u.dispatch=s,u.stacked=b,u.legend=e,u.controls=f,u.xAxis=c,u.yAxis=d,d3.rebind(u,b,"x","y","size","xScale","yScale","xDomain","yDomain","sizeDomain","interactive","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),u.margin=function(a){if(!arguments.length)return g;g.top=typeof a.top!="undefined"?a.top:g.top,g.right=typeof a.right!="undefined"?a.right:g.right,g.bottom=typeof a.bottom!="undefined"?a.bottom:g.bottom,g.left=typeof a.left!="undefined"?a.left:g.left;return u},u.width=function(a){if(!arguments.length)return getWidth;h=a;return u},u.height=function(a){if(!arguments.length)return getHeight;i=a;return u},u.color=function(c){if(!arguments.length)return j;j=a.utils.getColor(c),e.color(j),b.color(j);return u},u.showControls=function(a){if(!arguments.length)return k;k=a;return u},u.showLegend=function(a){if(!arguments.length)return l;l=a;return u},u.tooltip=function(a){if(!arguments.length)return n;n=a;return u},u.tooltips=function(a){if(!arguments.length)return m;m=a;return u},u.tooltipContent=function(a){if(!arguments.length)return n;n=a;return u},u.noData=function(a){if(!arguments.length)return r;r=a;return u},d.setTickFormat=d.tickFormat,d.tickFormat=function(a){if(!arguments.length)return q;q=a;return d};return u}})() \ No newline at end of file diff --git a/src/models/cumulativeLineChart.js b/src/models/cumulativeLineChart.js index 5ee7700..b6bd24f 100644 --- a/src/models/cumulativeLineChart.js +++ b/src/models/cumulativeLineChart.js @@ -168,6 +168,9 @@ nv.models.cumulativeLineChart = function() { .map(function(series,i) { var initialDomain = d3.extent(series.values, lines.y()); + //account for series being disabled when losing 95% or more + if (initialDomain[0] < -.95) initialDomain[0] = -.95; + return [ (initialDomain[0] - initialDomain[1]) / (1 + initialDomain[1]), (initialDomain[1] - initialDomain[0]) / (1 + initialDomain[0])