Skip to main content
Module

x/fresh_charts/deps.ts>ChartJs.LegendOptions

A server-side-rendered charting library for Fresh
Go to Latest
interface ChartJs.LegendOptions
import { type ChartJs } from "https://deno.land/x/fresh_charts@0.2.1/deps.ts";
const { LegendOptions } = ChartJs;

Properties

display: boolean

Is the legend shown?

position: LayoutPosition

Position of the legend.

align: Align

Alignment of the legend.

maxHeight: number

Maximum height of the legend, in pixels

maxWidth: number

Maximum width of the legend, in pixels

fullSize: boolean

Marks that this box should take the full width/height of the canvas (moving other boxes). This is unlikely to need to be changed in day-to-day use.

reverse: boolean

Legend will show datasets in reverse order.

labels: { boxWidth: number; boxHeight: number; boxPadding: number; color: Color; font: ScriptableAndScriptableOptions<Partial<FontSpec>, ScriptableChartContext>; padding: number; pointStyle: PointStyle; textAlign?: TextAlign; usePointStyle: boolean; useBorderRadius: boolean; borderRadius: number; generateLabels(chart: Chart$4): LegendItem[]; filter(item: LegendItem, data: ChartData): boolean; sort(): number; }
rtl: boolean

true for rendering the legends from right to left.

textDirection: string

This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the legend, regardless of the css specified on the canvas

title: { display: boolean; color: Color; font: ScriptableAndScriptableOptions<Partial<FontSpec>, ScriptableChartContext>; position: "center" | "start" | "end"; padding?: number | ChartArea; text: string; }

Methods

onClick(
e: ChartEvent$1,
legendItem: LegendItem,
): void

A callback that is called when a click event is registered on a label item.

onHover(
e: ChartEvent$1,
legendItem: LegendItem,
): void

A callback that is called when a 'mousemove' event is registered on top of a label item

onLeave(
e: ChartEvent$1,
legendItem: LegendItem,
): void

A callback that is called when a 'mousemove' event is registered outside of a previously hovered label item.