Skip to main content
Module

x/fresh_charts/deps.ts>ChartJs.Scale

A server-side-rendered charting library for Fresh
Latest
class ChartJs.Scale
import { ChartJs } from "https://deno.land/x/fresh_charts@0.3.1/deps.ts";
const { Scale } = ChartJs;

Constructors

new
Scale(cfg: { id: string; type: string; ctx: CanvasRenderingContext2D; chart: Chart; })
interface ChartJs.Scale
implements Element<unknown, O>, LayoutItem
import { type ChartJs } from "https://deno.land/x/fresh_charts@0.3.1/deps.ts";
const { Scale } = ChartJs;

Properties

readonly
id: string
readonly
type: string
readonly
ctx: CanvasRenderingContext2D
readonly
chart: Chart
maxWidth: number
maxHeight: number
paddingTop: number
paddingBottom: number
paddingLeft: number
paddingRight: number
axis: string
labelRotation: number
min: number
max: number
ticks: Tick[]

Methods

getMatchingVisibleMetas(type?: string): ChartMeta[]
drawTitle(chartArea: ChartArea): void
drawLabels(chartArea: ChartArea): void
drawGrid(chartArea: ChartArea): void
getDecimalForPixel(pixel: number): number
getPixelForDecimal(decimal: number): number

Utility for getting the pixel location of a percentage of scale The coordinate (0, 0) is at the upper-left corner of the canvas

getPixelForTick(index: number): number

Returns the location of the tick at the given index The coordinate (0, 0) is at the upper-left corner of the canvas

getLabelForValue(value: number): string

Used to get the label to display in the tooltip for the given value

getLineWidthForValue(value: number): number

Returns the grid line width at given value

getPixelForValue(value: number, index?: number): number

Returns the location of the given data point. Value can either be an index or a numerical value The coordinate (0, 0) is at the upper-left corner of the canvas

getValueForPixel(pixel: number): number | undefined

Used to get the data value from a given pixel. This is the inverse of getPixelForValue The coordinate (0, 0) is at the upper-left corner of the canvas

getBaseValue(): number
getBasePixel(): number

Returns the pixel for the minimum chart value The coordinate (0, 0) is at the upper-left corner of the canvas

init(options: O): void
parse(raw: unknown, index: number): unknown
getUserBounds(): { min: number; max: number; minDefined: boolean; maxDefined: boolean; }
getMinMax(canStack: boolean): { min: number; max: number; }
getTicks(): Tick[]
getLabels(): string[]
getLabelItems(chartArea?: ChartArea): LabelItem[]
beforeUpdate(): void
configure(): void
afterUpdate(): void
beforeSetDimensions(): void
setDimensions(): void
afterSetDimensions(): void
beforeDataLimits(): void
determineDataLimits(): void
afterDataLimits(): void
beforeBuildTicks(): void
buildTicks(): Tick[]
afterBuildTicks(): void
beforeTickToLabelConversion(): void
generateTickLabels(ticks: Tick[]): void
afterTickToLabelConversion(): void
beforeCalculateLabelRotation(): void
calculateLabelRotation(): void
afterCalculateLabelRotation(): void
beforeFit(): void
fit(): void
afterFit(): void
isFullSize(): boolean