highcharts:将“选择的选项”与“表单输入值”相结合

时间:2014-08-28 14:19:28

标签: select input highcharts radio

让我知道如何组合所选的选项+表单输入值来创建我的图表。 只有我选择的选项" (变量是" x")可用而不是选择的输入值(变量是"总计")。

filterCalc();

function filterCalc() {

  $.getJSON('data_salaries2.JSON', function (data) {
    var x = document.getElementById('people2').selectedIndex;
    var y = document.getElementsByTagName('option')[x].id;

    //radio buttons
    $('input[name=BtRadio]').click(function () {
      // Whenever a radiobox is clicked, the following code would be executed
      var total = $('input[name=BtRadio]:checked').val();
    });

    //Charts
    var chart = new Highcharts.Chart({
      chart: {
        renderTo: 'container',
        type: 'column',
      },
      labels: {
        formatter: function () {
          return this.value.toLocaleString();
        }
      },
      series: [{
        name: [data.annee2011[x].metier],
        data: [data.annee2005[x].total, data.annee2006[x].total, data.annee2007[x].total, data.annee2008[x].total, data.annee2009[x].total, data.annee2010[x].total, data.annee2011[x].total]
      }, ]
    });
  });
};

0 个答案:

没有答案