Skip to content

Instantly share code, notes, and snippets.

View lucguillemot's full-sized avatar

Luc Guillemot lucguillemot

View GitHub Profile
import * as React from "react";
import { ChartRenderer } from "./ChartRenderer";
export const Chart = () => {
const [highlight, updateHighlight] = React.useState("A");
const spec = {
$schema: "https://vega.github.io/schema/vega/v5.json",
width: 400,
height: 200,
import * as React from "react";
import * as vega from "vega";
// Note the added prop "handleClick"
export const Chart = ({ spec, handleClick }) => {
const chartContainer = React.useRef(null);
React.useEffect(
() => {
const createView = async () => {
try {
import * as React from "react";
import * as vega from "vega";
export const Chart = ({ spec, handleClick }) => {
const chartContainer = React.useRef();
React.useEffect(() => {
const createView = async () => {
try {
const view = new vega.View(vega.parse(spec), {
logLevel: vega.Warn,
import * as React from "react";
import { ChartRenderer } from "./ChartRenderer";
export const Bars = () => {
// These specs were copy/pasted from the Bar Chart example
// from the Vega Documentation
// https://vega.github.io/vega/examples/bar-chart/
const spec = {
$schema: "https://vega.github.io/schema/vega/v5.json",
width: 400,
import * as React from "react";
// Don't forget to import the module vega!
import * as vega from "vega";
// Note the new props "specs"
export const ChartRenderer = ({ spec }) => {
const chartContainer = React.useRef(null);
// This is the hook that will be called after
@lucguillemot
lucguillemot / .block
Created February 28, 2017 07:35
fresh block
license: mit
@lucguillemot
lucguillemot / README.md
Last active July 20, 2016 23:31
L*a*b* color space

The L*a*b* color space with a range of ±100 for a* and b* values and a value of 60 for Lightness.

@lucguillemot
lucguillemot / README.md
Last active May 16, 2016 22:40
Horizontal stacked bar chart
@lucguillemot
lucguillemot / README.md
Last active September 18, 2016 17:43
Scatterplot using two ordinal scales

This is a scatterplot using two ordinal scales and the RangePoints() function, with data showing the country of origin of films in competition at the Cannes film festival since 2006.

@lucguillemot
lucguillemot / README.md
Last active November 24, 2015 00:41
Choropleth map with diverging color scale.