Skip to content

Instantly share code, notes, and snippets.

/_.md

Forked from ptvans/_.md
Created September 30, 2012 02:49
Show Gist options
  • Save anonymous/3805707 to your computer and use it in GitHub Desktop.
Save anonymous/3805707 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":628,"height":603,"hide":false},"endpoint":"tributary","public":true}
//these are your variables - click and drag to change
var time = 310;
var base = 356925;
var conv = 0.01088;
var invite = 7.5;
var cycle = 67;
var k = conv * invite;
var di = 0.15;
var data = d3.range(0, time);
//we want to map our x values to pixel values
var xscale = d3.scale.linear()
.domain([d3.min(data), d3.max(data)])
.range([0, 440]); //try changing 300
//we want to map our y values to pixel values
var yscale = d3.scale.linear()
.domain([0,3308918])
.range([201, 0]) //svg corner starts at top left
var line = d3.svg.line()
.x(function(d) {
//for each x value we map it to the pixel value
return xscale(d);
})
.y(function(d,i) {
//this is the math for NEW USERS = base * (k^(t/cycle +1) -1) / (k-1)
var pow = Math.pow(k, d/cycle + 1);//this returns k to the power of d/cycle +1
return yscale(base * (pow - 1) / k - 1);
});
var svg = d3.select("svg");
var path = svg.append("path")
.data([data])
.attr("d", line) //this calls the line function with this element's data
.style("fill", "none")
.style("stroke", "#4B8FB6")
.style("stroke-width",2)
.attr("transform", "translate(" + [100, 100] + ")")
Display the source blob
Display the rendered blob
Raw
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="tributary_svg" width="1278" height="697"><path d="M0,445.0219229829633L1.4239482200647249,445.8178698206052L2.8478964401294498,446.5845965983127L4.2718446601941755,447.32317601574647L5.6957928802588995,448.03464139261484L7.119741100323625,448.71998811435435L8.543689320388351,449.3801750247371L9.967637540453076,450.01612576735477L11.391585760517799,450.62873007785436L12.815533980582524,451.2188450287356L14.23948220064725,451.7872962284497L15.663430420711974,452.33487897647854L17.087378640776702,452.862359376009L18.511326860841425,453.3704754057606L19.935275080906152,453.85993795246435L21.359223300970875,454.3314318054389L22.783171521035598,454.78561661465443L24.207119741100325,455.22312781362507L25.631067961165048,455.64457750842064L27.055016181229774,456.05055533404254L28.4789644012945,456.4416292793602L29.90291262135922,456.81834648176425L31.326860841423947,457.1812339926463L32.750809061488674,457.5307995147774L34.174757281553404,457.86753211261686L35.59870550161813,458.1919028965444L37.02265372168285,458.50436568197364L38.44660194174757,458.805357624269L39.870550161812304,459.0952998303538L41.29449838187703,459.37459794786554L42.71844660194175,459.6436427326831L44.14239482200647,459.9028105956189L45.566343042071196,460.15246412904185L46.990291262135926,460.3929526141671L48.41423948220065,460.6246125097225L49.83818770226537,460.8477679226764L51.262135922330096,461.06273106168334L52.686084142394826,461.2698026738841L54.11003236245955,461.46927246567054L55.53398058252427,461.6614195080025L56.957928802589,461.84651262684656L58.381877022653725,462.0248107792805L59.80582524271844,462.19656341579054L61.22977346278318,462.3620108292689L62.653721682847895,462.5213844911986L64.07766990291263,462.6749073754968L65.50161812297735,462.8227942704696L66.92556634304206,462.9652520793148L68.34951456310681,463.10248010959225L69.77346278317152,463.23467035206806L71.19741100323625,463.36200774932206L72.62135922330097,463.48467045449405L74.0453074433657,463.60283008053136L75.46925566343043,463.71665194028674L76.89320388349515,463.8262952778009L78.31715210355986,463.9319134910956L79.74110032362461,464.0336543467871L81.16504854368932,464.13166018682125L82.58899676375405,464.22606812761865L84.01294498381877,464.31701025190915L85.4368932038835,464.4046137935248L86.86084142394823,464.48900131540717L88.28478964401295,464.5702908810813L89.70873786407768,464.64859621983385L91.13268608414239,464.72402688582775L92.55663430420712,464.79668841137527L93.98058252427185,464.8666824545848L95.40453074433657,464.9341069415867L96.8284789644013,464.99905620353826L98.25242718446603,465.0616211085992L99.67637540453075,465.1218891890618L101.10032362459548,465.1799447638142L102.52427184466019,465.2358690563082L103.94822006472494,465.2897403081954L105.37216828478965,465.341633888793L106.79611650485437,465.3916224005298L108.2200647249191,465.4397757805217L109.64401294498383,465.48616139841835L111.06796116504854,465.5308441506575L112.49190938511327,465.5738865512592L113.915857605178,465.6153488192869L115.33980582524272,465.6552889630979L116.76375404530745,465.6937628615006L118.18770226537218,465.7308243419327L119.61165048543688,465.76652525576867L121.03559870550163,465.80091555086403L122.45954692556636,465.8340433414347L123.88349514563106,465.8659549753727L125.30744336569579,465.89669509908884L126.73139158576052,465.92630671997676L128.15533980582526,465.9548312665827L129.57928802588998,465.9823086465664L131.0032362459547,466.0087773025349L132.42718446601944,466.03427426582596L133.85113268608413,466.0588352083172L135.27508090614887,466.0824944923337L136.69902912621362,466.1052852187227L138.1229773462783,466.1272392731638L139.54692556634305,466.14838737077935L140.97087378640776,466.16875909910664L142.3948220064725,466.1883829594929L143.81877022653723,466.20728640697024L145.24271844660194,466.22549588866724L146.66666666666669,466.2430368808102L148.0906148867314,466.2599339243658L149.51456310679612,466.2762106593756L150.93851132686086,466.29188985802983L152.36245954692555,466.30699345652755L153.7864077669903,466.32154258576617L155.21035598705504,466.33555760090536L156.63430420711973,466.3490581098452L158.05825242718447,466.3620630006587L159.48220064724921,466.3745904680174L160.90614886731393,466.3866580386471L162.33009708737865,466.39828259584897L163.75404530744336,466.40948040311963L165.1779935275081,466.4202671269056L166.60194174757282,466.43065785852156L168.02588996763754,466.44066713526354L169.44983818770228,466.45030896074826L170.873786407767,466.4595968245043L172.29773462783172,466.4685437208454L173.72168284789646,466.47716216705027L175.14563106796118,466.48546422087475L176.5695792880259,466.4934614974215L177.99352750809064,466.50116518539056L179.41747572815535,466.50858606273266L180.84142394822007,466.5157345117285L182.26537216828478,466.52262053351404L183.68932038834953,466.5292537620731L185.11326860841424,466.53564347771527L186.53721682847896,466.5417986200604L187.9611650485437,466.5477278005451L189.38511326860842,466.55343931447095L190.80906148867314,466.5589411526103L192.23300970873788,466.5642410123856L193.6569579288026,466.56934630863856L195.0809061488673,466.57426418400433L196.50485436893206,466.5790015189041L197.92880258899677,466.5835649411716L199.3527508090615,466.58796083532565L200.77669902912623,466.59219535150237L202.20064724919095,466.59627441406013L203.62459546925567,466.6002037298675L205.04854368932038,466.6039887962878L206.47249190938513,466.6076349088705L207.89644012944987,466.6111471687596L209.32038834951456,466.6145304898307L210.7443365695793,466.6177896055657L212.16828478964402,466.6209290756753L213.59223300970874,466.6239532924785L215.01618122977348,466.6268664870476L216.4401294498382,466.6296727351274L217.8640776699029,466.63237596283795L219.28802588996766,466.63497995216727L220.71197411003237,466.6374883462625L222.1359223300971,466.63990465452696L223.55987055016183,466.64223225753L224.98381877022655,466.64447441173667L226.40776699029126,466.64663425406377L227.831715210356,466.64871480626823L229.25566343042073,466.65071897917556L230.67961165048544,466.65264957675134L232.10355987055019,466.65450930002464L233.5275080906149,466.65630075086705L234.95145631067962,466.65802643563245L236.37540453074436,466.65968876866395L237.79935275080908,466.66129007567145L239.22330097087377,466.66283259698565L240.64724919093854,466.6643184906921L242.07119741100325,466.66574983565096L243.49514563106794,466.6671286344051L244.91909385113271,466.6684568159819L246.3430420711974,466.66973623859207L247.76699029126212,466.6709686922295L249.1909385113269,466.6721559011754L250.61488673139158,466.6732995264108L252.03883495145635,466.67440116794023L253.46278317152104,466.67546236703066L254.88673139158576,466.6764846083671L256.3106796116505,466.67746932213043L257.7346278317152,466.67841788599816L259.15857605177996,466.6793316270714L260.5825242718447,466.68021182373235L262.0064724919094,466.6810597074322L263.4304207119741,466.68187646441436L264.8543689320389,466.6826632373739L266.27831715210357,466.6834211270564L267.70226537216826,466.68415119379785L269.12621359223306,466.68485445900814L270.55016181229774,466.6855319066003L271.97411003236243,466.68618448436644L273.39805825242723,466.6868131053047L274.8220064724919,466.68741864889586L276.2459546925566,466.68800196233394L277.6699029126214,466.6885638617116L279.0938511326861,466.68910513316206L280.5177993527508,466.6896265339584L281.94174757281553,466.6901287935738L283.3656957928803,466.6906126147013L284.789644012945,466.69107867423764L286.2135922330097,466.6915276242299L287.63754045307445,466.69196009278755L289.0614886731392,466.6923766849618L290.4854368932039,466.6927779835916L291.9093851132686,466.69316455011943L293.33333333333337,466.69353692537646L294.75728155339806,466.6938956303394L296.1812297734628,466.69424116685946L297.60517799352755,466.69457401836416L299.02912621359224,466.6948946505341L300.453074433657,466.69520351195393L301.8770226537217,466.69550103474074L303.3009708737864,466.69578763514767L304.7249190938511,466.69606371414704L306.1488673139159,466.69632965799104L307.5728155339806,466.69658583875196L308.9967637540453,466.6968326148431L310.4207119741101,466.6970703315199L311.84466019417476,466.69729932136323L313.26860841423945,466.69751990474447L314.69255663430425,466.6977323902737L316.11650485436894,466.6979370752319L317.5404530744337,466.69813424598624L318.96440129449843,466.6983241783913L320.3883495145631,466.69850713817465L321.81229773462786,466.69868338130846L323.23624595469255,466.6988531543684L324.6601941747573,466.69901669487757L326.08414239482204,466.6991742316398L327.5080906148867,466.6993259850588L328.93203883495147,466.69947216744765L330.3559870550162,466.69961298332447L331.7799352750809,466.69974862969985L333.20388349514565,466.6998792963517L334.6278317152104,466.7000051660909L336.0517799352751,466.70012641501734L337.4757281553398,466.700243212766L338.89967637540457,466.7003557227444L340.32362459546925,466.70046410236097L341.747572815534,466.700568503246L343.17152103559874,466.70066907146276L344.59546925566343,466.7007659477128L346.0194174757282,466.700859267532L347.4433656957929,466.7009491614808L348.8673139158576,466.70103575532653L350.29126213592235,466.7011191702196L351.7152103559871,466.70119952286274L353.1391585760518,466.7012769256743L354.56310679611653,466.70135148694584L355.9870550161813,466.70142331099345L357.41100323624596,466.70149249830337L358.8349514563107,466.70155914567306L360.25889967637545,466.7016233463466L361.68284789644014,466.70168519014464L363.1067961165049,466.70174476359074L364.53074433656957,466.70180215003194L365.9546925566343,466.7018574297555L367.37864077669906,466.70191068010115L368.80258899676375,466.7019619755697L370.2265372168285,466.70201138792675L371.65048543689323,466.7020589863033L373.0744336569579,466.70210483729255L374.49838187702267,466.7021490050428L375.9223300970874,466.7021915513478L377.3462783171521,466.70223253573243L378.77022653721684,466.7022720155365L380.1941747572816,466.7023100459947L381.6181229773463,466.702346680314L383.042071197411,466.7023819697484L384.46601941747576,466.70241596366975L385.88996763754045,466.70244870963796L387.3139158576052,466.70248025346655L388.73786407766994,466.7025106392876L390.1618122977346,466.70253990961254L391.5857605177994,466.7025681053926L393.0097087378641,466.7025952660754L394.4336569579288,466.70262142966044L395.85760517799355,466.7026466327523L397.2815533980583,466.70267091061163L398.705501618123,466.70269429720497L400.1294498381877,466.70271682525123L401.55339805825247,466.70273852626894L402.97734627831716,466.70275943061904L404.4012944983819,466.7027795675481L405.8252427184466,466.7027989652289L407.24919093851133,466.7028176508001L408.6731391585761,466.70283565040404L410.09708737864077,466.7028529892232L411.5210355987055,466.70286969151573L412.94498381877025,466.70288578064935L414.36893203883494,466.7029012791336L415.79288025889974,466.7029162086519L417.21682847896443,466.7029305900917L418.6407766990291,466.70294444357336L420.0647249190939,466.7029577884789L421.4886731391586,466.7029706434787L422.9126213592233,466.70298302655766L424.33656957928804,466.70299495504054L425.7605177993528,466.70300644561615L427.18446601941747,466.7030175143604L428.6084142394822,466.7030281767591L430.03236245954696,466.7030384477299L431.45631067961165,466.7030483416422L432.8802588996764,466.7030578723386L434.30420711974114,466.70306705315284L435.7281553398058,466.70307589692953L437.15210355987057,466.70308441604175L438.5760517799353,466.70309262240824L440,466.70310052751023" style="fill: none; stroke: #4b8fb6; stroke-width: 2px; " transform="translate(100,100)"></path></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment