mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
chart instance has properties "ctx", "canvas", "chartArea"
ctx, canvas https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L78-L79 chartArea https://github.com/chartjs/Chart.js/blob/master/src/core/core.layoutService.js#L417-L423
This commit is contained in:
@@ -26,3 +26,12 @@ let chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
console.log(chart.ctx && chart.ctx.font);
|
||||
console.log(chart.canvas && chart.canvas.tagName);
|
||||
if (chart.chartArea) {
|
||||
console.log(chart.chartArea.top);
|
||||
console.log(chart.chartArea.right);
|
||||
console.log(chart.chartArea.bottom);
|
||||
console.log(chart.chartArea.left);
|
||||
}
|
||||
|
||||
Vendored
+10
@@ -26,6 +26,9 @@ declare class Chart {
|
||||
getElementAtEvent: (e: any) => {};
|
||||
getElementsAtEvent: (e: any) => Array<{}>;
|
||||
getDatasetAtEvent: (e: any) => Array<{}>;
|
||||
ctx: CanvasRenderingContext2D|null;
|
||||
canvas: HTMLCanvasElement|null;
|
||||
chartArea: Chart.ChartArea;
|
||||
static pluginService: PluginServiceStatic;
|
||||
|
||||
static defaults: {
|
||||
@@ -80,6 +83,13 @@ declare namespace Chart {
|
||||
|
||||
type PositionType = 'left' | 'right' | 'top' | 'bottom';
|
||||
|
||||
interface ChartArea {
|
||||
top: number;
|
||||
right: number;
|
||||
bottom: number;
|
||||
left: number;
|
||||
}
|
||||
|
||||
interface ChartLegendItem {
|
||||
text?: string;
|
||||
fillStyle?: string;
|
||||
|
||||
Reference in New Issue
Block a user