Update options after load?

Feb 13, 2015 at 6:16 PM
Edited Feb 13, 2015 at 6:16 PM
How do I update the options on a chart after it loads? I'd like to use the highcharts-regression plugin, but I can't figure out how to either set the options in code, or set them after load. What I'd really like is a button that turns it on or off. Everything I've tried doesn't seem to be working. My last attempt looked like this:
<button id="test">Test</button>
<script type="text/javascript">
    $(document).ready(function () {
        $("#test").click(function () {
            var chart = $("#chart_container").highcharts({
                regression: true, regressionSettings: {
                    type: 'loess',
                    color: '#1111cc',
                    loessSmooth: 50
                }
            });
        });
    });
</script>
With this, the plugin is getting a null reference and blowing up.