使用下拉菜单更新条形图

时间:2017-03-22 11:12:11

标签: javascript jquery

我正在尝试根据下拉菜单更改xmlURL的值。传递值时,我想重新加载条形图。有小费吗?

google.load('visualization', '1', {
  packages: ['corechart', 'bar']
});
google.setOnLoadCallback(drawStacked);

var identified_cash_flows = 0;
var Unidentified_transaction = 0;
var Unidentified_transaction, _within_overall_threshold = 0;
var Identified_counterparty, _unidentified_transaction, _above_threshold = 0;
var Identified_counterparty, _unidentified_transaction, _within_overall_threshold = 0;
var Identified_counterparty, _unidentified_amount, _above_threshold = 0;
var Identified_counterparty, _unidentified_amount, _within_overall_threshold = 0;
var Identified_transaction, _frequency_limit = 0;
var Identified_transaction, _above_cumulative_threshold = 0;
var Identified_transaction, _unidentified_type = 0;
var Identified_transaction = 0;

var counts = {};
var xmlURL = "https://connect.compliancewise.nl/compliancewise/sheetViewExportXML.action?metaData.siteID=242&metaData.sheetId=3832&metaData.sheetViewID=26050&metaData.isheetExportType=xml";
var xmlURL2 = "https://connect.compliancewise.nl/compliancewise/sheetViewExportXML.action?metaData.siteID=242&metaData.sheetId=3832&metaData.sheetViewID=25667&metaData.isheetExportType=xml";
var xml;
var urlie;

var selectUrl;
window.onload = function() {
  selectUrl = document.getElementById('selectYear');
}

function changeHiddenInput(objDropDown) {
  console.log(objDropDown);
  var objHidden = document.getElementById("hiddenInput");
  objHidden.value = objDropDown.value;
  urlie = objHidden.value;
  result.innerHTML = urlie || "";
}

$j.ajax({
  url: xmlUrl,
  dataType: "xml",
  beforeSend: function() {
    $j('#loader').hide();
  },
  success: function(data) {
    xml = data;
    $j('#loader').hide();
    createBarchart();
  }
});
<td colspan="2" rowspan="2" style="height: 300px;">
  <select id="selectYear" onchange="changeHiddenInput(this)">
    <option selected="selected" value="https://connect.compliancewise.nl/compliancewise/sheetViewExportXML.action?metaData.siteID=242&metaData.sheetId=3832&metaData.sheetViewID=26050&metaData.isheetExportType=xml">2016</option>
    <option value="https://connect.compliancewise.nl/compliancewise/sheetViewExportXML.action?metaData.siteID=242&metaData.sheetId=3832&metaData.sheetViewID=25667&metaData.isheetExportType=xml">2017</option>
  </select>

  <input type="hidden" name="hiddenInput" id="hiddenInput" value="" />
  <script type="text/javascript" src="https://www.google.com/jsapi?autoload= {'modules':[{'name':'visualization','version':'1.1','packages':['corechart', 'bar']}]}"></script>
  <div style="border: 0px solid rgb(201, 0, 1); overflow: hidden; margin: 15px auto; max-width: 100%;">

我知道我正在使用旧的库加载器代码,但这是有原因的。

1 个答案:

答案 0 :(得分:0)

drawStackedresult

有两个未定义的值