<commit_before>var CHART_OPTS = {
    fontName: 'Sans-Serif',
    fontSize: 10,
    width: 400,
    height:420,
    legend: 'bottom',
    colors:['#2F72FF', '#9FC0FF'],
    chartArea:{top:30}
};

function displayGraphWidgetConfig(widgetId, domainLabel, rangeLabel, link, bagName) {
  jQuery('#widgetdata' + widgetId).hide();
  jQuery('#widgetdatanoresults' + widgetId).hide();
  jQuery('#widgetdatawait' + widgetId).show();
  var extraAttr = getExtraValue(widgetId);
  var wsCall = function wsCall(token) {
    var request_data = {
          widget: widgetId,
          list: bagName,
          filter: extraAttr,
          token: token
      };
    jQuery.getJSON(service + "list/chart", request_data, function(res) {
    if (res.results.length != 0) {
      var viz = google.visualization;
      var data = google.visualization.arrayToDataTable(res.results, false);
      var targetElem = document.getElementById("widgetdata" + widgetId);
      var Chart = null;
      var options = jQuery.extend({}, CHART_OPTS, {title: res.title});
      if (res.chartType == "BarChart") {
          Chart = viz.ColumnChart;
      } else if (res.chartType == "StackedBarChart") {
          Chart = viz.BarChart;
          jQuery.extend(options, {isStacked: true, height: 450});
      } else if (res.chartType == "ScatterPlot") {
          Chart = viz.ScatterChart;
      } else if (res.chartType == "PieChart") {
          Chart = viz.PieChart;
      } else if (res.chartType == "XYLineChart") {
          Chart = viz.LineChart;
      }

      if (domainLabel) {
          jQuery.extend(options, {hAxis: {title: domainLabel, titleTextStyle: {fontName: 'Sans-Serif'}}});
      }
      if (rangeLabel) {
          jQuery.extend(options, {vAxis: {title: rangeLabel, titleTextStyle: {fontName: 'Sans-Serif'}}});
      }
      var viz;
      if (Chart) {
          viz = new Chart(targetElem);
          viz.draw(data, options);
          //if (link != "") {
            google.visualization.events.addListener(viz, 'select', function() {
              var selection = viz.getSelection();
              for (var i = 0; i < selection.length; i++) {
                var item = selection[i];
                if (item.row != null && item.column != null) {
                    var category = res.results[item.row + 1][0];
                    var series = res.results[0][item.column];
                    window.location.assign(webappUrl + "queryForGraphAction.do?bagName=" + bagName
                      + "&category=" + category + "&series=" + series + "&urlGen=" + link);
                } else if (item.row != null) {
                  category = res.results[item.row + 1][0];
                  window.location.assign(webappUrl + "queryForGraphAction.do?bagName=" + bagName
                          + "&category=" + category + "&series=&urlGen=" + link);
                }
              }
            });
          //}
      } else {
          alert("Don't know how to draw " + res.chartType + "s yet!");
      }
      jQuery('#widgetdata' + widgetId).show();
    } else {
        jQuery('#widgetdatanoresults' + widgetId).show();
    }
    jQuery('#widgetdatawait' + widgetId).hide();
    calcNotAnalysed(widgetId, res.notAnalysed);
  });<commit_msg>If widget.link is empty, no listeners on 'select' event are added<commit_after>var CHART_OPTS = {
    fontName: 'Sans-Serif',
    fontSize: 10,
    width: 400,
    height:420,
    legend: 'bottom',
    colors:['#2F72FF', '#9FC0FF'],
    chartArea:{top:30}
};

function displayGraphWidgetConfig(widgetId, domainLabel, rangeLabel, link, bagName) {
  jQuery('#widgetdata' + widgetId).hide();
  jQuery('#widgetdatanoresults' + widgetId).hide();
  jQuery('#widgetdatawait' + widgetId).show();
  var extraAttr = getExtraValue(widgetId);
  var wsCall = function wsCall(token) {
    var request_data = {
          widget: widgetId,
          list: bagName,
          filter: extraAttr,
          token: token
      };
    jQuery.getJSON(service + "list/chart", request_data, function(res) {
    if (res.results.length != 0) {
      var viz = google.visualization;
      var data = google.visualization.arrayToDataTable(res.results, false);
      var targetElem = document.getElementById("widgetdata" + widgetId);
      var Chart = null;
      var options = jQuery.extend({}, CHART_OPTS, {title: res.title});
      if (res.chartType == "BarChart") {
          Chart = viz.ColumnChart;
      } else if (res.chartType == "StackedBarChart") {
          Chart = viz.BarChart;
          jQuery.extend(options, {isStacked: true, height: 450});
      } else if (res.chartType == "ScatterPlot") {
          Chart = viz.ScatterChart;
      } else if (res.chartType == "PieChart") {
          Chart = viz.PieChart;
      } else if (res.chartType == "XYLineChart") {
          Chart = viz.LineChart;
      }

      if (domainLabel) {
          jQuery.extend(options, {hAxis: {title: domainLabel, titleTextStyle: {fontName: 'Sans-Serif'}}});
      }
      if (rangeLabel) {
          jQuery.extend(options, {vAxis: {title: rangeLabel, titleTextStyle: {fontName: 'Sans-Serif'}}});
      }
      var viz;
      if (Chart) {
          viz = new Chart(targetElem);
          viz.draw(data, options);
          if (link != "") {
            google.visualization.events.addListener(viz, 'select', function() {
              var selection = viz.getSelection();
              for (var i = 0; i < selection.length; i++) {
                var item = selection[i];
                if (item.row != null && item.column != null) {
                    var category = res.results[item.row + 1][0];
                    var series = res.results[0][item.column];
                    window.location.assign(webappUrl + "queryForGraphAction.do?bagName=" + bagName
                      + "&category=" + category + "&series=" + series + "&urlGen=" + link);
                } else if (item.row != null) {
                  category = res.results[item.row + 1][0];
                  window.location.assign(webappUrl + "queryForGraphAction.do?bagName=" + bagName
                          + "&category=" + category + "&series=&urlGen=" + link);
                }
              }
            });
          }
      } else {
          alert("Don't know how to draw " + res.chartType + "s yet!");
      }
      jQuery('#widgetdata' + widgetId).show();
    } else {
        jQuery('#widgetdatanoresults' + widgetId).show();
    }
    jQuery('#widgetdatawait' + widgetId).hide();
    calcNotAnalysed(widgetId, res.notAnalysed);
  });
{'fraction_non_alphanumeric': 0.14645379183297513, 'fraction_numerical': 0.007675775253300584, 'mean_word_length': 2.212524654832347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7552695', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1933, 'n_words': 414}