HTML5 canvas backend for diagrams drawing EDSL


Version on this page:1.4@rev:1
LTS Haskell 21.13:
Stackage Nightly 2023-09-27:
Latest on Hackage:

See all snapshots diagrams-canvas appears in

BSD-3-Clause licensed by Jeffrey Rosenbluth, Ryan Yates, Brent Yorgey, Andy Gill, Daniel Bergey
This version can be pinned in stack with:diagrams-canvas-1.4@sha256:c9ae3d6324a408602240762063bc956100512cb948e60501fc008438cd9a969c,1866

Module documentation for 1.4


diagrams-canvas is a canvas backend for diagrams based on the blank-canvas https://github.com/ku-fpg/blank-canvas package. Diagrams is a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language. It supports most features defined in diagrams-lib.


cabal update && cabal install diagrams-canvas


A simple example that uses diagrams-canvas to draw a square.

import Diagrams.Prelude
import Diagrams.Backend.Canvas.CmdLine

b1 = (square 20 :: Diagram B) # lw 0.002

main = mainWith (pad 1.1 b1)

Save this to file named Square.hs and compile this program:

ghc --make -threaded Square.hs

This will generate an executable which, when run dispays the resulting diagrams to http://localhost:3000/

$ ./Square -w 750


v1.4 (2016-10-26)

  • allow lens-4.15
  • allow diagrams-core-1.4
  • allow diagrams-lib-1.4

v1.3.0.7 (2016-08-22)

  • require optparse-applicative-0.13 and fix compilation error

v1.3.0.6 (2016-08-16)

  • allow optparse-applicative-0.13


  • allow base-4.9
  • allow data-default-class-0.1
  • drop support for GHC 7.6
  • test on GHC 8.0.1


  • allow lens-4.14

v1.3.0.3 (2016-01-14)

  • Allow blank-canvas-0.6

v1.3.0.2 (2015-07-19)

Full Changelog

v1.3.0.1 (2015-05-26)

Full Changelog

1.3 (19 April 2015)

  • release to coincide with 1.3

v0.3.0.4 (2015-04-03)

Full Changelog

v0.3.0.3 (2015-01-13)

Full Changelog

v0.3.0.2 (2014-11-17)

Full Changelog

Closed issues:

  • Building with HEAD gives the error “local access only” at localhost:3000 #10

Merged pull requests:

v0.3.0.1 (2014-10-08)

Full Changelog

Closed issues:

  • API blank canvas change #7

Merged pull requests:

v0.3 (2014-09-19)

Full Changelog

Closed issues:

  • Does not support optparse-applicative-0.10 #4

Merged pull requests:

v0.2.0.3 (2014-09-11)

Full Changelog

Merged pull requests:

v0.2.0.2 (2014-09-07)

Full Changelog

v0.2.0.1 (2014-08-22)

Full Changelog

v0.2 (2014-07-08)

Closed issues:

  • Text with Local font size has incorrect vertical alignment. #1

Merged pull requests:

  • Apply accumulated uniform scaling to text size #3 (bergey)

  • Update .cabal version bounds #2 (bergey)

* This Change Log was automatically generated by github_changelog_generator