<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>D3.js on zachcp</title>
		<link>http://zachcp.org/categories/d3.js/</link>
		<description>Recent content in D3.js on zachcp</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
			<copyright>© 2007- {year}</copyright>
		
		
			<lastBuildDate>Wed, 03 Feb 2016 08:03:00 +0000</lastBuildDate>
		
			<atom:link href="http://zachcp.org/categories/d3.js/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Stacked Bars</title>
				<link>http://zachcp.org/blog/stackedbarswidget/</link>
				<pubDate>Wed, 03 Feb 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/stackedbarswidget/</guid>
				<description>&lt;p&gt;I recently came across &lt;a href=&#34;https://twitter.com/hrbrmstr&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;@hrbrmstr&amp;rsquo;s&lt;/a&gt; &lt;a href=&#34;http://hrbrmstr.github.io/streamgraph/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;streamgraph&amp;rsquo;s&lt;/a&gt; package.&#xA;The package is nice for the manner in which it makes it easy to create streamgraphs but my interest was piqued when I notices that&#xA;were select boxes. At some point I had tried developing simple &lt;a href=&#34;http://www.htmlwidgets.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;HTMLwidget&lt;/a&gt; but had gotten gummed up&#xA;in my understanding of how values were being passed around. Furthermore, HTMLwidgets sanitizes your javascript so there are no global variables&#xA;left around to inspect and therefore debugging was a pain. So the streamgraphs package is interesting for providing a good&#xA;best practice on how to pass in data. Heres a few things I learned followed by a little HTMLWidgets&#xA;&lt;a href=&#34;http://zachcp.github.io/stackedbars/stackedbars.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;package I made&lt;/a&gt; that clones Mike Bostock&amp;rsquo;s &lt;a href=&#34;http://bl.ocks.org/mbostock/3886208&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;stacked bar&#xA;chart&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>CRISPR Timeline</title>
				<link>http://zachcp.org/blog/crispr-timeline/</link>
				<pubDate>Thu, 07 Jan 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/crispr-timeline/</guid>
				<description>&lt;style&gt;&#xA;    .axis path{&#xA;      fill: none;&#xA;      stroke-width: 2px;&#xA;      stroke: #222;&#xA;    }&#xA;    .axis line{&#xA;      fill: none;&#xA;      stroke-width: 1px;&#xA;      stroke: #222;&#xA;    }&#xA;    .axis text{&#xA;      font-size: 16px;&#xA;    }&#xA;&#x9;&#xA;    path.link{&#xA;      stroke-width: 2px;&#xA;      opacity: 0.6;&#xA;    }&#xA;    text.label-text{&#xA;      font-size: 14px;&#xA;    }&#xA;    #viz {&#xA;        min-height: 1200px;&#x9;&#xA;&#x9;}&#xA;&#xA;&lt;/style&gt;&#xA;&lt;div class=&#34;row&#34; id=&#34;viz&#34;&gt;&#xA;&#x9;&lt;h5&gt;d3-ified version of the Broad&#39;s  &lt;a href=&#34;https://www.broadinstitute.org/what-broad/areas-focus/project-spotlight/crispr-timeline&#34;&gt; CRISPR Timeline&lt;/a&gt;&lt;/h5&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;The discovery of the CRISPR-Cas microbial adaptive immune system and its ongoing development into a genome editing tool represents the work of many scientists from around the world. This timeline presents a concise history of the seminal contributions and the scientists who pushed this field forward, from the initial discovery to the first demonstrations of CRISPR-mediated genome editing. (hint: hover over the timeline labels; &amp;lt;a href=&amp;quot;http://kristw.github.io/d3kit-timeline/&amp;quot;&amp;gt;made with d3kit-timeline&amp;lt;/a&amp;gt;)&#xA;&#xA;&amp;lt;/p&amp;gt;&#xA;&#xA;&amp;lt;div class=&amp;quot;col-md-6&amp;quot;&amp;gt;&#xA;&#x9;&amp;lt;div class=&amp;quot;timeline&amp;quot; id=&amp;quot;crisprtimeline&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&amp;lt;div class=&amp;quot;col-md-4&amp;quot;&amp;gt;&#xA;&#x9;&amp;lt;div id=&amp;quot;crisprdata&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;script src=&#34;//d3js.org/d3.v3.min.js&#34;&gt;&lt;/script&gt;&#xA;&lt;script src=&#34;http://zachcp.org/js/d3kit.min.js&#34;&gt;&lt;/script&gt;&#xA;&lt;script src=&#34;http://zachcp.org/js/labella.min.js&#34;&gt;&lt;/script&gt;&#xA;&lt;script src=&#34;http://zachcp.org/js/d3kit-timeline.min.js&#34;&gt;&lt;/script&gt;&#xA;&lt;script src=&#34;http://zachcp.org/js/crispr-timeline-data.js&#34;&gt;&lt;/script&gt;&#xA;&lt;script&gt;&#xA;&#xA;&#x9;var chart = new d3Kit.Timeline(&#39;#crisprtimeline&#39;, {&#xA;&#x9;  direction: &#39;right&#39;,&#xA;&#x9;  initialWidth: 500,&#xA;&#x9;  initialHeight: 500,&#xA;&#x9;  labelBgColor: &#34;#777&#34;,&#xA;&#x9;  labelPadding:&#xA;&#x9;    {left: 4, right: 4, top: 3, bottom: 3},&#xA;&#x9;  textFn: function(d){&#xA;&#x9;    return d.time.getFullYear() + &#39; - &#39; + d.title;&#xA;&#x9;  },&#xA;&#x9;  labella: {&#xA;&#x9;      maxPos: 400,&#xA;&#x9;      algorithm: &#39;simple&#39;&#xA;&#x9;    }&#xA;&#x9;});&#xA;&#xA;&#x9;var setdata = function(d,i){&#xA;&#x9;&#x9;var cdata = d3.select(&#34;#crisprdata&#34;);&#xA;&#x9;&#x9;cdata.selectAll(&#34;*&#34;).remove()&#x9;&#x9;&#xA;&#x9;&#x9;cdata.data([d]).append(&#34;h5&#34;).text(function(d){return d.title});&#xA;&#x9;&#x9;cdata.data([d]).append(&#34;h6&#34;).text(function(d){return d.person + &#34; - &#34; + d.institute + &#34; - &#34; + d.date});&#xA;&#x9;&#x9;cdata.data([d]).append(&#34;p&#34;).text(function(d){return d.discovery}).attr(&#34;align&#34;,&#34;justify&#34;);&#xA;&#x9;};&#xA;&#x9;&#xA;&#x9;chart.data(data);&#xA;&#x9;chart.axis.ticks(0).tickSize(0);&#xA;&#x9;chart.on(&#34;labelMouseover&#34;, function(d,i){setdata(d,i)} );&#xA;&lt;/script&gt;</description>
			</item>
	</channel>
</rss>
