Get started with canvasXpress CDN

GPL-3.0 licensed

CanvasXpress: library for dynamic HTML5 Canvas graphics.

Tags:
  • canvas
  • visualization
  • scientific
  • interface
  • sorted
  • grouped
  • transposed
  • transformed
  • clustered

Stable version

Copied!

How to start using canvasXpress CDN


// Include the canvasXpress library
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/canvasXpress/24.8.1/canvasXpress.min.js';
document.head.appendChild(script);

// Wait for the library to load before running the example
window.addEventListener('load', () => {
  // Create a new CanvasXpress instance
  const cp = new CanvasXpress();

  // Get the HTML canvas element
  const canvas = document.getElementById('myCanvas');
  const ctx = canvas.getContext('2d');

  // Set the canvas size
  canvas.width = 500;
  canvas.height = 500;

  // Draw a rectangle using CanvasXpress
  cp.rect(10, 10, 100, 50)
    .fillStyle('#F00')
    .strokeStyle('#000')
    .lineWidth(2)
    .draw(ctx);

  // Draw a text using CanvasXpress
  cp.text('Hello World', 150, 100)
    .fontSize(24)
    .fillStyle('#000')
    .draw(ctx);
});
Copied!
Copied!
Copied!
Copied!

All versions

12.9 13.0 13.1 13.7 13.8 13.9 14.0 14.1 14.3 14.4 14.5 14.6 14.7 14.7-CRAN 14.8 15.0 15.1 15.2 15.2-CRAN 15.3 15.4 15.5 15.5-CRAN 15.6 15.6.mod 15.7 15.8 15.9 16.0 16.0.pre 16.1 16.2 16.3 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.1.0 24.2 24.4 24.5 24.6 24.7 24.8 *** 24.8.1 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0 40.1 40.2 40.3 40.4 40.5 40.6 40.7 40.8 40.9 41.0 41.1 41.2 41.3 41.4 41.5 41.6 41.7 41.8 42.0 42.1 42.2 42.3 42.4 42.6 42.7 42.8 42.9 43.0 43.1 43.2 43.3 43.4 43.6 43.7 43.8 43.9 44.0 44.1 44.2 44.5 44.6 44.7 44.8 44.9 45.0 45.1 45.2 45.3 45.4 45.5 45.6 45.7 45.8 45.9 46.0 46.1 46.2 46.3 46.4 46.5 46.6 46.7 46.8 46.9 47.0 47.1 47.2 47.3 47.4