C3 js.. Angular 2 Typescript calling external function within c3.generate?
<p>I've searched and worked on this one problem for awhile but I'm not sure what the problem is.. Not sure if it's with angular or c3.</p>

<p>For some reason I cannot call upon my method within the c3.generate function that is in the same component.</p>

<p>The c3 chart is called from the template and it works perfectly. I have tested my somethingMethod() with a button in the template and it works.</p>

<p>I want to be able to call on the somethingMethod() with the c3 onclick function but it's not working. It won't even load this.someTypeTitle='asda';
But an alert works so I'm thinking that I am out of scope but not exactly sure how to fix it.</p>

<pre><code>@Component({
    selector: 'something',
    templateUrl: 'something.component.html',

})
export class SomethingComponent{

    someTypeTitle: string;

    getData(input: string): Array&lt;number&gt;{
        return data;
    }

    somethingMethod(input: string){
        someTypeTitle = input;
    }

    getChart() {
        var chart = c3.generate({
            bindto: '#stackedbar',

            data: {
                x: 'x',
                columns: [
                   this.getData(someString),
                   this.getData(someString) //These work
                ],

                onclick: function (d, e) {
                   alert(this.internal.config.axis_x_categories[d.x]); // This works
                   this.someTypeTitle="asdad"; //This doesn't work.
                   this.someTypeTitle=  this.internal.config.axis_x_categories[d.x]; //This doesn't work.
                   this.somethingMethod(this.internal.config.axis_x_categories[d.x]); //This doesn't work.

                },
}...
</code></pre>