I have a chart object with an extension function configureChart.
It sets markers in the chart and works properly when a user configures the chart.
It is part of a template, and when the datasets in the chart change, that extension function is not triggered.
Is there a way to trigger it by a script?
No. You should create marker instances that know how to recheck the data every time they are asked for the value to display.
Your recommendation is of course correct, but according to the docs, it is technically possible to fire an extension function from a script using the invoke helper function.
I tested this and was able to programmatically fire the configureChart extension function from a button using the following script:
from java.lang import String
chartComponent = event.source.parent.getComponent('Chart')
loggerEx = None
methodName = "configureChart"
returnType = String
defaultValue = None
args = [chartComponent.chart]
chartComponent.extensionFunctions.get("configureChart").invoke(chartComponent, loggerEx, methodName, returnType, defaultValue, args)