Skip to main content

Figure Options

SignatureDescription
title(string)Sets the figure title.
x_axis(options)Configures the x-axis (name, ticks, font, scale).
y_axis(options)Configures the y-axis (name, ticks, font, scale).
legend(options)Adds and positions a legend box.
tooltip(options)Enables an interactive hover tooltip.
grid(options)Controls plot-area margins and size.
visual_map(options)Controls plot-area margins and size.
data_zoom(options)Adds interactive zoom/scroll controls.
animation(options)Controls the figure animations.
mark_line(options)Adds a line of interest in an existing figure.
mark_point(options)Add a marker to a point of interest in an existing figure.

title(string)

Quick examples

Figure()
.line([1,2,3,4],[1,4,9,16])
.title("Quadratic scaling $n^2$")
.save("./figures/ex_title.figure")

x_axis(options)

OptionTypeDescription
namestringDisplayed name of the axis. Supports LaTeX syntax using $...$ for mathematical expressions.
name_locationstringPosition of the axis name relative to the axis line: "start", "middle" / "center", or "end".
name_text_styleMapText styling options for the axis name (e.g. "font_size", "color", "font_weight").
name_gapnumberDistance in pixels between the axis name and the axis line.
typestringAxis scale type: "value" (numeric), "category" (discrete labels), "time" (date/time), or "log" (logarithmic scale).
minnumber or stringMinimum value of the axis.
maxnumber or stringMaximum value of the axis.
scalebooleanIf true, the axis range is determined purely by the data and is not forced to include zero.
inversebooleanIf true, reverses the direction of the axis.
positionstringPlacement of the axis: typically "top" or "bottom" for horizontal axes.
axis_labelMapConfiguration options for tick labels (e.g. "font_size", "rotate", "formatter", "color").
axis_lineMapConfiguration options for the main axis line (e.g. "show", "line_style").
axis_tickMapConfiguration options for tick marks (e.g. "show", "length", "inside").
split_lineMapConfiguration options for grid split lines (e.g. "show", "line_style").
log_basenumberBase value for logarithmic axes when type is set to "log".
dataListCategory labels used when type is set to "category".

Quick examples

Figure()
.line([1, 2, 3, 4], [10, 150,980,9000], ["name": "Sales"])
.x_axis([
"position": "top",
"inverse": true,
"type": "category",
"name": "Month",
"name_location": "middle",
"name_gap": 30,
"data": ["Jan", "Feb", "Mar", "Apr", "May"],
"axis_label": [
"rotate": 45,
"font_size": 12
],
"axis_line": [
"show": true
],
"axis_tick": [
"show": true,
"length": 6
],
"split_line": [
"show": false
]
])
.y_axis([
"type": "log",
"log_base" : 10,
"min": 5
])
.legend()
.save("./figures/ex_x_axis_options")

y_axis(options)

Same as the x_axis options above.

legend(options)

OptionTypeDescription
showbooleanEnable or disable display of the legend.
typestringLegend layout type: "plain" for a standard legend or "scroll" to enable scrolling when items exceed available space.
leftstring or numberDistance from the left side of the chart container. Accepts pixel values or keywords such as "left", "center", "right", or percentage strings like "10%".
topstring or numberDistance from the top of the chart container. Accepts pixel values or keywords such as "top", "middle", "bottom", or percentage strings like "5%".
rightstring or numberDistance from the right side of the chart container. Accepts pixel values or percentage strings.
bottomstring or numberDistance from the bottom of the chart container. Accepts pixel values or percentage strings.
orientstringLayout direction of legend items: "horizontal" or "vertical".
alignstringAlignment of legend items within the legend box: "auto", "left", or "right".
item_gapnumberSpacing in pixels between individual legend items.
text_styleMapConfiguration object for legend text styling (e.g. "font_size", "color", "font_weight", "font_family").
selected_modeboolean or stringControls item selection behavior: true (multiple selection), false (no selection), "single" (only one active at a time), or "multiple" (explicit multiple selection).

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [10, 25, 20, 35, 40], ["name": "Series A"])
.line([1, 2, 3, 4, 5], [15, 30, 25, 40, 45], ["name": "Series B"])
.legend([
"show": true,
"type": "scroll",
"left": "center",
"top": "5%",
"right": "5%",
"bottom": "auto",
"orient": "horizontal",
"align": "auto",
"item_gap": 15,
"text_style": [
"font_size": 14,
"font_weight": "bold",
"color": "#a93838",
"font_family": "Arial"
],
"selected_mode": "single"
])
.save("./figures/ex_legend_options")

tooltip(options)

OptionTypeDescription
showbooleanEnable or disable the tooltip display.
triggerstringDefines the trigger mode for showing the tooltip: "item" (per data point), "axis" (per axis), or "none" (disabled).
trigger_onstringSpecifies the events that trigger the tooltip: "mousemove", "click", or "none".
confinebooleanIf true, constrains the tooltip within the chart boundaries to prevent overflow.
text_styleMapConfiguration object for tooltip text styling (e.g., "color", "font_size", "font_weight", "font_family").
background_colorColorBackground color of the tooltip.
border_colorColorBorder color of the tooltip.
border_widthnumberWidth of the tooltip border in pixels.
paddingnumber or ListPadding inside the tooltip box. Can be a single number for all sides or a list [top, right, bottom, left].

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [10, 15, 25, 35, 50], ["name": "Series A"])
.line([1, 2, 3, 4, 5], [15, 30, 45, 55, 70], ["name": "Series B"])
.tooltip([
"show": true,
"trigger": "axis",
"trigger_on": "mousemove",
"confine": true,
"background_color": "rgba(50,50,50,0.8)",
"border_color": "#333",
"border_width": 2,
"padding": [8, 12, 8, 12],
"text_style": [
"color": "#fff",
"font_size": 14,
"font_weight": "bold",
"font_family": "Arial"
]
])
.legend()
.save("./figures/ex_tooltip_options")

grid(options)

OptionTypeDescription
showbooleanDisplay the grid border. If false, only the plot area is used without visible border.
leftstring or numberDistance between the grid and the left edge of the container. Can be a pixel value or percentage string like "10%".
rightstring or numberDistance between the grid and the right edge of the container.
topstring or numberDistance between the grid and the top edge of the container.
bottomstring or numberDistance between the grid and the bottom edge of the container.
widthstring or numberExplicit width of the grid area. Overrides left/right if set.
heightstring or numberExplicit height of the grid area. Overrides top/bottom if set.
contain_labelbooleanIf true, the grid area automatically adjusts

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [10, 25, 20, 35, 40], ["name": "Series A"])
.grid([
"show": true,
"left": "5%",
"right": "5%",
"top": "5%",
"bottom": "5%",
"width": "50%",
"height": "50%",
"contain_label": true,
"background_color": "#f5f5f5"
])
.legend()
.save("./figures/ex_grid_options")

Marks

OptionTypeDescription
mark_pointMapHighlight specific data points (e.g. max/min).
mark_lineMapDraw reference lines (e.g. averages).
mark_areaMapShade reference areas.

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [5, 3, 8, 2, 7], [
"name": "With Marks",
"symbol_size": 10,
"mark_point": [
"data": [["type": "max", "name": "Max"], ["type": "min", "name": "Min"]]
],
"mark_line": [
"data": [["type": "average", "name": "Average"]]
]
])
.line([7, 8, 9, 10, 11], [4, 6, 2, 9, 5], [
"name": "Only Mark Line",
"symbol_size": 10,
"mark_line": [
"data": [["type": "average", "name": "Avg"]]
]
])
.legend()
.save("./figures/ex_line_marks")

data_zoom(options)

OptionTypeDescription
typestringType of data zoom: "inside" for mouse/touch zoom or "slider" for a visible slider bar.
startnumberWindow start position in percentage (0–100).
endnumberWindow end position in percentage (0–100).
start_valuenumber or stringWindow start position by data value.
end_valuenumber or stringWindow end position by data value.
orientstringOrientation of the slider: "horizontal" or "vertical".
zoom_lockbooleanIf true, the zoom scale is locked and cannot be adjusted.
realtimebooleanIf true, updates the chart in real time while zooming.

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [10, 25, 20, 35, 40], ["name": "Series A"])
.line([1, 2, 3, 4, 5], [15, 30, 25, 40, 45], ["name": "Series B"])
.data_zoom([
"type": "slider",
"start": 20,
"end": 60,
"start_value": 10,
"end_value": 50,
"orient": "horizontal",
"zoom_lock": true,
"realtime": true
])
.legend()
.save("./figures/ex_data_zoom_options")

animation(options)

OptionTypeDescription
animationbooleanEnable/disable animation.
animation_thresholdnumberDisable animation when data count exceeds this.
animation_durationnumberInitial animation duration (ms).
animation_easingstringEasing function name.
animation_delaynumberDelay before animation starts (ms).
animation_duration_updatenumberUpdate animation duration (ms).
animation_easing_updatestringThe animation used when data is updated.
animation_delay_updatenumberUpdate animation delay (ms).

The possible easing function and their effect is summarized in the table below.

Easing FunctionDescription
linearNo easing; constant speed from start to end.
quadraticInStarts slow and accelerates (ease-in, quadratic).
quadraticOutStarts fast and decelerates (ease-out, quadratic).
quadraticInOutSlow start and end, faster in the middle.
cubicInStronger acceleration at the start (cubic).
cubicOutStronger deceleration at the end (cubic).
cubicInOutSmooth acceleration and deceleration (cubic).
quarticInEven sharper acceleration at the beginning.
quarticOutEven sharper deceleration at the end.
quarticInOutVery smooth but dramatic acceleration/deceleration.
quinticInVery strong acceleration from rest.
quinticOutVery strong deceleration to rest.
quinticInOutExtreme smoothness with strong mid-motion speed.
sinusoidalInSlow start using sine curve.
sinusoidalOutSlow end using sine curve.
sinusoidalInOutSmooth sine-based easing throughout.
exponentialInStarts extremely slow, then rapidly speeds up.
exponentialOutStarts fast, then slows dramatically.
exponentialInOutCombines both exponential acceleration and deceleration.
circularInSlow start following a circular curve.
circularOutSlow end following a circular curve.
circularInOutSmooth circular motion at both ends.
elasticInStarts with elastic bounce effect (spring-like).
elasticOutEnds with elastic bounce effect.
elasticInOutElastic effect at both start and end.
backInSlight backward motion before moving forward.
backOutOvershoots slightly, then settles back.
backInOutCombines backward start and overshoot end.
bounceInBounce effect at the beginning.
bounceOutBounce effect at the end.
bounceInOutBounce at both start and end.

Quick examples

Figure()
.line([1, 2, 3, 4, 5], [1, 4, 9, 16, 25], [
"name": "Fast Animation",
"animation": true,
"animation_duration": 500,
"animation_easing": "cubicOut",
"animation_delay": 0,
"animation_duration_update": 300,
"animation_easing_update": "cubicInOut",
"animation_delay_update": 0
])
.line([7, 8, 9, 10, 11], [2, 5, 10, 17, 26], [
"name": "Slow Animation",
"animation": true,
"animation_duration": 2000,
"animation_easing": "elasticOut",
"animation_delay": 200,
"animation_duration_update": 1000,
"animation_easing_update": "elasticInOut",
"animation_delay_update": 100
])
.line([13, 14, 15, 16, 17], [3, 6, 11, 18, 27], [
"name": "No Animation",
"animation": false
])
.legend()
.save("./figures/ex_line_animation")