Skip to content

Commit

Permalink
Option to adjust the font size of the YAxis
Browse files Browse the repository at this point in the history
  • Loading branch information
J053Fabi0 committed Jun 6, 2024
1 parent c968680 commit f120eb1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions graph/GraphInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface GraphOptions {
titleColor: string;
xTextColor: string;
yTextColor: string;
/** Defaults to 10pt */
yTextSize: number;

// Segmentation Color
xSegmentColor: string;
Expand Down Expand Up @@ -107,6 +109,7 @@ export class Graph {
titleColor: (config && config.titleColor) ?? "rgb(255,255,255)",
xTextColor: (config && config.xTextColor) ?? "rgb(255,255,255)",
yTextColor: (config && config.yTextColor) ?? "rgb(255,255,255)",
yTextSize: (config && config.yTextSize) ?? 10,

xSegmentColor: (config && config.xSegmentColor) ?? "rgb(255,255,255)",
ySegmentColor: (config && config.ySegmentColor) ?? "rgb(255,255,255)",
Expand Down Expand Up @@ -240,6 +243,7 @@ export class Graph {
const entry = this._entries[i];
ctx.fillStyle = this._options.xSegmentColor;
ctx.strokeStyle = this._options.xSegmentColor;
ctx.font = this._options.yTextSize + "px Cochin";

if (entry?.label !== "") {
const entryFloatVal = (entry && entry.label !== undefined && Number.parseFloat(entry.label)) || NaN;
Expand Down

0 comments on commit f120eb1

Please sign in to comment.