API Reference

Common configuration, custom widget patterns, and context interaction patterns shared across all chart types.

AG Style Config

Colors

PropertyTypeDefaultDescription
colors.fillsstring[]AG_FILLSArray of fill colors for chart series.
colors.strokesstring[]AG_STROKESArray of stroke colors for chart series.

Background

PropertyTypeDefaultDescription
backgroundstring"white"Chart background color.

Font

PropertyTypeDefaultDescription
font.familystring"Verdana, sans-serif"Default font family for all text elements.
font.sizenumber13Default font size in pixels.

Title

PropertyTypeDefaultDescription
title.textstring""Title text content.
title.visiblebooleantrueWhether the title is visible.
title.colorstring"#181d1f"Title text color.
title.fontSizenumber18Title font size in pixels.
title.fontFamilystringundefinedTitle font family. Falls back to font.family if not set.
title.fontWeightstring"bold"Title font weight.
title.position"top" | "bottom""top"Position of the title relative to the chart.
title.alignment"start" | "center" | "end""start"Horizontal alignment of the title.

Subtitle

PropertyTypeDefaultDescription
subtitle.visiblebooleanfalseWhether the subtitle is visible.
subtitle.textstring""Subtitle text content.
subtitle.colorstring"#8d949a"Subtitle text color.
subtitle.fontSizenumber14Subtitle font size in pixels.
subtitle.fontFamilystringundefinedSubtitle font family.
subtitle.fontWeightstringundefinedSubtitle font weight.

Legend

PropertyTypeDefaultDescription
legend.visiblebooleantrueWhether the legend is visible.
legend.position"top" | "bottom" | "right" | "right-top" | "right-center" | "right-bottom""bottom"Position of the legend relative to the chart.
legend.gapnumber16Gap between legend items in pixels.
legend.colorstring"#585858"Legend text color.

Axis

PropertyTypeDefaultDescription
axis.colorstring"#8a8c8c"Axis line color.
axis.thicknessnumber1Axis line thickness in pixels.
axis.label.colorstring"#585858"Axis label text color.
axis.label.fontSizenumber13Axis label font size.
axis.label.gapnumber11Gap between axis labels and the axis line.
axis.label.format(name: string, index: number, axis: "x" | "y") => string(name) => nameFormatter function for axis labels.
axis.tick.enabledbooleanfalseWhether axis ticks are enabled.
axis.tick.sizenumber6Size of axis ticks in pixels.
axis.xLine.visiblebooleantrueWhether the x-axis line is visible.
axis.yLine.visiblebooleantrueWhether the y-axis line is visible.

Grid

PropertyTypeDefaultDescription
grid.colorstring"#e2e2e2"Grid line color.
grid.thicknessnumber1Grid line thickness in pixels.
grid.dashnumber[][]Dash pattern for grid lines.
grid.xLine.visiblebooleanfalseWhether vertical grid lines are visible.
grid.yLine.visiblebooleantrueWhether horizontal grid lines are visible.

Padding

PropertyTypeDefaultDescription
padding.topnumber20Top padding in pixels.
padding.rightnumber20Right padding in pixels.
padding.bottomnumber20Bottom padding in pixels.
padding.leftnumber20Left padding in pixels.

Tooltip

PropertyTypeDefaultDescription
tooltip.enabledbooleantrueWhether tooltips are enabled.
tooltip.backgroundColorstring"white"Tooltip background color.
tooltip.textColorstring"#181d1f"Tooltip text color.
tooltip.borderColorstring"#e2e2e2"Tooltip border color.
tooltip.borderRadiusnumber4Tooltip border radius in pixels.
tooltip.paddingnumber12Tooltip padding in pixels.
Toast Style Config

Colors

PropertyTypeDefaultDescription
colorsstring[]TOAST_COLORSArray of colors for chart series.

Font

PropertyTypeDefaultDescription
font.familystring"Arial"Default font family for all text elements.
font.sizenumber11Default font size in pixels.

Title

PropertyTypeDefaultDescription
title.textstring""Title text content.
title.visiblebooleantrueWhether the title is visible.
title.colorstring"#333333"Title text color.
title.fontSizenumber18Title font size in pixels.
title.fontFamilystringundefinedTitle font family. Falls back to font.family if not set.
title.fontWeightstring"bold"Title font weight.
title.position"top" | "bottom""top"Position of the title relative to the chart.
title.alignment"start" | "center" | "end""start"Horizontal alignment of the title.

Legend

PropertyTypeDefaultDescription
legend.visiblebooleantrueWhether the legend is visible.
legend.position"top" | "bottom" | "right" | "right-top" | "right-center" | "right-bottom""bottom"Position of the legend relative to the chart.
legend.gapnumber12Gap between legend items in pixels.

Axis

PropertyTypeDefaultDescription
axis.colorstring"#333333"Axis line color.
axis.thicknessnumber1Axis line thickness in pixels.
axis.label.colorstring"#333333"Axis label text color.
axis.label.fontSizenumber11Axis label font size.
axis.label.gapnumber8Gap between axis labels and the axis line.
axis.label.format(name: string, index: number, axis: "x" | "y") => string(name) => nameFormatter function for axis labels.
axis.tick.sizenumber6Size of axis ticks in pixels.

Grid

PropertyTypeDefaultDescription
grid.colorstring"rgba(0, 0, 0, 0.05)"Grid line color.
grid.thicknessnumber1Grid line thickness in pixels.

Padding

PropertyTypeDefaultDescription
padding.topnumber20Top padding in pixels.
padding.rightnumber20Right padding in pixels.
padding.bottomnumber20Bottom padding in pixels.
padding.leftnumber20Left padding in pixels.

Animation

PropertyTypeDefaultDescription
animation.enabledbooleantrueWhether animations are enabled.
animation.durationnumber300Animation duration in milliseconds.
animation.staggerDelaynumber60Stagger delay between animated elements in milliseconds.

Tooltip

PropertyTypeDefaultDescription
tooltip.enabledbooleantrueWhether tooltips are enabled.
tooltip.backgroundColorstring"rgba(50,50,50,0.6)"Tooltip background color.
tooltip.textColorstring"white"Tooltip text color.
tooltip.borderRadiusnumber4Tooltip border radius in pixels.
tooltip.paddingnumber14Tooltip padding in pixels.

Custom Part Example

import { ToastBarChart } from "@/components/flitter/charts/toast-bar-chart";

// Override any custom part by passing a function
<ToastBarChart
  data={data}
  config={{
    ...config,
    bar: { gap: 4, cornerRadius: 6 },
  }}
  custom={{
    bar: (args, context) => {
      // Return a custom Widget for each bar
      return Container({
        decoration: new BoxDecoration({
          color: args.isHovered ? "red" : context.config.colors[0],
          borderRadius: BorderRadius.circular(args.isHovered ? 8 : 4),
        }),
      });
    },
  }}
/>