Customizing your plots

Danfo.js currently supports Plotly.jsarrow-up-right for plotting. This means you have all the configuration, flexibility, and interactiveness of Plotly.

All customizationarrow-up-right on the plot can be passed in the config and layout parameter.

Config Parameter

The config parameter extends the Plotly.js configarrow-up-right type. That is, all properties available to the Plotly configarrow-up-right argument, are available. Alongside those arguments, Danfo.js uses some custom arguments which we list below:

Argument
Description
Default value

x

Column name to plot on the x-axis.

DataFrame index if required

y

Column name to plot on the y-axis.

DataFrame index if required

columns

Array of column names to plot.

All columns in the DataFrame when applicable

values

Used to configure a pie chart. A column name containing values for the pie. Maps 1-1 with labels.

labels

Used to configure a pie chart. A column name containing labels for the pie. Maps 1-1 with values.

rowPositions

Used to configure a pie chart. Pie chart domain row. See https://plotly.com/javascript/reference/pie/#pie-domain-rowarrow-up-right

Range of 0 - DataFrame column length

columnPositions

Used to configure a pie chart. Pie chart domain column. See https://plotly.com/javascript/reference/pie/#pie-domain-columnarrow-up-right

Range of 0 - DataFrame column length

grid

Used to configure a pie chart. Accepts the following parameter: row: Integer size column: Integer size

tableHeaderStyle

Table properties used for configuring table header. See full listarrow-up-right of supported arguments.

tableCellStyle

Table properties used for configuring table cells. See full listarrow-up-right of supported arguments

Layout Parameter

The layout argument object is used to configure the overall display of a chart. See the full list of supported argumentsarrow-up-right

In the following example, we show how to set some basic configuration as well as layout for a line plot.

Last updated