I am trying to modify the style of x-axis labels by using the Visual function. How can I access "this" scope within that function so I can access variables in my component? Currently, the Visual function only provides AxisLabelVisualArgs.
1 Answer, 1 is accepted
0
Accepted
T. Tsonev
Telerik team
answered on 12 Mar 2019, 11:02 AM
Hi Jacky,
The visual function is used as a callback and will be called in the context of the Chart.
To bind to the original scope, use either bind or an arrow function (types omitted for brevity): constructor() {
this.visual = this.visual.bind(this);
}
public visual(e) {
...
}
// or declare as and arrow function in a field
public visual = (e) => {
...
};
Both will result in this referring to the component instance.
Best Regards,
T. Tsonev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.