Cant' inject a label of chart

Hi ,

I used the “inject” button to inject a label of a chart, but the field injected is nul in runtime.

image

image

Did i missing something or this is a bug?

In the init method, visual components are not yet initialized. Move that line of code to method postInit or ready.

This is not true. All components are injected before init called or InitEvent fired.

The thing is that sub-elements of Chart are not components and cannot be injected.

@lugreen please share your XML, it is not clear what you are trying to inject.

2 Likes

Hi Yuriy,

Thanks for your reply.

I also think so, but why the “label” element of a chart can be list in injectable componets list :

The xml descriptor is in here:

It come from the dashboard addon demo:

Most likely it is a bug in Studio inject dialog. Probably, @shustanov can help us with this.

Hi Yuriy,

Thanks,

Then, which way is the best for getting the label of a chart?

I found there is a method : getAllLabels() in Chart class, is this the best way?

Yes, you can just get labels from a Chart and modify them (the same for any other options). Do not forget to trigger Chart.repaint() method after chart options changes.

Hi Yuriy,

Thanks a lot.

Hi! Thank you for reporting the problem, I have created an issue.

1 Like