Update point 4.2.7

by kzoon

HTML

<script src="http://code.highcharts.com/4.2.7/highcharts.js"></script>
<!--<script src="http://code.highcharts.com/5.0.0/highcharts.js"></script>-->
<div id="container" style="height: 400px"></div>
<button id="button1" class="autocompare">Faulty update 1st point</button>
<button id="button2" class="autocompare">OK update 1st point</button>
<button id="button3" class="autocompare">OK update 1st point (alternative)</button>

JavaScript

$(function() {
  $('#container').highcharts({
    chart: {
      type: 'column'
    },
    xAxis: {
      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
      dataLabels: {
        enabled: true,
        style: {
          textShadow: "none"
        }
      },
      data: [{
        "y": 90,
        dataLabels: {
          style: {
            fontFamily: "Arial, 'Helvetica Neue', 'Helvetica', sans-serif, Arial, Tahoma",
            color: "rgba(23,211,167,1)"
          }
        }

      }, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
  });

  // button handler
  var chart = $('#container').highcharts();

  $('#button1').click(function() {
    chart.series[0].data[0].update({
      dataLabels: {}
    }, false, false);

    chart.series[0].data[0].update({
      y: 120,
    }, false, false);

    chart.redraw({
      duration: 1000
    });
  });

  $('#button2').click(function() {
    chart.series[0].data[0].update({
      y: 140,
      dataLabels: {}
    }, false, false);

    chart.redraw({
      duration: 1000
    });
  });

  $('#button3').click(function() {
    chart.series[0].data[0].update({
      y: 150,
      dataLabels: {
        style: {
          fontSize: "20px",
        }
      }
    }, false, false);

    chart.redraw({
      duration: 1000
    });
  });

});