Skip to content

Instantly share code, notes, and snippets.

View mmazanec22's full-sized avatar
🚲

Melanie Mazanec mmazanec22

🚲
View GitHub Profile
@mmazanec22
mmazanec22 / README.md
Last active January 26, 2018 16:05
Accessible Bar Chart

Accessible Bar Chart Prototype

This is a quick and imperfect prototype to illustrate two ideas that might allow a blind or visually impaired user to experience a bar chart. One concept is using pitch to indicate the relative height of the different bars (building upon this gist: http://bl.ocks.org/aholachek/6e18a82c0f0ada144b854f788c07d7a4). To try this, any user may use the mouse or the arrow keys to navigate the bars.

The other idea is to apply aria labels and roles to make the different svg elements available to screen readers. To try this, turn on the screen reader (on a Mac, cmd + F5), tab your way into the chart, then use the arrow keys to navigate the bars. The screen reader will announce x and y values (the pitch will still sound as well-- in a real implementation, this should probably be turned off by default so as not to conflict with the screen reader).

Feedback and improvements are welcome!

@mmazanec22
mmazanec22 / WorldMap.js
Last active August 14, 2019 05:17
Map With Ctrl+Click/Right Click to Brush; Normal Pan and Zoom
class WorldMap {
constructor(parentElement, colorScheme = {land: '#787882', water: '#1a1c2a'}) {
this.parentElement = d3.select(parentElement);
this.width = this.parentElement.style('width').replace('px', '');
this.height = this.parentElement.style('height').replace('px', '');
this.remSize = parseFloat(getComputedStyle(d3.select('html').node()).fontSize);
this.landColor = colorScheme.land;
this.waterColor = colorScheme.water;
this.currMapTranslate = [0, 0];
@mmazanec22
mmazanec22 / hackedBin.js
Last active September 22, 2017 23:39
Hexbins Relative In Size To Entire Dataset of Objects
document.addEventListener('DOMContentLoaded', () => {
const parentDiv = d3.select('.parent-div');
const width = 960;
const height = 500;
const svg = parentDiv.append('svg')
.attr('width', width)
.attr('height', height);
const options = {
@mmazanec22
mmazanec22 / index.html
Last active September 22, 2017 23:24
Updating Bar Graph
<!DOCTYPE html>
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src='./updateHistogram.js'></script>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
@mmazanec22
mmazanec22 / index.html
Last active September 20, 2017 21:47
Tooltip That Doesn't Collide With Edges
<!DOCTYPE html>
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src='./tooltip.js'></script>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>