It turns out (based on your comment) that labels are not an array, but a method, so you cannot write:
This is why error says its unsubscribtable.
Find what is that you input as “labels”. If its a method that returns labels probably you have to just write labels() somewhere. Or maybe you are inputting something wrong to your function as labels.
CLICK HERE to find out more related problems solutions.