BaseCodeByte
Viz

JS Data Viz Lessons

Transform data into visuals with D3.js, Chart.js, Three.js, Babylon.js, Plotly, p5.js and more.

Course outline

Tracks and lessons

Track 01advanced

D3.js

Data-Driven Documents — the powerful library for binding data to SVG/DOM and creating custom.

01D3.js Introduction & Data BindingWhat is D3.js? D3.js (Data-Driven Documents) by Mike Bostock lets you bind arbitrary data to a DOM and apply. <script src="https://d3js.org/d3.v7.min.js"></script> // or: npm install d3beginner

What is D3.js? D3.js (Data-Driven Documents) by Mike Bostock lets you bind arbitrary data to a DOM and apply. <script src="https://d3js.org/d3.v7.min.js"></script> // or: npm install d3

Example
<script src="https://d3js.org/d3.v7.min.js"></script>
// or: npm install d3
Quiz

D3.js is primarily a:

What does the .data() method do in D3?

In D3, .enter() returns:

02Scales & AxesD3 Scales & Axes Scales map data values to visual values (pixels, colors). Axes render scale markings on SVG. Scale Types // Linear: continuous numeric input → output const xScale = d3.scaleLinear() .domain([0, 100]) // input range (data) .range([0, beginner

D3 Scales & Axes Scales map data values to visual values (pixels, colors). Axes render scale markings on SVG. Scale Types // Linear: continuous numeric input → output const xScale = d3.scaleLinear() .domain([0, 100]) // input range (data) .range([0,

Example
// Linear: continuous numeric input → output
const xScale = d3.scaleLinear()
  .domain([0, 100])    // input range (data)
  .range([0, 500]);    // output range (pixels)

xScale(50);  // → 250px

// Band: discrete categories → widths
const xBand = d3.scaleBand()
  .domain(['A', 'B', 'C', 'D'])
  .range([0, 400])
  .padding(0.2);

xBand('B');        // → x position
xBand.bandwidth(); // → bar width

// Time: date input
const timeScale = d3.scaleTime()
  .domain([new Date('2024-01-01'), new Date('2024-12-31')])
  .range([0, 800]);

// Color scales
const colorScale = d3.scaleSequential(d3.interpolateBlues).domain([0, 100]);
colorScale(50); // → 'rgb(...)' color
Quiz

Which D3 scale is used for mapping discrete category names to bar positions?

What does scale.domain() set?

Which D3 axis renders at the bottom of the chart?

03Building a Bar ChartComplete D3 Bar Chart const data = [ { month: 'Jan', value: 120 }, { month: 'Feb', value: 150 }, { month: 'Mar', value: 90 }, { month: 'Apr', value: 200 } ]; const margin = { top: 20, right: 20, bottom: 40, left: 60 }; const width = 600 - margin.leftintermediate

Complete D3 Bar Chart const data = [ { month: 'Jan', value: 120 }, { month: 'Feb', value: 150 }, { month: 'Mar', value: 90 }, { month: 'Apr', value: 200 } ]; const margin = { top: 20, right: 20, bottom: 40, left: 60 }; const width = 600 - margin.left

Example
const data = [
  { month: 'Jan', value: 120 },
  { month: 'Feb', value: 150 },
  { month: 'Mar', value: 90  },
  { month: 'Apr', value: 200 }
];

const margin = { top: 20, right: 20, bottom: 40, left: 60 };
const width  = 600 - margin.left - margin.right;
const height = 400 - margin.top  - margin.bottom;

// Create SVG
const svg = d3.select('#chart')
  .append('svg')
    .attr('width',  width  + margin.left + margin.right)
    .attr('height', height + margin.top  + margin.bottom)
  .append('g')
    .attr('transform', `translate(${margin.left},${margin.top})`);

// Scales
const x = d3.scaleBand()
  .domain(data.map(d => d.month))
  .range([0, width]).padding(0.3);

const y = d3.scaleLinear()
  .domain([0, d3.max(data, d => d.value)])
  .nice()
  .range([height, 0]);

// Axes
svg.append('g').attr('transform', `translate(0,${height})`).call(d3.axisBottom(x));
svg.append('g').call(d3.axisLeft(y));

// Bars
svg.selectAll('.bar')
  .data(data)
  .enter().append('rect')
    .attr('class', 'bar')
    .attr('x', d => x(d.month))
    .attr('y', d => y(d.value))
    .attr('width', x.bandwidth())
    .attr('height', d => height - y(d.value))
    .attr('fill', 'steelblue')
    .on('mouseover', function(event, d) {
      d3.select(this).attr('fill', 'orange');
      tooltip.style('opacity', 1).html(`${d.month}: ${d.value}`);
    });
Quiz

What does .nice() do on a D3 scale?

The margin convention in D3 is used to:

d3.max(data, d => d.value) returns:

Track 02beginner

Chart.js

Simple, beautiful charts for web pages. Chart.js renders on Canvas and supports 8 chart.

01Chart.js IntroductionChart.js Overview Chart.js is one of the most popular open-source charting libraries. It renders charts on HTML5 Canvas. &lt;script src="https://cdn.jsdelivr.net/npm/chart.js"&gt;&lt;/script&gt; // or: npm install chart.jsbeginner

Chart.js Overview Chart.js is one of the most popular open-source charting libraries. It renders charts on HTML5 Canvas. &lt;script src="https://cdn.jsdelivr.net/npm/chart.js"&gt;&lt;/script&gt; // or: npm install chart.js

Example
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
// or: npm install chart.js
Quiz

Chart.js renders charts using:

What is the minimum required config to create a Chart.js chart?

Which Chart.js option makes charts resize with their container?

02Chart TypesChart.js Chart Types new Chart(ctx, { type: 'line', data: { labels: ['Mon','Tue','Wed','Thu','Fri'], datasets: [{ label: 'Visitors', data: [100, 150, 120, 200, 180], tension: 0.4, // curve smoothing fill: true, backgroundColor: 'rgba(75,192,192,0.2)'beginner

Chart.js Chart Types new Chart(ctx, { type: 'line', data: { labels: ['Mon','Tue','Wed','Thu','Fri'], datasets: [{ label: 'Visitors', data: [100, 150, 120, 200, 180], tension: 0.4, // curve smoothing fill: true, backgroundColor: 'rgba(75,192,192,0.2)'

Example
new Chart(ctx, {
  type: 'line',
  data: {
    labels: ['Mon','Tue','Wed','Thu','Fri'],
    datasets: [{
      label: 'Visitors',
      data: [100, 150, 120, 200, 180],
      tension: 0.4,       // curve smoothing
      fill: true,
      backgroundColor: 'rgba(75,192,192,0.2)',
      borderColor: 'rgba(75,192,192,1)'
    }]
  }
});
Quiz

Which Chart.js property smooths a line chart curve?

What type of chart uses data with {x, y, r} objects?

Multiple datasets in one chart requires them in the:

03Plugins & Dynamic UpdatesChart.js Plugins & Live Updates Dynamic Data Updates // Add new data point chart.data.labels.push('Jul'); chart.data.datasets[0].data.push(105); chart.update(); // re-renders // Remove first item chart.data.labels.shift(); chart.data.datasets[0].dataintermediate

Chart.js Plugins & Live Updates Dynamic Data Updates // Add new data point chart.data.labels.push('Jul'); chart.data.datasets[0].data.push(105); chart.update(); // re-renders // Remove first item chart.data.labels.shift(); chart.data.datasets[0].data

Example
// Add new data point
chart.data.labels.push('Jul');
chart.data.datasets[0].data.push(105);
chart.update();  // re-renders

// Remove first item
chart.data.labels.shift();
chart.data.datasets[0].data.shift();
chart.update('active');  // animate
Quiz

After modifying chart data, you must call what to re-render?

Chart.register() is used to:

Tooltip callbacks.label is used to:

Track 03intermediate

Three.js (3D)

Create 3D graphics in the browser using WebGL. Three.js makes it easy to build.

01Scene, Camera & RendererThree.js: The Holy Trinity Every Three.js scene needs three things: a Scene, a Camera, and a Renderer. &lt;script src="https://unpkg.com/three@latest/build/three.module.js"&gt;&lt;/script&gt; // or: npm install threebeginner

Three.js: The Holy Trinity Every Three.js scene needs three things: a Scene, a Camera, and a Renderer. &lt;script src="https://unpkg.com/three@latest/build/three.module.js"&gt;&lt;/script&gt; // or: npm install three

Example
<script src="https://unpkg.com/three@latest/build/three.module.js"></script>
// or: npm install three
Quiz

What are the three essentials of every Three.js scene?

What does requestAnimationFrame do in the animation loop?

PerspectiveCamera first parameter is:

02Geometry, Materials & LightsThree.js Geometry, Materials & Lights new THREE.BoxGeometry(1, 1, 1); new THREE.SphereGeometry(0.5, 32, 32); new THREE.CylinderGeometry(0.5, 0.5, 2, 32); new THREE.PlaneGeometry(10, 10); new THREE.TorusKnotGeometry(0.4, 0.15, 100, 16); new THREE.Conebeginner

Three.js Geometry, Materials & Lights new THREE.BoxGeometry(1, 1, 1); new THREE.SphereGeometry(0.5, 32, 32); new THREE.CylinderGeometry(0.5, 0.5, 2, 32); new THREE.PlaneGeometry(10, 10); new THREE.TorusKnotGeometry(0.4, 0.15, 100, 16); new THREE.Cone

Example
new THREE.BoxGeometry(1, 1, 1);
new THREE.SphereGeometry(0.5, 32, 32);
new THREE.CylinderGeometry(0.5, 0.5, 2, 32);
new THREE.PlaneGeometry(10, 10);
new THREE.TorusKnotGeometry(0.4, 0.15, 100, 16);
new THREE.ConeGeometry(0.5, 1, 32);
Quiz

Which Three.js material uses Physically Based Rendering (PBR)?

AmbientLight does what?

roughness and metalness properties belong to which material?

03Animation & ControlsThree.js Animation & OrbitControls const clock = new THREE.Clock(); function animate() { requestAnimationFrame(animate); const delta = clock.getDelta(); // seconds since last frame const elapsed = clock.getElapsedTime(); // Rotate the cube cube.rotatintermediate

Three.js Animation & OrbitControls const clock = new THREE.Clock(); function animate() { requestAnimationFrame(animate); const delta = clock.getDelta(); // seconds since last frame const elapsed = clock.getElapsedTime(); // Rotate the cube cube.rotat

Example
const clock = new THREE.Clock();

function animate() {
  requestAnimationFrame(animate);

  const delta = clock.getDelta(); // seconds since last frame
  const elapsed = clock.getElapsedTime();

  // Rotate the cube
  cube.rotation.x += delta * 0.5;
  cube.rotation.y += delta * 1.0;

  // Oscillate (bob up and down)
  sphere.position.y = Math.sin(elapsed * 2) * 0.5;

  renderer.render(scene, camera);
}
Quiz

THREE.Clock.getDelta() returns:

What is Raycasting used for in Three.js?

OrbitControls allows users to:

Track 04intermediate

Babylon.js (3D)

Microsoft's powerful 3D engine for creating games and immersive experiences in the browser with built-in physics, PBR, XR support.

01Babylon.js OverviewBabylon.js Babylon.js is a powerful WebGL game engine by Microsoft. Unlike Three.js, it includes a built-in physics. &lt;canvas id="renderCanvas"&gt;&lt;/canvas&gt; &lt;script src="https://cdn.babylonjs.com/babylon.js"&gt;&lt;/script&gt; const canvasbeginner

Babylon.js Babylon.js is a powerful WebGL game engine by Microsoft. Unlike Three.js, it includes a built-in physics. &lt;canvas id="renderCanvas"&gt;&lt;/canvas&gt; &lt;script src="https://cdn.babylonjs.com/babylon.js"&gt;&lt;/script&gt; const canvas

Example
<canvas id="renderCanvas"></canvas>
<script src="https://cdn.babylonjs.com/babylon.js"></script>

const canvas = document.getElementById('renderCanvas');
const engine = new BABYLON.Engine(canvas, true);
const scene  = new BABYLON.Scene(engine);

// Camera
const camera = new BABYLON.ArcRotateCamera('cam', -Math.PI/2, Math.PI/4, 5, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);

// Light
new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene);

// Mesh
const box = BABYLON.MeshBuilder.CreateBox('box', { size: 1 }, scene);

// Render loop
engine.runRenderLoop(() => scene.render());
Quiz

What is Babylon.js primarily designed for?

Which Babylon.js camera type orbits around a target point?

What does scene.enablePhysics() activate?

02PBR Materials & GUIBabylon.js PBR & GUI // PBRMaterial (physically based) const mat = new BABYLON.PBRMaterial('metal', scene); mat.albedoColor = new BABYLON.Color3(0.8, 0.8, 0.8); mat.metallic = 1.0; mat.roughness = 0.2; mat.reflectionTexture = new BABYLON.CubeTexture(intermediate

Babylon.js PBR & GUI // PBRMaterial (physically based) const mat = new BABYLON.PBRMaterial('metal', scene); mat.albedoColor = new BABYLON.Color3(0.8, 0.8, 0.8); mat.metallic = 1.0; mat.roughness = 0.2; mat.reflectionTexture = new BABYLON.CubeTexture(

Example
// PBRMaterial (physically based)
const mat = new BABYLON.PBRMaterial('metal', scene);
mat.albedoColor     = new BABYLON.Color3(0.8, 0.8, 0.8);
mat.metallic        = 1.0;
mat.roughness       = 0.2;
mat.reflectionTexture = new BABYLON.CubeTexture('env.env', scene);

// Standard Material
const stdMat = new BABYLON.StandardMaterial('std', scene);
stdMat.diffuseColor  = BABYLON.Color3.Red();
stdMat.specularColor = BABYLON.Color3.White();

// Apply
box.material = mat;
Quiz

What does PBRMaterial stand for in Babylon.js?

Babylon.GUI is used for:

onPointerClickObservable in Babylon GUI is equivalent to:

Track 05intermediate

Plotly.js

Plotly.js — a high-level, declarative charting library supporting 40+ chart types including scientific, financial.

01Plotly.js OverviewPlotly.js Plotly.js is an open-source, high-level charting library built on D3.js and WebGL. It powers Plotly and. Plotly.newPlot('div-id', [{ x: ['Jan', 'Feb', 'Mar', 'Apr'], y: [10, 15, 13, 20], type: 'scatter', mode: 'lines+markers', name: 'Revenubeginner

Plotly.js Plotly.js is an open-source, high-level charting library built on D3.js and WebGL. It powers Plotly and. Plotly.newPlot('div-id', [{ x: ['Jan', 'Feb', 'Mar', 'Apr'], y: [10, 15, 13, 20], type: 'scatter', mode: 'lines+markers', name: 'Revenu

Example
Plotly.newPlot('div-id', [{
  x: ['Jan', 'Feb', 'Mar', 'Apr'],
  y: [10, 15, 13, 20],
  type: 'scatter',
  mode: 'lines+markers',
  name: 'Revenue'
}], {
  title: 'Monthly Revenue',
  xaxis: { title: 'Month' },
  yaxis: { title: 'Amount ($K)' }
});
Quiz

Plotly.js is built on top of which library?

Which Plotly trace type and mode creates a line with dots?

How do you update a Plotly chart with new data?

02Subplots & UpdatesPlotly Subplots & Live Updates Subplots Plotly.newPlot('chart', [ { x: [1,2,3], y: [4,5,6], xaxis:'x1', yaxis:'y1' }, { x: [1,2,3], y: [2,4,8], xaxis:'x2', yaxis:'y2' } ], { grid: { rows: 1, columns: 2, pattern: 'independent' } }); Live Updates // Adintermediate

Plotly Subplots & Live Updates Subplots Plotly.newPlot('chart', [ { x: [1,2,3], y: [4,5,6], xaxis:'x1', yaxis:'y1' }, { x: [1,2,3], y: [2,4,8], xaxis:'x2', yaxis:'y2' } ], { grid: { rows: 1, columns: 2, pattern: 'independent' } }); Live Updates // Ad

Example
Plotly.newPlot('chart', [
  { x: [1,2,3], y: [4,5,6], xaxis:'x1', yaxis:'y1' },
  { x: [1,2,3], y: [2,4,8], xaxis:'x2', yaxis:'y2' }
], {
  grid: { rows: 1, columns: 2, pattern: 'independent' }
});
Quiz

Plotly.extendTraces is used to:

Which method efficiently updates a Plotly chart in a live loop?

How do you listen to click events on a Plotly chart?

Track 06beginner

p5.js

p5.js is a JavaScript library for creative coding, making coding accessible for artists, designers.

01p5.js Introductionp5.js — Creative Coding p5.js is inspired by Processing and makes the joy of creative coding accessible to everyone. It's. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"&gt;&lt;/script&gt;beginner

p5.js — Creative Coding p5.js is inspired by Processing and makes the joy of creative coding accessible to everyone. It's. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"&gt;&lt;/script&gt;

Example
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script>
Quiz

setup() in p5.js runs:

p5.js's draw() function runs approximately how often?

What does push() and pop() do in p5.js?

02Interaction & Generative Artp5.js Interaction & Generative Art function mousePressed() { fill(random(255), random(255), random(255)); circle(mouseX, mouseY, random(20, 80)); } function keyPressed() { if (key === 'c') background(0); // clear if (key === 's') saveCanvas('mySketchintermediate

p5.js Interaction & Generative Art function mousePressed() { fill(random(255), random(255), random(255)); circle(mouseX, mouseY, random(20, 80)); } function keyPressed() { if (key === 'c') background(0); // clear if (key === 's') saveCanvas('mySketch

Example
function mousePressed() {
  fill(random(255), random(255), random(255));
  circle(mouseX, mouseY, random(20, 80));
}

function keyPressed() {
  if (key === 'c') background(0);  // clear
  if (key === 's') saveCanvas('mySketch', 'png');
  if (keyCode === SPACE) isPlaying = !isPlaying;
}

function mouseDragged() {
  stroke(255, 0, 100);
  line(mouseX, mouseY, pmouseX, pmouseY);
}
Quiz

What is Perlin noise used for in creative coding?

Which p5.js function is called when the mouse button is pressed?

noLoop() in p5.js does what?

Track 07intermediate

Apache ECharts

Apache ECharts — a powerful open-source charting library by Apache, widely used in China.

01ECharts IntroductionApache ECharts Apache ECharts (formerly Baidu ECharts) is a highly customizable, interactive JavaScript charting library used widely in. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.3/echarts.min.js"&gt;&lt;/script&gt; const chabeginner

Apache ECharts Apache ECharts (formerly Baidu ECharts) is a highly customizable, interactive JavaScript charting library used widely in. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.3/echarts.min.js"&gt;&lt;/script&gt; const cha

Example
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.3/echarts.min.js"></script>

const chart = echarts.init(document.getElementById('main'));

chart.setOption({
  title:  { text: 'Monthly Sales' },
  tooltip: { trigger: 'axis' },
  legend: { data: ['2023', '2024'] },
  xAxis:  { type: 'category', data: ['Jan','Feb','Mar','Apr','May'] },
  yAxis:  { type: 'value' },
  series: [
    { name: '2023', type: 'bar', data: [120,132,101,134,90] },
    { name: '2024', type: 'bar', data: [150,160,115,165,110] }
  ]
});
Quiz

How do you initialize an ECharts chart?

What method applies chart configuration in ECharts?

Which ECharts tooltip trigger shows tooltip for the whole axis category?

02Events & Dynamic DataECharts Events & Live Data chart.on('click', (params) => { console.log('Series:', params.seriesName); console.log('Data:', params.name, params.value); }); chart.on('mouseover', 'series.bar', (params) => { console.log('Hovering bar:', params.value); }intermediate

ECharts Events & Live Data chart.on('click', (params) => { console.log('Series:', params.seriesName); console.log('Data:', params.name, params.value); }); chart.on('mouseover', 'series.bar', (params) => { console.log('Hovering bar:', params.value); }

Example
chart.on('click', (params) => {
  console.log('Series:', params.seriesName);
  console.log('Data:', params.name, params.value);
});

chart.on('mouseover', 'series.bar', (params) => {
  console.log('Hovering bar:', params.value);
});

chart.getZr().on('click', (event) => {
  // Click on canvas background
  const [x, y] = chart.convertFromPixel('grid', [event.offsetX, event.offsetY]);
  console.log('Grid position:', x, y);
});
Quiz

chart.on("click", fn) in ECharts attaches:

How do you prevent option merging in setOption?

Which method shows a loading spinner over an ECharts chart?

Track 08intermediate

FusionCharts

FusionCharts — a comprehensive JavaScript charting library with 100+ chart types and native integrations.

01FusionCharts OverviewFusionCharts FusionCharts is a commercial JavaScript charting library with 100+ chart types, gauges, and maps. It supports. &lt;script src="fusioncharts.js"&gt;&lt;/script&gt; FusionCharts.ready(function() { new FusionCharts({ type: 'column2d', rendebeginner

FusionCharts FusionCharts is a commercial JavaScript charting library with 100+ chart types, gauges, and maps. It supports. &lt;script src="fusioncharts.js"&gt;&lt;/script&gt; FusionCharts.ready(function() { new FusionCharts({ type: 'column2d', rende

Example
<script src="fusioncharts.js"></script>

FusionCharts.ready(function() {
  new FusionCharts({
    type: 'column2d',
    renderAt: 'chart-container',
    width: '600', height: '400',
    dataFormat: 'json',
    dataSource: {
      chart: {
        caption: 'Monthly Sales',
        xAxisName: 'Month',
        yAxisName: 'Revenue ($)',
        theme: 'fusion'
      },
      data: [
        { label: 'Jan', value: 120 },
        { label: 'Feb', value: 150 },
        { label: 'Mar', value: 130 }
      ]
    }
  }).render();
});
Quiz

FusionCharts data is passed via which property?

Which property sets the chart type in FusionCharts?

FusionCharts.ready() ensures:

02Events & Real-time DataFusionCharts Events & Live Data fusionCharts.addEventListener('dataplotClick', (e, args) => { console.log('Clicked:', args.categoryLabel, args.dataValue); }); fusionCharts.addEventListener('chartClick', (e) => { console.log('Chart area clicked'); });intermediate

FusionCharts Events & Live Data fusionCharts.addEventListener('dataplotClick', (e, args) => { console.log('Clicked:', args.categoryLabel, args.dataValue); }); fusionCharts.addEventListener('chartClick', (e) => { console.log('Chart area clicked'); });

Example
fusionCharts.addEventListener('dataplotClick', (e, args) => {
  console.log('Clicked:', args.categoryLabel, args.dataValue);
});

fusionCharts.addEventListener('chartClick', (e) => {
  console.log('Chart area clicked');
});

// FusionCharts.addEventListener (global, all charts)
FusionCharts.addEventListener('rendered', (e, args) => {
  console.log('Chart', args.id, 'rendered');
});
Quiz

What FusionCharts chart type shows continuously updating data?

chart.setChartData() is used to:

FusionCharts dataSource.chart object contains:

Track 09intermediate

Raphaël (SVG)

Raphaël is a small JavaScript library for working with vector graphics (SVG) cross-browser. Ideal.

01Raphaël SVG DrawingRaphaël.js Raphaël simplifies working with SVG vector graphics. While newer projects often use D3.js or plain SVG. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js"&gt;&lt;/script&gt; const paper = Raphael('canvas-dbeginner

Raphaël.js Raphaël simplifies working with SVG vector graphics. While newer projects often use D3.js or plain SVG. &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js"&gt;&lt;/script&gt; const paper = Raphael('canvas-d

Example
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js"></script>

const paper = Raphael('canvas-div', 800, 600);
Quiz

Raphaël uses which web technology for drawing?

What does paper.circle(100, 100, 50) draw?

el.animate({x:200}, 500) moves an element to x=200 over:

02Sets & Path AnimationsRaphaël Sets & Custom Paths const set = paper.set(); set.push( paper.circle(100, 100, 30), paper.text(100, 150, 'Node 1') ); set.attr({ fill: '#ff6384' }); // applies to all set.animate({ transform: 't100,0' }, 500); // move all set.remove();intermediate

Raphaël Sets & Custom Paths const set = paper.set(); set.push( paper.circle(100, 100, 30), paper.text(100, 150, 'Node 1') ); set.attr({ fill: '#ff6384' }); // applies to all set.animate({ transform: 't100,0' }, 500); // move all set.remove();

Example
const set = paper.set();
set.push(
  paper.circle(100, 100, 30),
  paper.text(100, 150, 'Node 1')
);
set.attr({ fill: '#ff6384' });  // applies to all
set.animate({ transform: 't100,0' }, 500);  // move all
set.remove();
Quiz

In SVG path syntax, what does "Z" mean?

paper.set() in Raphaël creates:

What SVG path command draws a straight line to a point?

Track 10beginner

RGraph

RGraph — a Canvas-based JavaScript charting library with no dependencies, optimized for fast, lightweight.

01RGraph OverviewRGraph RGraph is a lightweight, Canvas-based JavaScript charting library with zero dependencies. It supports 60+ chart types. &lt;script src="https://cdn.jsdelivr.net/npm/rgraph/libraries/RGraph.common.core.js"&gt;&lt;/script&gt; &lt;script src="httpbeginner

RGraph RGraph is a lightweight, Canvas-based JavaScript charting library with zero dependencies. It supports 60+ chart types. &lt;script src="https://cdn.jsdelivr.net/npm/rgraph/libraries/RGraph.common.core.js"&gt;&lt;/script&gt; &lt;script src="http

Example
<script src="https://cdn.jsdelivr.net/npm/rgraph/libraries/RGraph.common.core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/rgraph/libraries/RGraph.bar.js"></script>

<canvas id="cvs" width="600" height="400"></canvas>
Quiz

RGraph uses which HTML element for rendering?

Which option sets the chart title in RGraph?

What method actually draws the RGraph chart?

02RGraph Events & GaugeRGraph Events & Special Charts RGraph.on(bar, 'click', (e, shape) => { console.log('Bar clicked:', shape.index, 'value:', shape.yval); }); RGraph.on(bar, 'mousemove', (e, shape) => { bar.canvas.style.cursor = shape ? 'pointer' : 'default'; });intermediate

RGraph Events & Special Charts RGraph.on(bar, 'click', (e, shape) => { console.log('Bar clicked:', shape.index, 'value:', shape.yval); }); RGraph.on(bar, 'mousemove', (e, shape) => { bar.canvas.style.cursor = shape ? 'pointer' : 'default'; });

Example
RGraph.on(bar, 'click', (e, shape) => {
  console.log('Bar clicked:', shape.index, 'value:', shape.yval);
});

RGraph.on(bar, 'mousemove', (e, shape) => {
  bar.canvas.style.cursor = shape ? 'pointer' : 'default';
});
Quiz

RGraph.on() is used to:

To create a gauge/meter chart in RGraph, use:

What option makes a Pie chart into a donut in RGraph?