<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Diana MacDonald on Medium]]></title>
        <description><![CDATA[Stories by Diana MacDonald on Medium]]></description>
        <link>https://medium.com/@didoesdigital?source=rss-e64e183269d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*NJ9KQNr4aF12CtYdZRj_Vw.png</url>
            <title>Stories by Diana MacDonald on Medium</title>
            <link>https://medium.com/@didoesdigital?source=rss-e64e183269d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 14:16:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@didoesdigital/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building Culture Amp’s Design System]]></title>
            <link>https://medium.com/@didoesdigital/building-culture-amps-design-system-67d28181246?source=rss-e64e183269d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/67d28181246</guid>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[component-libraries]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Diana MacDonald]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 09:26:07 GMT</pubDate>
            <atom:updated>2020-07-20T13:49:39.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lessons Learned Building Culture Amp’s Design System</h3><p><em>For the past 18 months, I’ve led the design systems team since its inception at Culture Amp. I’ve worn many hats, contributing to design, development, and product management. Today I want to focus on the tech, culture, and the non-intuitive lessons I’ve learned building a design system. It’s just one story, but I hope you can take away something useful from my experience.</em></p><p>At Culture Amp, the key to building a successful design system was fostering a shared language. A shared language has helped us uplift our product’s design, all while building a strong partnership between design and engineering.</p><p>In this article, I’ll cover:</p><ul><li>Introducing the Kaizen Design System</li><li>Storybook is not only for developers</li><li>Branch previews transform workflows</li><li>Internal open source increases shared ownership</li><li>Tokens are the building blocks of design systems</li><li>Effective versioning and releasing is critical to accelerating engineering</li><li>Shared language reduces the hidden costs of conversations</li><li>Stand on the shoulders of giants to fast-track learning</li><li>Naming things is hard</li></ul><h3>Introducing the Kaizen Design System</h3><figure><img alt="Kaizen homepage shows a visual overview to Guidelines, Language, and Components. Primary navigation also links to Storybook." src="https://cdn-images-1.medium.com/max/1024/1*Q_Njv8pxaV79dCaX_Jv4Jw.png" /><figcaption>Our design system integrates design guidelines, language, and components.</figcaption></figure><p>Kaizen is Culture Amp’s design system:</p><p><a href="https://cultureamp.design/"><strong>https://cultureamp.design</strong></a></p><blockquote><em>Kaizen (“improvement”) is a Japanese business philosophy that focuses on continuous improvement. This is how we see our design system: an ever-evolving language that can be shaped, grown and nurtured to support how we work, and enhance our customers’ experience.</em></blockquote><p>We use Kaizen to <strong>accelerate</strong> design and development, and empower designers and front-end engineers with a <strong>shared language</strong>.</p><p>Our design system is made of 3 parts:</p><ul><li>Kaizen Site: public documentation site</li><li>Kaizen UI Kit: Figma assets</li><li>Kaizen Component Library: code assets including React and Elm components, draft and core library packages, design tokens and hosted assets, such as binary images.</li></ul><p><em>Culture Amp itself is a people and culture platform with which we strive to create a better world of work.</em></p><h3>Storybook is not only for developers</h3><p><a href="https://storybook.js.org/">Storybook</a> is a tool for developing UI components in isolation from applications. It plays a critical role in establishing a shared language.</p><p>The primary audience for our design system includes Culture Amp employees directly building product, especially product designers and front-end engineers. We also support wider company employees, such as: brand and content designers, content strategists, user researchers, full-stack and back-end engineers, product managers, QA engineers, and customer success.</p><p>We use <a href="http://cultureamp.design/storybook">storybook to show our React and Elm components</a>, in all their states, with interactivity, in one place. Each state is shown as a separate “story”.</p><figure><img alt="Kaizen Site lists every storybook story and shows the React Informative Empty State component." src="https://cdn-images-1.medium.com/max/1024/1*X16Nuova3MgVqeTEWOJN_w.png" /><figcaption>We can search our stories by “React” or “Elm”.</figcaption></figure><h4><strong>Give everyone visibility</strong></h4><p><strong>Storybook gives everyone visibility into what components exist and how they work. </strong>A picture of a component doesn’t tell you how it works and feels. Modern design tools are improving, but you can’t beat the accuracy of something working in the browser. It feels more real. As one designer put it:</p><blockquote>“I trust it, something about code I trust more. When it’s a picture in Figma, will it actually turn out like that?”</blockquote><p>Every hover state, scroll, and drag responding to your input is behaviour you can trust. For example, if there were delays between hover or click and the resulting action, you’d know about it. Maybe the animation is just a tad too long or maybe the multi-select search updating results on every keystroke causes distracting flickers.</p><p>Storybook keeps everyone on the same page about exactly how the UI works today. This avoids developers having greater familiarity than everyone else. Shared understanding is invaluable for effective product teams.</p><p>To protect user privacy in our product, we limit employee access to customer account data. Given the data-driven nature of our product, this means <strong>without data it’s difficult to realistically see how it behaves</strong>, which is a challenge for designers. It’s hard to design for a platform you rarely see. The use of storybook encourages stories that separate data from presentation. Designers can see how components would work with different data. For example, everyone can see a <a href="https://cultureamp.design/storybook/?path=/story/collapsible-react--single-collapsible-no-padding">single collapsible</a> vs a <a href="https://cultureamp.design/storybook/?path=/story/collapsible-react--collapsible-group-sticky-headers">collapsible group with sticky headers</a> or a single <a href="https://cultureamp.design/storybook/?path=/story/toastnotification-react--informative">toast notification</a> vs <a href="https://cultureamp.design/storybook/?path=/story/toastnotification-react--multiple-notifications">multiple notifications</a>.</p><figure><img alt="Animation of 4 stacked toast notifications that slide in from the side and down to separate." src="https://cdn-images-1.medium.com/max/727/1*qgZG_rVQykscMoCqIAkC1Q.gif" /><figcaption>Don’t forget to design for more than 1 notification 😱</figcaption></figure><h4><strong>Visible, named components surface discrepancies in understanding</strong></h4><p>Through shared components, it’s easy to see how perceptions differ between designers and developers. For example, our design system includes a <a href="https://cultureamp.design/components/tag/">Tag</a> component:</p><blockquote>Tags help users quickly recognize important information about items that organize and categorize them. They visually label items with small amounts of information or the item’s status.</blockquote><p>Prior to storybook and the design system, developers called them chips or badges, depending on which part of the code base they were in (or which library they were using), while designers called them pills or labels. In addition to bringing them closer together, our storybook stories clearly describe intent. For example, there are <a href="https://cultureamp.design/storybook/?path=/story/tag-react--sentiment-negative">negative sentiment tags</a> that we use for labelling negative comments and <a href="https://cultureamp.design/storybook/?path=/story/tag-react--status-live">live status tags</a> for showing live surveys. <strong>Bringing designers and developers closer together is one of my favourite things.</strong> Showing designers what devs call things and building things that align with how they’re used makes our lives easier.</p><h4><strong>Reliable visual regression testing lets you release visual changes faster</strong></h4><p>Storybook stories make it possible to create snapshots of components in different states for visual regression testing. We use <a href="https://www.chromatic.com/">Chromatic</a> to quickly test visual changes. It’s especially helpful for wide-reaching impact on components, such as our recent change in typography from Ideal Sans to <a href="https://rsms.me/inter/">Inter</a> for text. By testing component snapshots, we don’t need to manage the overhead of getting complex application code into the right state for testing, which is often brittle and can require more maintenance than the benefits it brings. This changes how our QA crew test things.</p><h3>Branch previews transform workflows</h3><p>A branch preview is a deployed preview of a feature branch. Feature branches in our repo are automatically deployed to a public URL that can be shared with team mates to “preview” the feature live. This includes visualising changes to components in storybook or updating design documentation on the site.</p><p>I cannot overstate how good branch previews are.</p><figure><img alt="GitHub checks show branch preview, Moai, and buildkite." src="https://cdn-images-1.medium.com/max/1024/1*xflC5ULNcaC79hxTMVvVow.png" /><figcaption>Every PR has an automatic link to its branch preview, which designers can access.</figcaption></figure><h4><strong>It’s cheaper to fix design problems earlier in the process</strong></h4><p>By empowering designers to participate in development as it progresses rather than after shipping, we open up a window of opportunity for designers and engineers to collaborate and make changes at the time it’s easiest to do so.</p><h4><strong>Greater context leads to higher quality output</strong></h4><p>Branch previews let us see the full experience exactly as it will appear. For example, documentation isn’t reviewed only in code, it’s reviewed in the context of the page it will appear on, showing text-wrapping and all. This is especially helpful for designers and content strategists. Our branch previews also don’t suffer from the gap between what code looks like locally “on my machine” and how it will look in production. It gives us an accurate preview. Armed with greater information, we go through fewer revisions to reach high quality results.</p><h4><strong>Effective remote working practices create more inclusive products and workplaces</strong></h4><p>Branch previews let people comfortably view and interact with work in progress on their own devices. This means there are no issues with Zoom jank on animations over a screen share. This means someone can click on what they want to click on instead of directing the developer to please click on the button, wait, the other button…</p><p>Branch previews also inherently mean more variety in testing. I’m a heavy keyboard user, I notice there’s a focus state missing. My colleague is red-green color blind, he notices the lack of contrast. As a huge plus, persistent branch previews let people across time zones look at work in progress asynchronously, instead of waiting until you’re all awake at the same time and have time to meet.</p><h4><strong>Put designers in the driver’s seat</strong></h4><p>We’ve heard from several designers that the design QA review is a key step in the process with their teams. The more closely they partner with engineers before launch, the stronger the solution delivered. In these moments, letting the designer steer with a branch preview gives them a chance to interact with the interface as well as try to break things. With their design brought to life, they can see how it will meet user needs. In contrast, without branch previews, one designer reported “only seeing what they show you”, which means they might not explore different pathways or see where the design falls over until its in the hands of customers.</p><h3>Internal open source increases shared ownership</h3><p>The Kaizen Design System’s repository is here:</p><p><a href="https://github.com/cultureamp/kaizen-design-system/">https://github.com/cultureamp/kaizen-design-system/</a></p><h4><strong>The power of the crowd</strong></h4><p>Treating our design system as internal open source also invites engineers to file issues, create PRs for features teams needs or bug fixes, and contribute code reviews on shared engineering assets. This is similar to any open-source software that we depend on to build modern apps. As a result, while the design systems team has driven a lot of progress, we’re far from the only team building components.</p><figure><img alt="Merged Kaizen Issue on GitHub shows a new favicon." src="https://cdn-images-1.medium.com/max/1024/1*eBlD2_8nWx7ZsA3TNZ1RLw.png" /><figcaption>I cannot tell you how much satisfaction adding a favicon brought me.</figcaption></figure><p><strong>Contributions from all disciplines.</strong> We also keep our UX documentation in Markdown, making it feasible for product designers and content strategists to make edits and add pages through GitHub’s UI. This means we don’t need to build or manage a CMS for a variety of folk to contribute. And again, branch previews give us additional confidence in the changes we’re making, without designers needing to install and run Gatsby (for example) on their own machines. We grow our design system together, ensuring many voices are heard.</p><p><strong>Team work makes the dream work.</strong> Internally, we have a crew of design system Advocates, designers and engineers from product teams all over the business, that collaborate more closely to discuss interaction design, patterns, API design, and opportunities to improve workflows. We depend on the advocates’ input and feedback to strengthen the system from grass roots efforts.</p><p><strong>Public design systems appeal to employees.</strong> Public design systems are almost standard these days. It demonstrates that user experience, as well as designer and developer experience is valued. This helps us with recruiting. It also helps our existing employees showcase their contributions to the world.</p><h3>Tokens are the building blocks of design systems</h3><p>A <strong>design token</strong> is a named and stored visual trait, such as colors and typography. They underpin everything in a design system. Let’s be frank: they’re the main reason one design system looks any different from another.</p><figure><img alt="Color sticker sheet in Figma shows Kaizen brand colors." src="https://cdn-images-1.medium.com/max/1024/1*aZiPpCrGFtkUlMuCLvP5Xw.png" /><figcaption>WCAG friendly colors make things so much easier.</figcaption></figure><h4><strong>Maximise reuse</strong></h4><p>The first design tokens to nail are the <strong>option tokens.</strong> As described in <a href="https://medium.com/eightshapes-llc/tokens-in-design-systems-25dd82d58421">Tokens in Design Systems by Nathan Curtis</a>, option tokens show what the design system offers. By agreeing on these and encoding them in one place, consistency is then built into everything you produce. Instead of <a href="http://www.lukew.com/ff/entry.asp?1469">548 unique hex values</a>, every engineer will use the same hex value intended for “blue”.</p><p>The second part of design tokens, <strong>decision tokens</strong>, tell you when to use a token. For example, you may want all links to use blue. We haven’t got this part totally figured out yet. For the most part, our decisions are captured in our components directly, which are all design reviewed. The main area we see variance is when teams need to cohesively create a new visual element without a component, or adapt the design system to other contexts outside our main product code, such as slide decks.</p><h4><strong>Reduce hidden costs</strong></h4><p>If you don’t have design tokens, what you likely have is CSS or Sass variables like primary-color: #F04C5D. Failing that, you probably have hundreds of different hex values strewn throughout your code base. I recommend checking with <a href="https://cssstats.com/">CSS Stats</a>. This is a fantastic starting point for quantifying the degree of inconsistency in your product that customers are experiencing and engineers are working around. These inconsistencies increases CSS complexity and file size, and introduce bugs. These are the hidden costs that design systems help to solve.</p><h4><strong>Build once and distribute</strong></h4><p>For a platform-agnostic approach, we store our tokens in JSON, which then publishes Sass and Less variables that we can use in different code bases. Even if you don’t use more than one framework now, you might bump into one in the future. For example, if you acquire a company (like we did), build an iOS app (like we did), use a WordPress theme for a public blog (like we do), or integrate with other services, such as Slack or MS Teams (like we do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*easRANhLxVO70zGF-bWoUQ.png" /><figcaption>Animation tokens standardise easing functions and durations for consistent brand motion.</figcaption></figure><h4><strong>Roll out brand changes easily</strong></h4><p>It’s now possible to rapidly roll out design changes. The brand color we were previously using in primary buttons wasn’t quite dark enough to be accessible, so we tweaked the value in the token and every component automatically uses the new, accessible color. Easy.</p><h3>Effective versioning and releasing is critical to accelerating engineering</h3><p>Our packages are published to NPM under the Kaizen organization:</p><p><a href="https://www.npmjs.com/org/kaizen">https://www.npmjs.com/org/kaizen</a></p><h4><strong>Streamline versioning and releasing</strong></h4><p>One of the biggest challenges in the history of our design system has been versioning and releasing. Improving the workflow has increased the growth rate of the design system.</p><p>Our revamped <a href="https://github.com/cultureamp/kaizen-design-system/blob/master/CONTRIBUTING.md#releasing-packages">package release</a> workflow <strong>automates releases to NPM</strong> when changes are made to packages, using NPM’s strict <a href="https://semver.org/">semantic versioning</a>. We also use <a href="https://www.conventionalcommits.org/en/v1.0.0/">conventional commits</a> in our PRs so that our CI pipeline correctly updates version numbers, taking the legwork of this out of the hands of engineers. This has helped to vastly reduce conflicts and unblock engineers. In turn, that’s lowered the barriers to contributing, increasing the overall activity on the repo.</p><p>More recently, we’ve also moved from a single-package approach to a blended <strong>multi-package approach </strong>using <a href="https://github.com/lerna/lerna">Lerna</a>. By breaking our single component library into a <a href="https://github.com/cultureamp/kaizen-design-system/tree/master/packages/component-library">core component library package</a> and many <a href="https://github.com/cultureamp/kaizen-design-system/tree/master/draft-packages">draft component packages</a>, teams can iterate more quickly on draft components and minimise the surface area for testing and rolling out changes. This has further reduced engineers being blocked and given us greater control over making visual changes.</p><p>In practice, our multi-package approach lets us experiment more and road-test components before settling on a shared approach. It’s easier to rapidly pump out breaking changes while only 1 team is using a draft component. We don’t need to knuckle down on finessing a component until we’re sure we want to keep it. This means anyone can add a draft component with minimal barriers using a component-first development approach to building new UI. Multiple teams can also build on existing draft components instead of simultaneously building their own version of the same component in their own applications.</p><p>When we do upgrade a draft package to a core component, we’ll have road-tested the idea and formed ideas around what we call it. We have a component for drawing attention to primary content called a <a href="https://cultureamp.design/components/hero-card/">Hero Card</a> that evolved from using that element as the hero of the page. We could have called it a “panel” or “container” or something else, but real usage led to a name that works for us and describes the intent.</p><h3>Shared language reduces the hidden costs of conversations</h3><p><strong>The hidden cost of conversations is hideously expensive.</strong> Designers and developers spend a lot of time clarifying details. For example:</p><ul><li>What shade of blue is that?</li><li>Where’s the logo file in SVG?</li><li>How many pixels is the padding?</li><li>Is this a new button? Are we updating all the buttons?</li></ul><p>A while ago I spoke about <a href="https://didoesdigital.com/blog/talk-ui-patterns-for-design-systems-designops-meetup-august-2019/">UI Patterns for Design Systems at the DesignOps, Melbourne meetup</a> and I shared <a href="https://www.instagram.com/p/B022LYDAlop/?utm_source=ig_embed">a slide showing some napkin math</a> on these hidden costs that resonated with a lot of the people I spoke to there:</p><figure><img alt="Hidden cost of conversation: 30 min per day * 250 days per year * $30 / hour * 27 designers &amp; developers = $101,000 per year." src="https://cdn-images-1.medium.com/max/1024/1*Rnbsw6cuq_VDG4iA7N1OrA.png" /><figcaption>Conversations cost enough to hire a design systems team.</figcaption></figure><p>I have seen many debates on the finer differences between <a href="https://cultureamp.design/guidelines/link-vs-button/">links and buttons</a>, and what cursor a button should show on hover. Design systems are a great way to cut through the noise with a documented stance.</p><h3>Stand on the shoulders of giants to fast-track learning</h3><h4><strong>There’s no need to reinvent the wheel</strong></h4><p>Where possible, we build on the community of practice around design systems and open-source component libraries. Before building any new component, we look for existing code in our product. For example, we’ll inspect custom components that are tightly coupled with application code or workarounds such as checkboxes where we wanted to use <a href="https://cultureamp.design/components/toggle-switch-field/">Toggle Switch</a> before we developed that component.</p><p>We also look externally to find 3 examples of someone who’s done this before. For example, many of our documentation site’s component pages include external links to design systems, W3C specifications, accessibility articles, and copy guidelines. See <a href="https://cultureamp.design/components/text-field/#external-links">Text Field</a> for an example. As an added bonus, picking apart other component libraries is one of my favourite ways to learn accessibility considerations.</p><p>This kind of internal and external exploration means we build on conventions. On top of the pay-off in consistency for users, these conventions also make it easy to onboard new designers and engineers: we already have some shared language.</p><h4><strong>The effect of every decision in a design system is multiplied</strong></h4><p>For example, people copy what’s already there. This means good decisions are amplified, so a design system teaches as much as it enables. This also means bad decisions can proliferate. Learning fast is important to nipping iffy decisions in the bud and fast-tracking improvements.</p><h3>Naming things is hard</h3><h4><strong>Validate names before shipping</strong></h4><p>Shared language is critical in a successful design system, and naming components and props is a huge part of that. We verify our component names with designers and engineers before settling on anything. We also use respected industry guidelines like W3C specifications and popular frameworks to inform our choices.</p><p>More recently, <a href="https://www.uiguideline.com/">UIGuideline</a> has emerged as “The definitive guide to standardize the UI Components naming” and I am excited by its potential. Renaming components comes with breaking changes and a small amount of change management overhead, so this is another example where it’s cheaper to change it earlier in the process.</p><figure><img alt="Modal component page on Kaizen Site. The Modal is also known as: Modal window, Dialog, Pop up, Alert, Lightbox, Overlay." src="https://cdn-images-1.medium.com/max/1024/1*AUHhu3SSiBzqzkCjnvrTrA.png" /><figcaption>Which component do you suppose has the most naming variations?</figcaption></figure><h4><strong>Avoid “type” and “variant”</strong></h4><p>Because naming things is hard, a common pattern we see is naming React component props “type” or “variant”. Unfortunately, this not only makes it hard to know what that property does, it is used inconsistently across components. Where possible, we choose more specific and concrete names to make our code more self-evident. In one case, we worked around “type” and “variant” by coming up with something a little unusual. Many of our components have come in a set of “Positive”, “Informative”, “Cautionary”, and “Negative” moods to create an emotional impact and contextualise information. <a href="https://cultureamp.design/guidelines/moods/#naming">We named them “moods”</a>.</p><h4><strong>Search engine optimise component names</strong></h4><p>Internally, we use our chosen component names fairly consistently. That said, to help onboarding new designers and engineers, we also show alternative names on component guideline pages and within Figma via the “Description” field. Extra names in the description field in Figma ensure you can search for “pop up” and it’ll return the “Modal” component as we call it.</p><figure><img alt="Figma search for “pop up” shows Modal results. The Modal description includes alternative names, such as “pop up”." src="https://cdn-images-1.medium.com/max/920/1*FuBXPKv0DBTmTGCU3hnYiQ.png" /><figcaption>For the record, I despise pop ups.</figcaption></figure><h3>Onwards and upwards</h3><p>Building Culture Amp’s Kaizen design system has been a journey. The team is about to evolve and I expect we’ll keep reiterating the value of shared language while we steward the next phase of increasing adoption and accelerating the design system and our product teams. Meanwhile, here are the key takeaways of the adventure so far.</p><p>Use <strong>Storybook</strong> or similar to improve separation of presentation, data, and application logic. Storybook can surface edge cases. It makes it faster to eyeball different states. Storybook also supports visual regression testing and gives designers live access to built components.</p><p>Use <strong>branch previews</strong> to empower designers to participate in development as it progresses rather than after shipping. Branch previews also improve asynchronous collaboration and create inclusive remote working practices. They also let you see changes in context.</p><p>Internal <strong>open source</strong> increases shared ownership. It lets you take advantage of the power of the crowd, engage all disciplines, produce a stronger system, and attract top talent.</p><p>Use <strong>design tokens</strong> to ensure a consistent design system and reduce hidden costs. Agree on design tokens, create a single source of truth, and use them everywhere. This lets you roll out changes fast.</p><p>Streamline <strong>versioning and release management</strong>. This is key to unblocking engineers and lowering the barriers to contributing.</p><p><strong>Shared language</strong> improves communication and reduces wasted time, lowering product development costs.</p><p><strong>Fast-track learning</strong> by looking internally and externally for expertise. Don’t waste time building things from scratch and reinventing the wheel. The effect of every decision in a design system is multiplied.</p><p><strong>Naming things</strong> is hard. Don’t go it alone.</p><h3>About Diana MacDonald</h3><p><a href="https://didoesdigital.com/">Diana MacDonald</a> is the author of <a href="https://didoesdigital.com/project/book-practical-ui-patterns-for-design-systems/">Practical UI Patterns for Design Systems</a> and creator of <a href="https://didoesdigital.com/project/typey-type/">Typey Type for Stenographers</a>. She led the <a href="https://cultureamp.design/">design systems</a> team at <a href="http://cultureamp.com/">Culture Amp</a>. Raised in the tropical north of Australia, she has spent the last decade in the tech industry, exploring the digital space with progressive organisations like Culture Amp, Bellroy, and SitePoint. Blurring the lines of designer and developer, she believes in the value of considered, inclusive, and remarkable stories. She wants to help you effortlessly execute your digital ideas.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67d28181246" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning data viz with D3]]></title>
            <link>https://medium.com/@didoesdigital/learning-data-viz-with-d3-8b54afcef74?source=rss-e64e183269d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b54afcef74</guid>
            <category><![CDATA[d3js]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[vega-lite]]></category>
            <dc:creator><![CDATA[Diana MacDonald]]></dc:creator>
            <pubDate>Mon, 25 May 2020 02:29:55 GMT</pubDate>
            <atom:updated>2020-05-25T02:29:55.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DtHCYKOLbsHEOSEB" /><figcaption>Photo by <a href="https://unsplash.com/@hishahadat?utm_source=medium&amp;utm_medium=referral">Shahadat Rahman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It was a Sunday morning in Melbourne. Having watched a few video courses on data viz with D3, I decided to set myself a goal: by the end of 2020, I will feel confident to design data visualizations of the complexity and visual impact of those by the New York Times. Today marks 30 days on that journey.</p><p>For me, data viz is a creative outlet, and a powerful intersection of design and code. It lets you tell captivating stories. The satisfaction of producing something visual, something alive with motion that you can interact with, keeps me motivated to keep playing. And because everything is new, I’m learning an incredible amount really quickly, and that fast feedback loop is compelling. Gamification is built right in.</p><p>For 30 days, I journalled in a notebook on <a href="https://observablehq.com/">Observable</a>, learning out loud as I begin the journey to master this craft. You can find all my entries in this collection, <a href="https://observablehq.com/collection/@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>Journal: Getting Started with Data Viz</strong></a>.</p><p>Here are the resources I used, my learning process, and a reflection on the journey so far. The second half of this story is an appendix that summarises the journal entries.</p><p><strong>Resources</strong></p><ul><li>Learning what “good” looks like</li><li>Data exploration and visualization tools</li></ul><p><strong>Process</strong></p><ul><li>Step 1: Gather resources</li><li>Step 2: Data exploration</li><li>Step 3: Data visualization</li></ul><p><strong>Reflections</strong></p><ul><li>The learning curve</li><li>Gather resources as you go</li><li>Weeding out the noise</li><li>Avoiding mistakes</li><li>Finding your way in D3 docs</li><li>Motivating projects</li><li>Conclusion</li></ul><p><strong>About Diana MacDonald</strong></p><p><strong>Appendix</strong></p><ul><li>Journal entries</li></ul><h3>Resources</h3><h3>Learning what “good” looks like</h3><p>When I teach <a href="https://didoesdigital.com/project/design-for-engineers/">design for coders</a>, I encourage engineers to crank up the volume on design in their lives. Follow designers on Twitter, subscribe to newsletters, have coffee with designers at work. A lot of engineers learn to build websites from “hello world” examples with no styling, so it’s important to start improving the balance of how much quality design they’re seeing day to day. Lots of engineers also tell me they don’t “have an eye for design” or don’t know what sources to trust because “design is subjective”, so it’s helpful to have a hand in changing that.</p><p>Here are some of the industry legends in data viz recommended to me. Their works have helped me learn what “good” looks like in data viz:</p><ul><li><a href="https://www.visualcinnamon.com/about"><strong>Nadieh Bremer</strong></a></li><li><a href="http://giorgialupi.com/"><strong>Giorgia Lupi</strong></a></li><li><a href="http://www.stefanieposavec.com/"><strong>Stefanie Posavec</strong></a></li></ul><p>And some folk to follow on Twitter:</p><ul><li><a href="https://twitter.com/sxywu"><strong>Shirley Wu on Twitter</strong></a></li><li><a href="https://twitter.com/Wattenberger"><strong>Amelia Wattenberger on Twitter</strong></a></li><li><a href="https://twitter.com/DataToViz"><strong>Susie Lu on Twitter</strong></a></li></ul><figure><img alt="Photo of Nadieh Bremer’s Hubble’s 30-year legacy project showing scientific observation data stylised as a constellation" src="https://cdn-images-1.medium.com/max/1024/0*1mACxrQpqY6qLXoe.jpg" /><figcaption><a href="https://www.visualcinnamon.com/portfolio/hubble-30-years">Hubble’s 30-year legacy by Nadieh Bremer</a></figcaption></figure><h3>Data exploration and visualization tools</h3><p>During the first 30 days, I explored data in Vega-Lite and then levelled up with a D3 visualization:</p><ul><li><a href="https://vega.github.io/vega-lite/"><strong>Vega-Lite</strong></a><strong>:</strong> a visual grammar for specifying charts in JSON. It’s convenient for quickly switching between “marks” (bar, area, point, etc.) with a single underlying data set to get a sense of the shape of the data.</li><li><a href="https://d3js.org/"><strong>D3</strong></a><strong>:</strong> A JavaScript library for visualizing data with HTML, SVG, and CSS. It’s powerful and works seamlessly on the web. It’s a swiss-army knife for visualising data in digital products, making it a great tool for web developers.</li></ul><p>Moving forward, I want to skip Vega-Lite and instead use <a href="https://app.datawrapper.de/chart/create">Data wrapper</a>. It’s a much faster method to see your data, while D3 gives you far greater control over the final results.</p><p>To search D3 documentation by method name and so on, I use <a href="https://kapeli.com/dash">Dash</a>.</p><figure><img alt="Alfred search “- d3: domain” results: time, point, ordinal, quantile, quantize, diverging, threshold, continuous &amp; sequential" src="https://cdn-images-1.medium.com/max/1024/1*BdfqAP7nhwUDgkYfTzJpew.png" /><figcaption>I use Dash’s integration with <a href="https://www.alfredapp.com/">Alfred</a> to quickly search D3 docs</figcaption></figure><h3>Process</h3><p>Data visualization has a wildly steep learning curve. It’s multidisciplinary, requiring expertise in data, design, and development. Within each, you need to learn the theory and tools, as well as practice the craft.</p><p>To start with, I wanted to focus on only the development step. This is a challenging place to start — you cannot build a visualization without data or design. This may have made it more difficult for myself, but it helped me get to a tangible outcome faster: produce charts.</p><p>While building my <a href="https://observablehq.com/@didoesdigital/25-apr-2020-first-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection">first bar chart</a>, I needed to learn the minimum amount about Observable itself and data wrangling.</p><p><strong>Observable:</strong></p><ul><li><a href="https://observablehq.com/@observablehq/user-manual"><strong>Observable user manual</strong></a>. If you’re learning Observable, I suggest you read at least the first two sections. Side note: Observable is hands down the best live coding environment I’ve used. Blows codepen, JSfiddle, and all the others out of the water. It’s snappy and reliable. You can edit a cell, run it, and see the result instantly.</li></ul><p><strong>Data wrangling</strong>:</p><ul><li><a href="https://observablehq.com/@info474/javascript-data-wrangling?collection=@info474/tutorials"><strong>JavaScript Data Wrangling by Michael Freeman, Interactive Info Vis</strong></a></li><li><a href="https://observablehq.com/@dakoop/learn-js-data"><strong>Learn JS Data on Observable</strong></a> based on <a href="http://learnjsdata.com/">Learn JS Data</a></li></ul><figure><img alt="Screenshot of Observable’s User Manual with an illustration of a child reading a book" src="https://cdn-images-1.medium.com/max/1024/1*Y4JOmH3bFTj3KFyyqjnciw.png" /><figcaption>Observable’s user manual is itself an Observable notebook linking to info about its awesome features</figcaption></figure><h3>Step 1: Gather resources</h3><p>For each chart type I wanted to learn, I’d start with learning some theory. I’d focus on the function of the chart, such as comparison, concept visualisation, correlation, distribution, geographical data, part to whole, or trend over time. I’d also consider the appropriate data types for them and look out for caveats. Finally, I’d compare them to similar charts, such as differentiating line charts from sparklines or scatterplots in <a href="https://observablehq.com/@didoesdigital/10-may-2020-line-charts?collection=@didoesdigital/journal-getting-started-with-data-viz-collection">10 May 2020: Line charts</a>.</p><p>For learning the <strong>theory</strong>:</p><ul><li><a href="https://datavizproject.com/"><strong>Dataviz project</strong></a></li><li><a href="https://datavizcatalogue.com/"><strong>Dataviz catalogue</strong></a></li><li><a href="https://www.data-to-viz.com/#portfolio"><strong>Data to viz: all</strong></a></li></ul><p>Standing on the shoulders of giants, I would then check out visual examples, code examples, and examples in design systems.</p><p>For <strong>visual examples</strong>:</p><ul><li><a href="https://www.pinterest.com.au/search/pins/?q=stream%20graph"><strong>Search Pinterest</strong></a></li><li>On <a href="https://datavizproject.com/"><strong>Dataviz project</strong></a>, each chart comes with visual examples, such as you can see under <a href="https://datavizproject.com/data-type/stream-graph/">Stream graph</a></li><li><a href="https://www.nytimes.com/section/upshot"><strong>The Upshot</strong></a> by The New York Time and other news sites</li><li><a href="https://about.chartipedia.com/"><strong>Chartipedia</strong></a> and <a href="https://beta.grafiti.io/"><strong>Grafiti.io</strong></a> chart search engines</li></ul><p>For <strong>code examples</strong>:</p><ul><li><a href="https://observablehq.com/search?query=stream%20graph"><strong>Search Observable</strong></a></li></ul><p>For <strong>design systems</strong>:</p><ul><li><a href="https://polaris.shopify.com/design/data-visualizations"><strong>Shopify, Polaris: Data visualizations</strong></a></li><li><a href="http://designsystem.morningstar.com/charts/getting-started.html"><strong>Morningstar Design System: Charts</strong></a></li><li><a href="http://urbaninstitute.github.io/graphics-styleguide/"><strong>Urban Institute Data Visualization Style Guide</strong></a></li><li><a href="https://g2plot.antv.vision/en/examples/gallery"><strong>AntV: G2Plot a charting library</strong></a></li></ul><p>For any remaining questions I had, I would <strong>search Slack</strong> archives:</p><ul><li><a href="https://www.datavisualizationsociety.com/"><strong>Data Visualization Society</strong></a></li><li><a href="https://d3-slackin.herokuapp.com/"><strong>D3 Slack</strong></a>, linked from the <a href="https://github.com/d3/d3/wiki#help--community">D3 wiki</a></li></ul><p>Even if you’re not into live chat, these Slack communities are a treasure trove of questions answered by industry experts, so you can treat them like a modern and kind Stack Overflow for data viz.</p><figure><img alt="Screenshot of Gallery notebook showing 20 thumbnails of visualizations in other notebooks" src="https://cdn-images-1.medium.com/max/1024/1*YZnz5G6aT3wtPd2RQC1c6A.png" /><figcaption>The Observable D3 <a href="https://observablehq.com/@d3/gallery">Gallery by Mike Bostock</a> is an amazing resource</figcaption></figure><h3>Step 2: Data exploration</h3><p>For each chart type, I would assemble a dataset appropriate to that chart type. Either I would collect my own or search for a beginner-friendly dataset (that is clean and not missing data):</p><ul><li><a href="https://github.com/vega/vega-datasets"><strong>Vega Datasets</strong></a></li><li><a href="https://github.com/observablehq/datasets"><strong>Observable datasets</strong></a></li></ul><p>To see the shape of the data and learn a data exploration tool, I’d build each chart type in Vega-Lite:</p><ul><li>My notebook on <a href="https://observablehq.com/@didoesdigital/working-with-vega-lite?collection=@didoesdigital/reference"><strong>Working with Vega-Lite</strong></a></li><li><a href="https://observablehq.com/@uwdata/data-visualization-curriculum?collection=@uwdata/visualization-curriculum"><strong>Data Visualization Curriculum by Jeffrey Heer</strong></a></li><li><a href="https://observablehq.com/collection/@observablehq/observable-for-vega-lite"><strong>Observable for Vega-Lite by Visnu Pitiyanuvath</strong></a></li></ul><figure><img alt="Screenshot of Vega-Lite homepage" src="https://cdn-images-1.medium.com/max/1024/1*NbgMCAGOmOzjgUwA5bAwuw.png" /><figcaption>Vega-Lite is a JSON specification format for rapidly creating charts</figcaption></figure><h3>Step 3: Data visualization</h3><p>After gathering resources and exploring data, I built charts in D3. Generally, I’d find a handful of working notebooks on Observable and recreate them by hand from memory instead of forking, to ensure I understood every line.</p><p>For <strong>learning D3</strong>, I recommend reading these tutorials:</p><ul><li><a href="https://observablehq.com/@uwdata/introduction-to-d3"><strong>Introduction to D3 by Tongshuang Wu, UW Interactive Data Lab</strong></a></li><li><a href="https://wattenberger.com/blog/d3"><strong>How to learn D3 by Amelia Wattenberger</strong></a></li><li><a href="https://wattenberger.com/blog/d3-interactive-charts"><strong>Interactive Charts with D3.js by Amelia Wattenberger</strong></a></li><li><a href="https://observablehq.com/@d3/learn-d3"><strong>Learn D3: Introduction by Mike Bostock</strong></a></li></ul><p>For <strong>more resources</strong>, see my <a href="https://observablehq.com/@didoesdigital/links?collection=@didoesdigital/reference"><strong>Links notebook on Observable</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNB15PBqL9VVlH8Iat8vTg.png" /><figcaption>How to learn D3.js by Amelia Wattenberger uses plain English and clear visuals to teach D3</figcaption></figure><h3>Reflections</h3><h4>The learning curve</h4><p>Beyond data viz being a multidisciplinary field, learning to wield D3 requires advanced knowledge of SVG, JavaScript, and CSS, and a healthy amount of patience. Otherwise, it can be challenging to learn these web languages at the same time while attempting to debug and overcome setbacks.</p><p>I’ve tackled projects with steep learning curves before, though one notable difference is the amount you need to learn in data viz before you can reliably produce a single, basic visualization. With most other projects, I’ve worked quickly to skill up enough to complete the first, end-to-end realistic piece of work, before continuing on to iterate, refine, practice and expand on that end-to-end piece. For example:</p><ul><li>In music, you might focus on slowly playing a song correctly, before building up speed.</li><li>In product design, you might focus on producing a minimum viable product, then evolve from there.</li><li>In web development, you might focus on scaffolding an app and deploying it to the Internet, then building it out from there.</li></ul><p>In data visualization, there’s very little you can achieve without first grasping data collection, cleaning, and other wrangling. You must also know how to code, and learn a new library. With D3, especially, you need to know exactly what you’re trying to achieve with every mark, axis, label, legend, and interaction. This means applying visualization design principles at the same time as coding.</p><blockquote><em>Little strokes fell great oaks</em></blockquote><p>It’s easier to tackle a huge task with steady and persistent effort. Aim for 1% better everyday. I made this work for me by aiming to publish a notebook everyday. There was no minimum length or time required (though I am sure it would feel silly to publish a single sentence). Sitting down to write 1 notebook and otherwise change 1 line of code was enough to keep data viz top of mind for 30 days. But it’s easy to focus on the first five minutes to get yourself started.</p><figure><img alt="Screenshot of Observable journal collection showing the first 9 notebooks with slightly varying bar charts" src="https://cdn-images-1.medium.com/max/1024/1*MJ_X_u5xMHTz87ygnCUEZA.png" /><figcaption>My daily journal led to small, consistent effort… and then not wanting to <a href="https://doist.com/blog/dont-break-the-chain/">break the chain</a></figcaption></figure><h4>Gather resources as you go</h4><p>Along the way, I published useful <a href="https://observablehq.com/@didoesdigital/links?collection=@didoesdigital/reference">Links</a> in Observable.</p><p>Whenever I stumbled across a link that might be useful in the future but I wasn’t ready to look at it yet, I collected it in my private notes. When the day arrives that I want to build maps or learn Python, I already have great resources to fast-track that effort. Once I’ve road tested them, I’ll add them to my published links notebook.</p><figure><img alt="Screenshot of ObservableReference collection includes links, working with Observable, working with Vega-Lite, and a sparkline" src="https://cdn-images-1.medium.com/max/1024/1*Y6Ng-qwquf4KoM8uXJHzWA.png" /><figcaption>I regularly refer back to my <a href="https://observablehq.com/collection/@didoesdigital/reference">reference collection</a></figcaption></figure><h4>Weeding out the noise</h4><p>D3 changed a lot from v3 to v4, and again some to v5. At this time, the Internet is still chockers with tutorials and blog posts for older versions. Some key things to look out for:</p><ul><li>Use <a href="https://observablehq.com/@d3/selection-join"><strong>.join()</strong></a> instead of .enter(), .update() and .exit() in the <a href="https://observablehq.com/@d3/general-update-pattern">general update pattern</a>.</li><li>Use <a href="https://github.com/d3/d3-delaunay"><strong>d3-delaunay</strong></a> instead of the deprecated <a href="https://github.com/d3/d3-voronoi">d3-voronoi</a>.</li><li>Use scale variables named x, y, and color instead of xScale, yScale, and colorScale.</li></ul><figure><img alt="Scatterplot of exercise in April–May 2020" src="https://cdn-images-1.medium.com/max/1024/1*idDiRlts5bDUFykdlect7A.png" /><figcaption>This scatterplot shows a voronoi overlay for triggering tooltips</figcaption></figure><h4>Avoiding mistakes</h4><p>Where possible, learn from <a href="https://observablehq.com/@mbostock"><strong>Mike Bostock’s notebooks</strong></a>. They’re the most up-to-date notebooks you’ll find and follow lots of great conventions that will save you headaches, even before you understand the reasons for them. One drawback is that these SVGs don’t appear to have been designed accessibly.</p><p>What to use in your own notebooks:</p><ul><li>Use a specific version of D3 (or other modules) in imports e.g. d3 = require(&quot;d3@5&quot;)</li><li>Use generic, conventional variable names, such as x, y, xAxis, yAxis, margin, height, and data. This makes it easy to adapt other people’s code to your needs.</li><li>Similarly, rename columns or row headers from your data when you load it in so you can reuse your own chart code with different datasets and only update your code in 1 place (the data cell) instead of every cell where the data field names are used. For example: Object.assign(d3.csvParse(await FileAttachment(…).text(), ({MyDataTitleField: name, MyDataXField: x, MyDataYField: y}) =&gt; ({name, x: +x, y: +y}))). Learn more in <a href="https://observablehq.com/@didoesdigital/23-may-2020-area-charts-in-vega-lite-and-csv-parsing?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>23 May 2020: Area Charts in Vega-Lite and CSV Parsing</strong></a>.</li><li>Pin a data[0] cell to remind yourself what the data looks like.</li></ul><p>What to look out for when learning from other people’s notebooks:</p><ul><li>Check the D3 import in the appendix at the end to see if it’s pulling in other modules.</li><li>Check the data cell to see what data wrangling work might be necessary and the shape of the data.</li><li>Check the appendix for anything else unusual.</li></ul><p>Some debugging tips I’ve figured out:</p><ul><li>To console.log() something in the middle of a chain of method calls, you can return console.log(variable) || (notice the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR">logical OR</a> pipes ||). For example: .join(&quot;circle&quot;).attr(&quot;stroke&quot;, d =&gt; console.log(d) || d.r)</li><li>To test the behaviour of your scale functions, first try to run it with any data like x(123) instead of intended usage, x(d.x)</li><li>Check your brackets, e.g. .range([height - margin.bottom, margin.top]); (one challenge of Observable is debugging when silly stuff happens like forgetting brackets)</li><li>Give elements that you append IDs or classes to make them easier to identify during debugging and to make sure they don’t clash with other things on the page (if you put your chart on a page with other elements). That is, don’t depend on broad selectors, such as d3.selectAll(&#39;path&#39;).</li></ul><figure><img alt="Area chart showing 863 cumulative cells written in 28 Observable notebooks in April and May" src="https://cdn-images-1.medium.com/max/916/1*njPJRHFMztz4OvgTGWeohw.png" /><figcaption>By May 23rd I’d written roughly 863 paragraphs or code blocks</figcaption></figure><h4>Finding your way in D3 docs</h4><p>D3’s documentation is written in a style that’s not intuitive to me. Here are some hints to give you the lay of the land:</p><ul><li>Many functions are <a href="https://en.wikipedia.org/wiki/Function_overloading">overloaded</a>. This means the function will do one thing with no arguments, something else with 1 argument, something else with an argument of a different type, and so on. You may need to scroll up and down the docs to find adjacent explanations for a function called with different arguments.</li><li>To learn about, for example, .domain() on a scaleLinear(), you need know that scaleLinear()is a type of <a href="https://github.com/d3/d3-scale#continuous-scales"><em>continuous</em> scale</a> (along with power, log, identity, time, and radial), so you need to search for <a href="https://github.com/d3/d3-scale#continuous_domain">continuous.domain()</a></li><li>To learn about, for example, .on(), you need know that it’s used on a <a href="https://github.com/d3/d3-selection#d3-selection"><em>selection</em></a>, such as d3.select(), d3.selectAll(), d3.create(), so you need to search for <a href="https://github.com/d3/d3-selection#selection_on">selection.on()</a>. In examples, it will also likely appear after a selection’s “transformation method”, such as selection.attr(), selection.classed(), selection.style(), selection.text(), selection.html(), selection.append(), or selection.insert().</li><li>There are loads of aliases and the like, so reading the docs can mean bouncing around a lot, following links to “equivalent” functions.</li><li>There’s a bit of jargon to wrap your head around and it’s often not linked to a definition. Sometimes the jargon isn’t explicitly defined anywhere, just sort of inferred. I found myself occasionally rewriting documentation to strip out the jargon so I could make sense of it. As an example, compare the <a href="https://github.com/d3/d3-shape#line_defined">line.defined()</a> documentation with my explanation of line.defined() in <a href="https://observablehq.com/@didoesdigital/12-may-2020-d3-line-chart#line-defined-"><strong>12 May 2020: D3 Line Chart</strong></a>.</li><li>Sometimes the syntax is buried within prose, but it’s worth digging for. I’d prefer to see the parameters and return values called out more prominently, like I’ve seen in documentation on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map#Syntax">MDN</a>.</li></ul><p>I’m under the impression there’s a huge amount of work under way to migrate old tutorials and examples from <a href="https://bl.ocks.org/">bl.ocks.org</a> to Observable. Some folk are putting in an incredible effort to ease the learning curve into D3, and I’m excited about where it’s headed.</p><figure><img alt="Hovering over each line shows that country’s life expectancy, including Rwanda at 24 years during the Rwandan Civil War" src="https://cdn-images-1.medium.com/max/911/1*xxFws1fBWt79oKmx5NyjRw.gif" /><figcaption>This multi-line chart with annotations shows the effect of the Rwandan Civil War on life expectancy</figcaption></figure><h4>Motivating projects</h4><p>Given the steep learning curve, I’ve heard a few folk talk about finding motivating and manageable projects. In this round up, <a href="https://medium.com/volt-data-lab/to-learn-data-visualization-look-for-small-problems-first-df34fc4630a0">Mike Bostock to humans: ‘Try to look for small problems first’ by Sérgio Spagnuolo on the Mike Bostock, Reddit AMA</a>, there were a few quotes that stood out to me:</p><blockquote><em>Try to look for small problems first, the sort of thing you can solve once per day, whenever you have time. The rewards from early victories are strong motivation to keep going.</em></blockquote><blockquote><em>… think of small coding problems that you are comfortable solving, and then increasingly ramp up to larger problems as you go. The satisfaction you derive from solving the smaller problems will motivate you to keep going.</em></blockquote><blockquote><em>I find it to be the easiest thing in the world to work on something if you are passionate about it, and you can break it up into small pieces (like examples) that you can publish and share with others for external validation. So probably, choosing to work on things you are excited about, and then finding space to avoid distractions or interruptions is the key.</em></blockquote><p>Along a similar vein, Josh Temple wrote in <a href="https://medium.com/@josh.temple/why-i-abandoned-online-data-courses-for-project-based-learning-17e350fd9347">Why I abandoned online data courses for project-based learning</a>:</p><blockquote><em>The key is to find a project that you’re so excited to bring to reality that you don’t mind pushing through the obstacles along the way. Here are four attributes that I find make a project motivating. Maximize one or more of these and you’ll have a much better chance of actually finishing your project.<br>- Utility: “This would make my life easier and save me time.”<br>- Passion: “This would solve a problem I deeply care about.”<br>- Curiosity: “This dataset really intrigues me and I want to explore it more.”<br>- Competition: “I want to win this prize and beat other competitors.”</em></blockquote><p>For my part, I’m yet to tackle a large and meaningful project, so the greater challenges are persevering through bugs and maintaining momentum. I’ve mostly focused on tackling hard problems over the weekend with the time, space, and focus to work through thorny problems or track down documentation and solutions. On work days, I’ve scaled back my efforts to focus on learning theory or tweaking the previous day’s chart in some small way.</p><p>Once I have a good handle on the basic tools, I will be deciding on a lovable project. I am noodling with some ideas already.</p><figure><img alt="A donut chart of small batch scones ingredients, Buttermilk, Cold butter, and 62.5g Self-raising flour, from Sarah Cooks" src="https://cdn-images-1.medium.com/max/1024/1*t1cFAa4a9JRobP_SAQm9Xw.png" /><figcaption><a href="https://www.sarahcooks.com.au/2020/04/small-batch-scones.html">Small batch scones</a> are my favourite part of lockdown so far</figcaption></figure><h4>Conclusion</h4><p>And that’s a wrap. In the appendix below, you can find more details about what I covered and lessons learned each day in my journal.</p><ul><li>Follow me on <a href="https://twitter.com/didoesdigital"><strong>Twitter</strong></a> to see what happens when I make it to 100 days.</li><li>Join the <a href="https://www.datavisualizationsociety.com/"><strong>Data Visualization Society Slack</strong></a> to connect and chat about data viz.</li></ul><p>Otherwise, I only want to add that I’m grateful for the selfless people who have spent countless hours creating tutorials, books, and courses, and making them available for free. I’m inspired by the passionate creative coders who make beautiful works that have impact in the world, and share them everyday. Thanks so much for all that you do.</p><h3>About Diana MacDonald</h3><p><a href="https://didoesdigital.com/"><strong>Diana MacDonald</strong></a> is the author of <a href="https://didoesdigital.com/project/book-practical-ui-patterns-for-design-systems/"><strong>Practical UI Patterns for Design Systems</strong></a> and creator of <a href="https://didoesdigital.com/project/typey-type/"><strong>Typey Type for Stenographers</strong></a>. She leads the <a href="https://cultureamp.design/">design systems team</a> at <a href="http://cultureamp.com/">Culture Amp</a>. Raised in the tropical north of Australia, she has spent the last decide in the tech industry, exploring the digital space with progressive organisations like Culture Amp, Bellroy, and SitePoint. Blurring the lines of designer and developer, she believes in the value of considered, inclusive, and remarkable stories. She wants to help you effortlessly execute your digital ideas.</p><h3>Appendix</h3><p>Topics covered and lessons learned each day in <a href="https://observablehq.com/collection/@didoesdigital/journal-getting-started-with-data-viz-collection">Journal: Getting Started with Data Viz</a>.</p><h4>Day 1–7: Learning the basics with bar charts</h4><p><a href="https://observablehq.com/@didoesdigital/25-apr-2020-first-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>25 Apr 2020: First Bar Chart</strong></a></p><ul><li><a href="https://trends.google.com/trends/explore?geo=US&amp;q=data%20viz,dataviz">Google Trends</a> suggests that “data viz” is more common than “dataviz” in the US, but <a href="https://trends.google.com/trends/explore?q=data%20viz,dataviz">globally they’re almost on par</a>.</li><li>D3 bar chart.</li></ul><p><a href="https://observablehq.com/@didoesdigital/26-apr-2020-bar-chart-revisited?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>26 Apr 2020: Bar Chart Revisited</strong></a></p><ul><li>Setting .padding(0.1) reduces the width of each bar rather than adding space between each bar. This makes sense for conveniently working with bars and increasing padding without blowing the whole chart out.</li><li>.tickSizeOuter(0) removes the stump on the bottom left of the chart (it hides the first tick on the axis)</li><li>.nice() ensures the top of the chart finishes at 13% instead of 12% with the highest bar poking above the highest tick.</li><li><a href="https://github.com/observablehq/stdlib#width">width</a> is the current width of a cell and is part of Observable’s standard library. It is a Reactive variable that instantly responds to changes in the window size.</li><li>“Use caution when applying global styles: if a style affects a cell’s height, the runtime may not notice unless the affected cell is re-evaluated.” — <a href="https://observablehq.com/@observablehq/introduction-to-html">Introduction to HTML</a></li><li>Some numbers can’t be represented in binary floating-point, meaning code like tickFormat(d =&gt; (d * 100) + &quot;%&quot;) can produce “7.000000000000001%” instead of 7%. You <em>could</em> force a “fix” using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed">.toFixed([digits])</a>, or round it using Math.round(yourNumberHere * 10 ) / 10, but use the better option, d3.format(&quot;.1f&quot;) from the <a href="https://github.com/d3/d3-format/blob/master/README.md#d3-format">d3-format</a> module.</li><li>Showing the median as a line when it’s one value or highlighting bars when it’s two.</li></ul><p><a href="https://observablehq.com/@didoesdigital/27-apr-2020-finalising-the-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>27 Apr 2020: Finalising the Bar Chart</strong></a></p><ul><li>The general term for lines showing the median, mean, benchmarks, or “best fit” is “reference line” (or “reference band” for showing a range).</li><li>Use .attr(&#39;dy&#39;, &#39;1em&#39;) (specifically 1em) to shift text along its y-axis by the height of the text.</li><li>Set styles using .style(&#39;font&#39;, &#39;400 12px/1.5 &quot;Work Sans&quot;, &quot;Open Sans&quot;&#39;) instead of .attr(&#39;style&#39;, &#39;font: 400 12px/1.5 &quot;Work Sans&quot;, &quot;Open Sans&quot;&#39;)</li><li>Use Object.assign(target, ...sources) to add labels for axes as properties to the data object after parsing it. Add the await keyword to ensure the data promise is resolved before adding the new properties to it.</li><li>There is no translateY SVG transform (it’s a CSS transform). Use translate instead e.g. .attr(&#39;transform&#39;,translate(456, 0))</li><li><a href="https://observablehq.com/@d3/styled-axes">Styled axes by Mike Bostock</a>. Use a right axis with tick sizes that match the length of the chart to push it to the left side of the chart.</li><li><a href="https://stackoverflow.com/questions/11189284/d3-axis-labeling/11194968#11194968">Mike Bostock’s Stack Overflow answer to styling axes</a></li><li>D3 chart title.</li><li>D3 axes labels.</li></ul><p><a href="https://observablehq.com/@didoesdigital/28-apr-2020-what-else-i-learned-from-that-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>28 Apr 2020: What Else I Learned From That Bar Chart</strong></a></p><ul><li>Specify a specific version of D3 in the appendix to future-proof against breaking changes: d3 = require(&quot;d3@5&quot;)</li><li>band.range([range]) … sets the scale’s range to the specified two-element array of numbers.</li><li>band.rangeRound([range]) Sets the scale’s range to the specified two-element array of numbers while also enabling rounding. This will “give the results as integer values, using Math.floor() to avoid overflowing the range. This will usually leave some unused space, that must be allocated to the left and right padding (even if those have been set to 0). Align them with band.align.” —<a href="https://observablehq.com/@d3/d3-scaleband">d3.scaleBand on Observable</a></li></ul><p><a href="https://observablehq.com/@didoesdigital/29-apr-2020-setting-up-observable?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>29 Apr 2020: Setting up Observable</strong></a></p><ul><li>Interactions: Drag the slider to set the exit transition duration on mouseover/hover.</li><li>Use .align([align]) on bands to left all the bands to the left (0), center (0.5), or right (1).</li><li><a href="https://observablehq.com/@observablehq/introduction-to-views">Observable view</a>.</li></ul><p><a href="https://observablehq.com/@didoesdigital/30-apr-2020-what-else-can-i-do-with-this-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>30 Apr 2020: What Else Can I Do With This Bar Chart?</strong></a></p><ul><li>Reorder adding SVG elements so they appear in the correct order on screen. For example, ensure the bar value labels appear above the median line for readability.</li><li>A CSS hack to give labels some distinction: apply a white text shadow in 4 directions using .style(&quot;text-shadow&quot;, &quot;white 1px 1px, white -1px -1px, white 1px -1px, white -1px 1px&quot;)</li><li>D3 bar labels.</li></ul><p><a href="https://observablehq.com/@didoesdigital/1-may-2020-formatting-numbers-and-sorting-a-bar-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>1 May 2020: Formatting Numbers and Sorting a Bar Chart</strong></a></p><ul><li>D3 Format to format numbers the way you like using <a href="https://github.com/d3/d3-format/blob/master/README.md#format">d3.format</a>. This is a longer explanation of the format specifier.</li><li>Use JavaScript’s array.sort() to order bars before binding them.</li><li>D3 grouped bar chart with color.</li></ul><h4>Day 8–11: Data wrangling and exploration with Scatterplots</h4><p><a href="https://observablehq.com/@didoesdigital/2-may-2020-exploring-more-of-observable-and-vegalite?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>2 May 2020: Exploring More of Observable and Vega-Lite</strong></a></p><ul><li>Use HTML tagged literals to add CSS style tags: “html&lt;style&gt; .highlight { background: yellow; } &lt;/style&gt;”</li><li>Read Observable’s <a href="https://observablehq.com/@observablehq/introduction-to-html">Introduction to HTML by Mike Bostock</a> to learn about reactive Markdown, “${tex\KaTeX}” for math, sparklines for a chart inline with prose, using canvas, using D3, using SVG tagged template literals, using viewof to react to an input element’s changing value, and adding global CSS using html tagged template literals.</li><li>Read Observable’s <a href="https://observablehq.com/@observablehq/introduction-to-promises">Introduction to Promises by Mike Bostock</a> to learn about Observable’s delay, tick and when functions.</li><li>Read <a href="https://observablehq.com/@observablehq/observables-not-javascript">Observable’s not JavaScript by Mike Bostock</a> to learn some “gotchas” to look out for working with Observable, such as “you’ll need to wrap object literals in parentheses or use a block statement with a return” e.g. object = ({foo: &quot;bar&quot;}). It also introduces Observable’s “special mutable operator so you can opt-in to mutable state: you can set the value of a mutable from another cell”. Finally, it talks about how to import things across notebooks.</li><li>“inlineCode” helper to add some custom inline code styling in Observable.</li><li>D3 sortable bar chart.</li><li>Vega-Lite scatterplot.</li></ul><p><a href="https://observablehq.com/@didoesdigital/3-may-2020-exploring-more-vega-lite?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>3 May 2020: Exploring More Vega-Lite</strong></a></p><ul><li>I published a fork: <a href="https://observablehq.com/@didoesdigital/vega-lite-api-vega-lite-v4">Vega-Lite API Vega-Lite V4</a>. This way I can intentionally import Vega-Lite major version 4 into my notebooks. When Vega-Lite major version 5 comes out with non-backwards-compatible breaking changes, my older notebooks using this import won’t randomly break. This future-proofs my notebooks using Vega-Lite V4.</li></ul><p><a href="https://observablehq.com/@didoesdigital/4-may-2020-vega-lite-scatterplot-and-heat-map-and-more-posts-o?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>4 May 2020: Vega-Lite Scatterplot and Heat Map, and More Posts on Getting Started With Data Viz</strong></a></p><ul><li>Read Observable’s <a href="https://observablehq.com/@observablehq/introduction-to-imports">Introduction to Imports by Mike Bostock</a> to learn a bit more about Observable imports, like how imported cells are lazily evaluated and you can import from private notebooks, even though that could cause broken behaviour in a published notebook.</li><li>Use ~~~ for code fences in Observable including tagged code fences: ~~~js</li><li>The <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a">SVG hyperlink element </a><a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a">&lt;a&gt;</a> is a container around any shape. If it’s around a circle, it will have a circle-shaped hover/click target.</li><li>In Observable, a <strong>view</strong> is “a user interface element that directly controls a value in the notebook”. It has two parts: a view (typically an interactive DOM element) and value (any JavaScript value). See also: <a href="https://observablehq.com/@observablehq/introduction-to-views">Introduction to Views by Mike Bostock</a>.</li><li>It seems that a <strong>viewof</strong> is a second hidden cell that shows the current value of a user interface input element. See: <a href="https://observablehq.com/@observablehq/a-brief-introduction-to-viewof?collection=@observablehq/introduction">A Brief Introduction to Viewof by Mike Bostock</a>.</li></ul><p><a href="https://observablehq.com/@didoesdigital/5-may-2020-vega-lite-scatterplot-continued?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>5 May 2020: Vega-Lite Scatterplot continued</strong></a></p><ul><li>Scatterplot theory.</li><li>Vega-Lite proportional area (bubble) charts.</li><li>Vega-Lite color encoding.</li><li>Vega-Lite rows.</li><li>Vega-Lite quantize scale.</li><li>Heatmap theory.</li><li>Vega-Lite Heatmap.</li><li><a href="https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html"><strong>Tidy data</strong></a> is where:<br>1. Each variable forms a column<br>2. Each observation forms a row.<br>3. Each type of observational unit forms a table.</li></ul><h4>Day 12–15: D3 Scatterplots with legends and tooltips</h4><p><a href="https://observablehq.com/@didoesdigital/6-may-2020-d3-scatterplot?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>6 May 2020: D3 Scatterplot</strong></a></p><ul><li>Vega-Lite tooltips.</li><li>Vega-Lite grid removed.</li><li>Vega-Lite line mark interpolation.</li></ul><p><a href="https://observablehq.com/@didoesdigital/7-may-2020-d3-scatterplot?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>7 May 2020: D3 Scatterplot with Legends</strong></a></p><ul><li><a href="https://github.com/d3/d3-time-format/blob/master/README.md#d3-time-format">d3-time-format</a></li><li>Use man strftime on the command line to figure out the arguments for the d3.timeParse()function so that “%d” is replaced by the day of the month as a decimal number (01-31) and “%b” is replaced by national representation of the abbreviated month name.</li><li>Renaming fields upon parsing CSV data file. There’s a longer post about CSV parsing in <a href="https://observablehq.com/@didoesdigital/23-may-2020-area-charts-in-vega-lite-and-csv-parsing?collection=@didoesdigital/journal-getting-started-with-data-viz-collection">23 May 2020: Area Charts in Vega-Lite and CSV Parsing</a>.</li><li>A JavaScript Map for color const exerciseColorMap = new Map([[&quot;Bike&quot;, &quot;#8242a8&quot;], [&quot;Run&quot;, &quot;#ff1493&quot;], [&quot;Walk&quot;, &quot;#FFCE1E&quot;]]) to conditionally set the data points stroke color according to its type.</li><li>Read <a href="https://observablehq.com/@d3/scale-ticks">scale.ticks by Fil</a> to learn more about ticks. Roughly, .ticks() gives us the array of some values from the scale’s domain while .tickFormat() takes the same arguments and gives us the formatting for those ticks. This kind of detail is really helpful for making sense of the API: “The tick format provided by time scales ignores the specified count; the returned string is based solely on the given time. This is sometimes surprising, but allows the format to behave consistently across views when the domain changes, improving readability during animated transitions and zooming.”</li><li>A screenshot of creative commons licensing used in a notebook.</li><li>D3 scatterplot with legend</li></ul><p><a href="https://observablehq.com/@didoesdigital/8-may-2020-d3-scatterplot?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>8 May 2020: D3 Scatterplot with Tooltips</strong></a></p><ul><li>Read about Observable’s <a href="https://observablehq.com/@observablehq/introduction-to-require">Introduction to require</a>. You can have multiple inputs at once such as: d3CsvAndFetch = require(&quot;d3-dsv@1&quot;, &quot;d3-selection@1&quot;)</li><li>Using Mike Bostock’s <a href="https://observablehq.com/@d3/color-legend">color legend</a>, add swatches as a separate cell: swatches({ color: d3.scaleOrdinal([&quot;Bike&quot;, &quot;Run&quot;, &quot;Walk&quot;], [&quot;#8242a8&quot;, &quot;#ff1493&quot;, &quot;#FFCE1E&quot;]) })</li><li><a href="https://observablehq.com/@duynguyen1678/choropleth-with-tooltip">Choropleth with Tooltip by Duy Nguyen</a> shows an example of a <em>legend</em> presented on a chart using the same color legend notebook</li><li>Import Susie Lu’s <a href="http://d3-legend.susielu.com/">d3-legend</a> using: d3Legend = require(&#39;d3-svg-legend&#39;). Notice the ‘-svg-’ in the module name there unlike the name of the project.</li><li>D3 scatterplot with legend</li><li><a href="https://observablehq.com/@d3/selection-join">Selection join by Mike Bostock</a> shows a join example with separate enter and update behaviour.</li><li>D3 scatterplot with tooltips using <a href="https://observablehq.com/@d3/line-chart-with-tooltip">Line Chart with Tooltip by Mike Bostock</a>, callout and bisect.</li><li>I added a crude fix, if (!b) { return a; }, to prevents errors when mousing over right edge of chart. These errors appear in the <a href="https://observablehq.com/@d3/line-chart-with-tooltip">original notebook</a>.</li><li>SVG has its own span element for styling parts of text elements: <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/tspan">`tspan`</a>.</li><li>Read <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toLocaleString">MDN’s </a><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toLocaleString">toLocaleString</a> documentation</li><li><a href="https://observablehq.com/@stroked/voronoi-tooltip">Voronoi Tooltip by Ajayyy</a> shows notebook appendix formatting that chunks out “setup”, “scales”, and “data”. It also adds cells specifically for “plotAreaWidth” and “plotAreaHeight” to substract margins, which keeps some of that noise out of the chart cell: plotAreaWidth = width - margin.left - margin.right</li><li>Expand d3 imports with other modules: d3 = require(&quot;d3@5&quot;, &quot;d3-delaunay@5&quot;)</li></ul><p><a href="https://observablehq.com/@didoesdigital/9-may-2020-d3-scatterplot-with-voronoi-tooltips?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>9 May 2020: D3 Scatterplot with Voronoi Tooltips</strong></a></p><ul><li>“Use transparency to help with overlapping data points”.</li><li>Read this in-depth tutorial on <a href="https://www.visualcinnamon.com/2015/07/voronoi.html">Using a d3 voronoi grid to improve a chart’s interactive experience by Nadieh Bremer</a> to understand the intent and usage of voronoi in charts, but then read <a href="https://observablehq.com/@d3/learn-d3-interaction">Learn D3: Interaction by Mike Bostock</a> to learn how to use <a href="https://github.com/d3/d3-delaunay">d3-delaunay</a> to implement polygons for tooltip trigger regions.</li><li>It looks like <a href="https://github.com/d3/d3-delaunay">d3-delaunay</a> replaces <a href="https://github.com/d3/d3-voronoi">d3-voronoi</a> completely, even though d3.voronoi appears to be <a href="https://github.com/d3/d3/blob/master/API.md#voronoi-diagrams-d3-voronoi">built into d3 and recommended in the API docs</a> while d3-delaunay appears to be separate. The d3-voronoi repo shows this message: “<strong>Deprecation notice</strong>: Consider using the newer d3-delaunay instead of d3-voronoi. Based on Delaunator, d3-delaunay is 5-10× faster than d3-voronoi to construct the Delaunay triangulation or the Voronoi diagram, is more robust numerically, has Canvas rendering built-in, allows traversal of the Delaunay graph, and a variety of other improvements.”</li><li>Links to other articles and notebooks about using voronoi.</li><li>Voronoi tooltips with overlay.</li><li>Note: you don’t need the SVG overlay. It may be possible to use delaunay.find() directly without the overlay as shown in <a href="https://observablehq.com/@fil/summer-heat#hover">Summer heat 🍦 🌞 by Fil</a>.</li></ul><h4>Day 16–17: Line chart theory and exploration</h4><p><a href="https://observablehq.com/@didoesdigital/10-may-2020-line-charts?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>10 May 2020: Line charts</strong></a></p><ul><li>Line chart theory</li><li>Spline graphs, monotone functions, curving functions, and oversampled data.</li><li>Don’t “cut” the Y Axis</li><li>Spaghetti plot</li><li>Dual axis</li><li><a href="https://observablehq.com/@didoesdigital/11-may-2020-vega-lite-line-charts?collection=@didoesdigital/journal-getting-started-with-data-viz-collection">11 May 2020: Vega-Lite Line Charts</a></li><li>Vega-Lite line charts</li><li>“You have to be like the worst tabloid newspaper in the front and the Academy of Science in the back” — Hans Rosling</li><li><a href="https://covidtrackertracker.com/">Covid Tracker Tracker [sic]</a></li></ul><h4>Day 18–21: D3 line charts with annotations and shading</h4><p><a href="https://observablehq.com/@didoesdigital/12-may-2020-d3-line-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>12 May 2020: D3 Line Chart</strong></a></p><ul><li>D3 line chart with 1 series</li><li>A Y Axis label can double as a chart subtitle. Here, I’ve used “Australian life expectancy in years” as the Y Axis label and chart title.</li><li>Add classes to SVG groups just to name them, so you can easily find and navigate them when inspecting them in the console.</li><li>Different “nice” formatting: .domain(d3.extent(data, d =&gt; d.year)).nice(d3.timeYear.every(2))</li><li>Use the line function’s “defined” accessor: .defined() to check if there are any data points missing. If so, skips the missing line segments. This is a longer explanation of “defined”. This is the line generator code: line = d3.line().defined(d =&gt; !isNaN(d.life_expect)).x(d =&gt; x(d.year)).y(d =&gt; y(d.life_expect));</li><li>Examples of cutting the Y Axis</li><li>Sparklines, including inline canvas sparkline</li><li>“The only function of economic forecasting is to make astrology look respectable.” — John Kenneth Galbraith</li></ul><p><a href="https://observablehq.com/@didoesdigital/13-may-2020-d3-multi-line-chart?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>13 May 2020: D3 Multi-Line Chart</strong></a></p><ul><li>Reformatted data cell to include a time series array of names and associated values (series) and the list of years as an array (dates).</li><li>The console showed an error: Uncaught TypeError: d3.least is not a function. This uses d3-array: d3 = require(&quot;d3@5&quot;, &quot;d3-array@2&quot;).</li><li>The subsequent error, y = TypeError: t is not iterable, revealed that my time series values data was a single value instead of an array of all the values for that series.</li><li>Multi-line chart with dot labels and hover to emphasise 1 line at a time using bisectLeft and moved, entered, and left methods.</li></ul><p><a href="https://observablehq.com/@didoesdigital/14-may-2020-d3-multi-line-chart-with-annotations?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>14 May 2020: D3 Multi-Line Chart with Annotations</strong></a></p><ul><li><a href="https://d3-annotation.susielu.com/">D3-annotations</a>: d3 = require(&quot;d3@5&quot;, &quot;d3-array@2&quot;, &quot;d3-svg-annotation@2&quot;)</li><li>Example of d3.annotationCallout</li><li>The annotation note title also lightens when hovering over other lines.</li></ul><p><a href="https://observablehq.com/@didoesdigital/15-may-2020-d3-multi-line-chart-with-shading?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>15 May 2020: D3 Multi-Line Chart with Shading</strong></a></p><ul><li>Multi-line chart with shading</li><li><a href="https://observablehq.com/@zacharydodge/d3-interactive-charts">A notebook by Zachary Dodge taking another approach to appendix cells</a> for managing the width, height, margins and “plot area” (called boundedWidth and boundedHeight here)</li></ul><h4>Day 22–24: Pie and donut chart theory and exploration</h4><p><a href="https://observablehq.com/@didoesdigital/16-may-2020-donut-charts-and-pie-charts?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>16 May 2020: Donut Charts and Pie Charts</strong></a></p><ul><li>Pie chart and donut chart theory</li></ul><p><a href="https://observablehq.com/@didoesdigital/17-may-2020-pie-charts-in-vega-lite?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>17 May 2020: Pie Charts in Vega-Lite</strong></a></p><ul><li>Vega-Lite pie chart of scone ingredients</li><li>Errors due to versions: It looks like the example in <a href="https://observablehq.com/@mbostock/hello-vega-lite/2">Hello, Vega-Lite by Mike Bostock</a> is using an older version of Vega-Lite. The notebook from which we’re requiring vegalite appears to be an old version of the notebook.</li><li>Use vegaEmbed = require(&quot;vega-embed@5&quot;)</li><li>Use an embed function embed = function(spec) { return vegaEmbed(spec, {loader: vegaEmbed.vega.loader({baseURL: &#39;https://vega.github.io/vega/&#39;}), actions: true}) }</li><li>Wrap data keys in double quotes, because JSON demands strings for keys.</li><li>&quot;view&quot;: {&quot;stroke&quot;: null}, removes the chart border</li><li>&quot;legend&quot;: null, removes the category color legend in &quot;color&quot;: {&quot;field&quot;: &quot;category&quot;, &quot;type&quot;: &quot;nominal&quot;, &quot;legend&quot;: null}</li><li>It looks like &quot;stack&quot;: true places the labels correctly. The <a href="https://vega.github.io/vega-lite/docs/stack.html#encoding">Vega-Lite stack docs</a> focus on stacking bar charts and only mention once that it could be applied to the theta channel. It does not describe what it means to have things “stacked” with a theta channel so I will just file away in my brain as “the thing that does what I need with pie chart labels”. After a bit more reading I spotted “For now, you need to add stack: true to theta to force the text to apply the same polar stacking layout.” in <a href="https://vega.github.io/vega-lite/examples/layer_arc_label.html">Pie Chart with Labels</a></li><li>Use , &quot;stroke&quot;: &quot;#fff&quot; to the arc mark to distinguish sectors.</li><li>Use &quot;radius&quot;: {&quot;field&quot;: &quot;quantity&quot;, &quot;type&quot;: &quot;quantitative&quot;, &quot;scale&quot;: {&quot;type&quot;: &quot;sqrt&quot;, &quot;zero&quot;: true, &quot;range&quot;: [40, 100]}}, to create a Vega-Lite radial plot.</li><li>As far as I can tell, the default sort order is ascending but that will only work on a flat array of data using the specific key values. My data uses an array of objects, so I needed to add this line to my top-level encoding: &quot;order&quot;: {&quot;field&quot;: &quot;quantity&quot;, &quot;sort&quot;: &quot;descending&quot;}</li><li>Vega-Lite tooltips: &quot;tooltip&quot;: [{&quot;field&quot;: &quot;category&quot;, &quot;type&quot;: &quot;nominal&quot;}, {&quot;field&quot;: &quot;quantity&quot;, &quot;type&quot;: &quot;quantitative&quot;}]</li><li>Chart title (&quot;title&quot;: {&quot;text&quot;: &quot;A Scone&quot;, &quot;dy&quot;: -12},) and padding (&quot;padding&quot;: {&quot;top&quot;: 24, &quot;right&quot;: 24, &quot;bottom&quot;: 24, &quot;left&quot;: 24},)</li><li>Chart colors: &quot;color&quot;: { &quot;field&quot;: &quot;quantity&quot;, &quot;type&quot;: &quot;nominal&quot;, &quot;scale&quot;: { &quot;range&quot;: [&quot;#FDBAAB&quot;, &quot;#FFEBA5&quot;, &quot;#99C3E1&quot;, &quot;#90D1C5&quot;] }, &quot;legend&quot;: null },</li></ul><p><a href="https://observablehq.com/@didoesdigital/18-may-2020-donut-chart-in-vega-lite?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>18 May 2020: Donut Chart in Vega-Lite</strong></a></p><ul><li>To change a Vega-Lite pie chart to a donut chart: &quot;mark&quot;: {&quot;type&quot;: &quot;arc&quot;, &quot;innerRadius&quot;: 100, &quot;outerRadius&quot;: 150, &quot;stroke&quot;: &quot;#fff&quot;}</li><li>Add arbitrary text using a text mark and a value key instead of a field. See the <a href="https://vega.github.io/vega-lite/docs/text.html">Vega-Lite text</a>docs and the <a href="https://vega.github.io/vega-lite/docs/value.html">Vega-Lite value</a> docs.</li><li>Give the arc its own encoding and tooltip to avoid tooltips over the center of the donut.</li><li>In Observable, give images alt text: { const image = await FileAttachment(&quot;image.png&quot;).image(); image.alt = &quot;Screenshot of donut chart with open cell clipping tooltip.&quot; image.width = 375; return image; }</li></ul><h4>Day 24–27: D3 donut charts with footnotes and styled tooltips</h4><p><a href="https://observablehq.com/@didoesdigital/19-may-2020-donut-chart-in-d3?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>19 May 2020: Donut Chart in D3</strong></a></p><ul><li>Choose <a href="https://github.com/d3/d3-scale-chromatic">Sequential, diverging, categorical or cyclical</a> color scales as appropriate for the data.</li><li>“There is no difference between [line or thick arcs], other than the thinnest donut being worse than the rest (we’re not sure exactly why)” in <a href="https://digitalblog.ons.gov.uk/2017/02/28/the-humble-pie-chart-part2/">The humble pie chart: part2 by John Nixon, Office for National Statistics</a>.</li><li>Experiments with different color schemes and approaches to adding them to range: .range(d3.schemePastel1), .range([&quot;#8242a8&quot;,&quot;#cf3f93&quot;,&quot;#fc5972&quot;,&quot;#ff8a51&quot;,&quot;#ffbf40&quot;]), .range(d3.quantize(t =&gt; d3.interpolateCool(t * 0.8 + 0.1), data.length)), .range(d3.quantize(t =&gt; d3.interpolateSpectral(t * 0.8 + 0.1), data.length).reverse())</li><li>Color resources.</li><li>D3 donut chart.</li></ul><p><a href="https://observablehq.com/@didoesdigital/20-may-2020-donut-chart-in-d3-with-footnotes?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>20 May 2020: Donut Chart in D3 with Footnotes</strong></a></p><ul><li>To add a “source” line of text, append a text element and set the innerHTML using .html() from D3’s <a href="https://github.com/d3/d3-selection/blob/master/README.md#selection_html">selection.html</a>.</li><li>Alternatively, dump all the source details inline in a .html() call.</li><li>Use a figcaption element to add notes and source: &lt;figcaption style=&quot;padding-bottom: 12px; text-align: center; font-family: &#39;Work sans&#39;&quot;&gt;Source: &lt;a href=&quot;https://www.sarahcooks.com.au/2020/04/small-batch-scones.html&quot; style=&quot;fill: #3c72d7;&quot;&gt;Sarah Cooks: Small batch scones&lt;/href&gt;&lt;/figcaption&gt;</li><li>Wrap the chart and figcaption element in a figure element: &lt;figure style=&quot;max-width: 100%;&quot;&gt;${chart} ${caption}&lt;/figure&gt;</li><li>“Avoid chart footnotes where possible. If extra information is needed: annotate the chart, include the information in the statistical commentary accompanying the chart, add a footnote to the chart title”</li><li>Some notebooks showing source or notes.</li><li>The <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title">SVG title element</a> can also be used on an “graphics element”, including &lt;circle&gt;, &lt;ellipse&gt;, &lt;image&gt;, &lt;line&gt;, &lt;mesh&gt;, &lt;path&gt;, &lt;polygon&gt;, &lt;polyline&gt;, &lt;rect&gt;, &lt;text&gt;, and &lt;use&gt;. As with title attributes used on HTML elements, this produces shabby tooltips if you hover for long enough.</li></ul><p><a href="https://observablehq.com/@didoesdigital/21-may-2020-donut-chart-in-d3-with-tooltips?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>21 May 2020: Donut Chart in D3 with Tooltips</strong></a></p><ul><li>D3 donut chart with tooltips.</li><li>The approach here uses HTML for the tooltip itself and translates it into position using CSS according to the data passed to the onmouseover function from the D3 selection.on() listener on the arcs. The advantage of using HTML and CSS is that the tooltip automatically resizes based on the width of the text content inside it.</li><li>I have two working theories on the absence of standard conventions or libraries for styled tooltips in D3 charts:<br>1. Every visualisation is unique and D3 and SVG both give you such control that you might as well tailor your tooltip to every situation. Compare the 3 examples in <a href="https://g2.antv.vision/en/examples/component/tooltip#tooltip-1">AntV’s G2 Visualization Grammar Tooltip examples</a>.<br>2. Data viz folk generally use other methods to let people access “details on demand”, such as showing values directly on data on hover (especially for bar charts).</li><li><a href="https://github.com/d3/d3-selection/blob/master/README.md">d3-selection</a>: “By convention, selection methods that return the current selection use four spaces of indent, while methods that return a new selection use only two. This helps reveal changes of context by making them stick out of the chain”</li></ul><h4>Day 28–30: Area charts and CSV parsing</h4><p><a href="https://observablehq.com/@didoesdigital/22-may-2020-area-charts-stacked-area-charts-stream-graphs-an?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>22 May 2020: Area Charts, Stacked Area Charts, Stream graphs and Ridgelines</strong></a></p><ul><li>Theory about area charts, stacked area charts, stream graphs and ridgelines</li></ul><p><a href="https://observablehq.com/@didoesdigital/23-may-2020-area-charts-in-vega-lite-and-csv-parsing?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>23 May 2020: Area Charts in Vega-Lite and CSV Parsing</strong></a></p><ul><li>Vega-Lite area chart showing 863 cells written across 28 Observable notebooks.</li><li>Using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters">CSS counter</a> to count cells in notebooks via the <a href="https://observablehq.com/@observablehq/introducing-visual-dataflow">minimap</a>: element.style { counter-reset: count 0; } .minimap-cell-row:before { content: counter(count)&quot;.&quot;; counter-increment: count; }</li><li>Wrangling CSV data</li><li><a href="https://observablehq.com/@observablehq/file-attachments">Observable file attachments</a>: Calling attachment.text() returns a promise to a string. We then wait for this promise to resolve before calling d3.csvParse.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await">await</a> waits for a Promise.</li><li>From the <a href="https://github.com/d3/d3-dsv">d3-dsv</a> module, <a href="https://github.com/d3/d3-dsv#csvParse">d3.csvParse</a> calls <a href="https://github.com/d3/d3-dsv#dsvFormat">dsvFormat(&quot;,&quot;).parse()</a> with a comma as the delimiter, which constructs a new DSV parser and formatter. Just below dsvFormat in the docs, you can see <a href="https://github.com/d3/d3-dsv#dsv_parse">dsv.parse(string[, row])</a>, which tells us about the DSV parser.</li><li>Row conversion function, parameter and body.</li><li>Instead of d in our cell, you can see an Object using ES6 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructuring assignment</a> syntax to assign the data row’s name (e.g. “Number of cells”) to a local JavaScript variable (e.g. y).</li><li>Our d destructuring assignment is wrapped in parentheses because they’re “required when using object literal destructuring assignment without a declaration.”</li><li>The =&gt; indicates an ES6 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">arrow function expression</a> using the syntax, (param1, param2, …, paramN) =&gt; expression.</li><li>The docs show that destructuring within the parameter list is also supported as advanced syntax, which is what we’re doing.</li><li>“In a concise body, only an expression is specified, which becomes the implicit return value. In a block body, you must use an explicit return statement.” In order to use a “concise body” to return our object literal, we wrap our expression in parentheses.</li><li>From the <a href="https://github.com/d3/d3-time-format">d3-time-format</a> module, we then use <a href="https://github.com/d3/d3-time-format#timeParse">d3.timeParse</a>, which is an alias for <a href="https://github.com/d3/d3-time-format#locale_parse">locale.parse</a>(on the default locale), to create a time parser: const timeParser = d3.timeParse(&quot;%d %b %Y&quot;);</li><li>This time parser expects a date that looks like “23 May 2020”. We use it to parse the “Date” as our X value: x: timeParser(x),</li><li>The + in the line y: +y is an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus">Arithmetic operator: Unary plus (+)</a> that “attempts to convert it into a number, if it isn’t already”.</li><li>We add extra JavaScript properties to our data array to store our X Axis and Y Axis labels: const extraPropertiesSource = {xAxisLabel: &quot;Date →&quot;, yAxisLabel: &quot;↑ Cells&quot;}; return Object.assign(dataObjectTarget, extraPropertiesSource);</li><li>This uses <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign">Object.assign(target, …sources)</a> to copy all the (enumerable own) properties from one or more source objects to a target object and return it.</li><li>Experimenting with different timeUnit values: yearmonth and utcmonthdate</li><li>The <a href="https://vega.github.io/vega-lite/docs/timeunit.html">Vega-Lite time unit</a> docs explain that “The specifier monthdate is sensitive to month and date, but not year, which can be useful for binning time values to look at seasonal patterns only.” and to “use UTC time, you can add the utc prefix (e.g., &quot;utcyear&quot;, &quot;utcyearmonth&quot;).</li><li>Read <a href="https://vega.github.io/vega-lite/docs/axis.html">Vega-Lite axis</a> to learn about &quot;titleAngle&quot;: 0 to rotate the Y Axis label and &quot;titlePadding&quot;: 25 to pad it from the tick markers.</li><li>Using labelExpr described under Labels in <a href="https://vega.github.io/vega-lite/docs/axis.html#labels">Vega-Lite: Axis</a> documentation and the example shown under <a href="https://vega.github.io/vega-lite/docs/axis.html#example-using-axis-labelexpr-to-display-initial-letters-of-month-name">Example: Using Axis labelExpr to Display Initial Letters of Month Name</a>, I can show the first letter of the X Axis ordinal datum label using &quot;labelExpr&quot;: &quot;datum.label[0]&quot;. This is a bit useless here, but it may come in handy in the future.</li><li>Using Vega-Lite <a href="https://vega.github.io/vega-lite/docs/condition.html">condition</a>: &quot;condition&quot;: {&quot;test&quot;: &quot;datum[&#39;cumulative_count&#39;] &gt; 850&quot;, &quot;field&quot;: &quot;cumulative_count&quot;},</li></ul><p><a href="https://observablehq.com/@didoesdigital/24-may-2020-area-charts-in-d3-with-tooltips?collection=@didoesdigital/journal-getting-started-with-data-viz-collection"><strong>24 May 2020: Area Charts in D3 with Tooltips</strong></a></p><ul><li>Bisect for tooltips.</li><li>Redrawn SVG path for a callout with the tip underneath the tooltip.</li><li><a href="https://svg-path-visualizer.netlify.app/#M0.734375%2C0H78V42.5H44.3672l-5%2C5l-5%2C-5H0.734375V0Z">SVG path visualizer by Mathieu Dutour</a></li><li>SVG path editing to include variables to adapt to the width of the text label’s bounding box.</li><li>In <a href="https://observablehq.com/@d3/radial-area-chart">Radial Area Chart by Mike Bostock</a>, the text labels appear to have a white shape around them, achieved using duplicated text elements using a large white stroke behind the actual text.</li><li>D3 area chart with tooltips.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b54afcef74" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>