Skip to content

Get other annotations width from an annotation scriptable option. #865

@zk118

Description

@zk118

Hey, thank's for this usefull plugin !

I would like to get the width of an annotation from within another annotation scriptable option (to place the 2nd annotation next to the first relative to the width of the 1st annotation).

I want to accomplish something like that:

annotation1: {
	type: 'label',
	xValue: () => 0,
	yValue: () => 1,
	content: () => "Annotation 1",
	padding: 5,
	color: 'black',
},

annotation2: {
	type: 'label',
	xValue: () => 0,
	yValue: () => 1,
	xAjust: (cxt) => {
		return ctx.chart.options.plugins.annotation.annotations.annotation1.width
	},
	content: () => "Annotation 2",
	padding: 5,
	color: 'black',
}

But the problem is ctx.chart.options.plugins.annotation.annotations.annotation1.width doesn't exists.
Is it possible to achieve ?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions