billy jean
billy jean

Reputation: 1419

"Extend" highcharts chart add properties and functions, prototype

Another guy here trying to understand how to "extend" js "classes", functional objects.

Specifically i am using highcharts and need to add additional properties and some methods.

i am creating a chart like this:

var theChart = $('#chartDiv').highcharts('StockChart', {
        chart: {
            plotBorderColor: '#2d2d30',
            plotBorderWidth: 1,
            backgroundColor: '#1e1e1e',
            marginTop: 2,
            animation: true,
            spacingBottom: 0,
            spacingTop: 10,
            ..........................

         });
 var chart = $('#chartDiv').highcharts();

So where and how exactly would i add additional properties so the final 'chart' object would have them? I guess as a first or second question is why wouldn't the 'theChart' var not be the actual chart? i don't get why i need the second var and line var chart = $('#chartDiv').highcharts(); to have an actual chart object. Could be another question all together.. but adding the additional properties and methods to the main highCharts function/class is the question. Hope this makes sense.

Upvotes: 1

Views: 2709

Answers (1)

Splinteer
Splinteer

Reputation: 1264

Maybe with the .setOptions(): http://www.highcharts.com/docs/getting-started/how-to-set-options

What options do you want to add?

Upvotes: 1

Related Questions