Universe

A typst plugin to run echarts in typst with the use of CtxJS.

Examples

mixed charts example radar chart example pie chart example
Source Code Source Code Source Code
scatter chart example gauge chart example candlestick chart example
Source Code Source Code Source Code

For more examples see (handpicked from https://echarts.apache.org/examples/en/index.html):

examples.pdf

For the complete documentation for the configuration of echarts, see:

https://echarts.apache.org/en/option.html

Usage

#import "@preview/echarm:0.4.0"

// options are echart options
#echarm.render(width: 100%, height: 100%, options: (:))

Inject a javascript callback

To use a echart callback, you can use the value.eval function:

#import "@preview/echarm:0.4.0"

// options are echart options
#echarm.render(width: 100%, height: 100%, options: (
  series: (
    labelLayout: echarm.value.eval("your javascript callback code")
  )
))

Themes

Echarm has buildin themes in echarm.theme but you can also provide your custom theme. The builder can be useful for this. Instead of the themes id, you can specify the theme object as a parameter here.

all build-in themes charts example
Source Code

Languages

Echarm has buildin language support in echarm.language.

Infos

The version is not the same as the echart version, so that I can update independently. Animations are not supported here!

You can find more information about CtxJS here:

https://typst.app/universe/package/ctxjs/

Versions

Version Echart-Version
0.1.0 5.5.1
0.1.1 5.5.11
0.2.0 5.6.0
0.2.1 5.6.02
0.3.0 6.0.0
0.3.1 6.0.03
0.4.0 6.1.04

1 new eval-later feature
2 compatibility with typst 0.13 using ctxjs 0.3.0
3 added a tool to encode an image into an image data url using ctxjs 0.3.2
4 added theme and language support with build-ins, update ctxjs 0.5.0 eval-later is now value.eval