TestMethods

Test Methods op axis en changing option on rendered chart

by kzoon

HTML

<script src="http://highcharts.com/js/testing.js"></script>
<div id="container" style="height: 400px"></div>

<button id="button">Set extremes</button>

JavaScript

var chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container',
        plotBorderWidth: 1
    },
    
    xAxis: {
    },
    yAxis: {
    startOnTick:true,  
        endOnTick:true,
        //opposite:true      
plotBands: [{ color: 'red',
              from: 100, 
to: 175
        }],


        title:{text:'koos'}
},

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
    }]
});


// the button action
$('#button').click(function() {
   //chart.yAxis[0].setExtremes(40, 210);
  var yAxis = chart.yAxis[0];
  yAxis.options.startOnTick = false;//werkt wel 
    yAxis.options.endOnTick = false;//werkt wel
    yAxis.options.max=310;//werkt wel
    yAxis.options.min=10; //werkt wel
    yAxis.options.plotBands[0].from=75;  //werkt wel
    yAxis.options.plotBands[0].color='#FCFFC5' //werkt niet

    yAxis.options.title.text='test koos';
    yAxis.options.gridLineWidth=4;
   //yAxis.options.opposite=false;

    var s1 = chart.series[0];
s1.options.name ='test kooos';
chart.redraw();

 });