Skip to content

Instantly share code, notes, and snippets.

@XavierGimenez
XavierGimenez / VegaChart.js
Last active May 6, 2020 10:40
React component for Vega charts
/**
* @fileOverview React component to wrap Vega.js chart rendering.
* @author Xavi Giménez ([email protected])
*/
import React, { Component } from 'react';
import * as vega from 'vega';
import * as _ from 'lodash';
var vegaTooltip = require('vega-tooltip/build/vega-tooltip');
@XavierGimenez
XavierGimenez / what-forces-layout.md
Created January 15, 2020 13:43 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@XavierGimenez
XavierGimenez / README.md
Last active March 2, 2019 06:49
Slopechart with vega.js

Quick implementation of a slope chart, not to represent changes over time but to emulate Ben Fry's piece Salaries vs Performance

Todo: Values should be ranked to avoid overlapping

@XavierGimenez
XavierGimenez / README.md
Last active January 14, 2019 15:22
sorted stacked chart with vega.js

Sankey diagram with vega.js.

data transforms: stack + joinaggregate + collect

@XavierGimenez
XavierGimenez / README.md
Last active February 17, 2023 03:11
Sankey diagram with vega.js
@XavierGimenez
XavierGimenez / README.md
Last active December 13, 2018 10:25
choropleth map with vega.js

More testing on making maps with vega.js. No effort thanks to the lookup transform and conditional blocks for coloring the features.

@XavierGimenez
XavierGimenez / README.md
Last active December 12, 2018 12:16
Fitting maps automatically with vega.js

Creating maps with vega.js. Simple example of how to use the "fit" and "size" properties of the projection object, so centering/scaling the map is done automatically

@XavierGimenez
XavierGimenez / README.md
Last active November 29, 2018 14:25
Custom visuals designs with vega.js (I)

Draft for making custom visual designs with vega.js

@XavierGimenez
XavierGimenez / README.md
Last active November 23, 2018 12:35
Stretched Chord with vega.js

Stretched Chord with vega.js

Porting the Stretched Chord by Nadieh Bremer to vega.js

WIP from previous block

So far, Mixing D3 for the data generation and vega.js for rendering and minimal logic. Once the spec is parsed, just populate signals/datasets and render the vega view.

@XavierGimenez
XavierGimenez / .block
Last active July 13, 2023 08:18
Chord Diagram with vega.js
license: bsd-3-clause