Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TargetProcess/tauCharts/llms.txt

Use this file to discover all available pages before exploring further.

The export-to plugin adds an export menu to the chart that lets users save the chart in two formats: a PNG image rendered from the chart’s SVG, and a CSV file containing the chart’s data. The PNG export uses the canvg library to rasterize the SVG. The CSV export supports configuring the field separator and which columns to include or exclude.

Usage

var chart = new Taucharts.Chart({
    type: 'bar',
    x: 'category',
    y: 'value',
    data: dataset,
    plugins: [
        Taucharts.api.plugins.get('export-to')({
            backgroundColor: '#ffffff',
            fontSize: 14,
            csvSeparator: ','
        })
    ]
});

Settings

fontSize
number
Font size in pixels used when rendering text in the exported PNG image. Adjust this if the default text size looks too small or large in the exported file.
paddingTop
number
Padding in pixels added to the top of the exported PNG canvas. Useful when the chart title or legend is clipped during rasterization.
backgroundColor
string
Background color of the exported PNG image as a CSS color string. The SVG chart itself has a transparent background by default, so set this to '#ffffff' (or another color) to produce an opaque image suitable for documents and presentations.
csvSeparator
string
default:"','"
The field delimiter used in the exported CSV file. Common values are ',' for comma-separated values and '\t' for tab-separated values.
exportFields
any[]
An explicit list of fields to include in the CSV export. When provided, only these fields appear as columns in the output. When omitted, all fields from the data source are included.
appendFields
any[]
Additional fields to append to the default set of exported columns. Use this to add computed or metadata columns that are not in the raw data source.
excludeFields
any[]
A list of field names to remove from the CSV export. Use this to hide internal or irrelevant fields without enumerating all the fields you want to keep.
visible
boolean
default:"true"
Controls whether the export button is rendered in the chart. Set to false to hide the button while keeping the plugin registered (for example, to trigger exports programmatically).

PNG export

PNG export rasterizes the chart SVG using canvg and saves the result with FileSaver.js. The exported image captures the chart exactly as it appears on screen.
The canvg library must be available in your build for PNG export to work. If you are loading Taucharts via npm, canvg is listed as a peer dependency and must be installed separately.

CSV export

CSV export serializes the chart’s data to a delimited text file. By default all fields in the data source are exported. Use exportFields, appendFields, and excludeFields to control the output columns.

Examples

PNG with white background

Taucharts.api.plugins.get('export-to')({
    backgroundColor: '#ffffff',
    paddingTop: 20,
    fontSize: 12
})

CSV with custom separator and excluded fields

Taucharts.api.plugins.get('export-to')({
    csvSeparator: ';',
    excludeFields: ['internalId', '_metadata']
})

Export only specific fields

Taucharts.api.plugins.get('export-to')({
    exportFields: ['date', 'revenue', 'region'],
    csvSeparator: ','
})

Hidden export button

Taucharts.api.plugins.get('export-to')({
    visible: false
})

Build docs developers (and LLMs) love