-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Chart.js 4 and use my own chartjs-node-canvas (#190)
- Loading branch information
Showing
11 changed files
with
1,778 additions
and
1,034 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/node_modules/@sgratzl/chartjs-chart-boxplot/build/index.js b/node_modules/@sgratzl/chartjs-chart-boxplot/build/index.js | ||
index 29e5b08..203670f 100644 | ||
--- a/node_modules/@sgratzl/chartjs-chart-boxplot/build/index.js | ||
+++ b/node_modules/@sgratzl/chartjs-chart-boxplot/build/index.js | ||
@@ -71,7 +71,7 @@ function determineStatsOptions(options) { | ||
}; | ||
} | ||
function boxplotStats(arr, options) { | ||
- const vs = window.Float64Array != null && !(arr instanceof Float32Array || arr instanceof Float64Array) | ||
+ const vs = typeof Float64Array !== 'undefined' && !(arr instanceof Float32Array || arr instanceof Float64Array) | ||
? Float64Array.from(arr) | ||
: arr; | ||
const r = boxplot(vs, determineStatsOptions(options)); | ||
@@ -104,7 +104,7 @@ function violinStats(arr, options) { | ||
if (arr.length === 0) { | ||
return undefined; | ||
} | ||
- const vs = window.Float64Array != null && !(arr instanceof Float32Array || arr instanceof Float64Array) | ||
+ const vs = typeof Float64Array !== 'undefined' && !(arr instanceof Float32Array || arr instanceof Float64Array) | ||
? Float64Array.from(arr) | ||
: arr; | ||
const stats = boxplot(vs, determineStatsOptions(options)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/vendored/chartjs-node-canvas/src/backgroundColourPlugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Chart as ChartJS, Plugin as ChartJSPlugin } from 'chart.js'; | ||
|
||
export class BackgroundColourPlugin implements ChartJSPlugin { | ||
public readonly id: string = | ||
'chartjs-plugin-chartjs-node-canvas-background-colour'; | ||
|
||
public constructor( | ||
private readonly _width: number, | ||
private readonly _height: number, | ||
private readonly _fillStyle: string | ||
) {} | ||
|
||
public beforeDraw(chart: ChartJS): boolean | void { | ||
const ctx = chart.ctx; | ||
ctx.save(); | ||
ctx.fillStyle = this._fillStyle; | ||
ctx.fillRect(0, 0, this._width, this._height); | ||
ctx.restore(); | ||
} | ||
} |
Oops, something went wrong.