<commit_before>//get_feed_data_async is defined in /Modules/vis/visualisations/common/api.js
/*global get_feed_data_async */
//tooltip and parse_timepicker_time are defined in Modules/vis/visualisations/common/vis.helper.js
/*global tooltip */
/*global parse_timepicker_time */
/*global view */
/*global multigraphFeedlist */
/*global embed*/
/*eslint no-undef: "error"*/
/*eslint no-console: "error"*/
var Console;
var plotdata = [];
var timeWindowChanged = 0;
var ajaxAsyncXdr = [];
var eventVisFeedData;
var eventRefresh;
var showlegend = true;
var datetimepicker1;
var datetimepicker2;
var datatype;
var graphtype;

function convertToPlotlist(multigraphFeedlist) {
  if (!multigraphFeedlist[0]) {return false;}
  var plotlist = [];
  
  var showtag = (typeof multigraphFeedlist[0]["showtag"] !== "undefined" ? multigraphFeedlist[0]["showtag"] : true);
  showlegend = (typeof multigraphFeedlist[0]["showlegend"] === "undefined" || multigraphFeedlist[0]["showlegend"]);
  var barwidth = 1;
  
  view.ymin = (typeof multigraphFeedlist[0]["ymin"] !== "undefined" ? multigraphFeedlist[0]["ymin"] : null);
  view.ymax = (typeof multigraphFeedlist[0]["ymax"] !== "undefined" ? multigraphFeedlist[0]["ymax"] : null);
  view.y2min = (typeof multigraphFeedlist[0]["y2min"] !== "undefined" ? multigraphFeedlist[0]["y2min"] : null);
  view.y2max = (typeof multigraphFeedlist[0]["y2max"] !== "undefined" ? multigraphFeedlist[0]["y2max"] : null);

  datatype=1;

  for (var z in multigraphFeedlist) {
    var currentFeed=multigraphFeedlist[parseInt(z,10)];
    var tag = (showtag && typeof currentFeed["tag"] !== "undefined" && currentFeed["tag"] !== "" ? currentFeed["tag"]+": " : "");
    var stacked = (typeof currentFeed["stacked"] !== "undefined" && currentFeed["stacked"]);
    barwidth = typeof currentFeed["barwidth"] === "undefined" ? 1 : currentFeed["barwidth"];

    if ( typeof currentFeed["graphtype"] === "undefined" ) {
      currentFeed["datatype"] === "1" ? graphtype="lines" : graphtype="bars";
    } else {
      graphtype=currentFeed["graphtype"];
    }

    if (currentFeed["datatype"] === "2") {
      datatype=2;
    }
    
    if (graphtype.substring(0, 5) === "lines") {
      plotlist[parseInt(z,10)] = {
        id: currentFeed["id"],
        selected: 1,
        plot: {
          data: null,
          label: tag + currentFeed["name"],
          stack: stacked,
          points: { 
            show: true,
            radius: 0,
            lineWidth: 1, // in pixels
            fill: false
          },
          lines: {
            show: true,
            fill: currentFeed["fill"] ? (stacked ? 1.0 : 0.5) : 0.0,
            steps: graphtype === "lineswithsteps" ? true : false
          }
        }
      };
    }

    else if (graphtype === "bars") {
      plotlist[parseInt(z,10)] = {
        id: currentFeed["id"],
        selected: 1,
        plot: {
          data: null,
          label: tag + currentFeed["name"],
          stack: stacked,
          bars: {
            show: true,
            align: "center", barWidth: 3600*24*1000*barwidth, fill: currentFeed["fill"] ? (stacked ? 1.0 : 0.5) : 0.0
          }
        }
      };
    } else {
      // custom console
      Console.log("ERROR: Unknown plot graphtype! Graphtype: ", currentFeed["graphtype"]);
    }

    if (currentFeed["left"] === true) {
      plotlist[parseInt(z,10)].plot.yaxis = 1;
    } else if (currentFeed["right"] === true) {
      plotlist[parseInt(z,10)].plot.yaxis = 2;
    } else {
      // custom console
      Console.log("ERROR: Unknown plot alignment! Alignment setting: ", currentFeed["right"]);
    }

    // Only set the plotcolour variable if we have a value to set it with
    if (currentFeed["lineColour"]) {
      // Some browsers really want the leading "#". It works without in chrome, not in IE and opera.
      // What the hell, people?
      if (currentFeed["lineColour"].indexOf("#") === -1) {
        plotlist[parseInt(z,10)].plot.color = "#" + currentFeed["lineColour"];
      } else {
        plotlist[parseInt(z,10)].plot.color = currentFeed["lineColour"];
      }
    }

    if (currentFeed["left"] === false && currentFeed["right"] === false) {
      plotlist[parseInt(z,10)].selected = 0;
    }
  }
  return plotlist;
}

function plot() {
  $.plot($("#graph"), plotdata, {
    canvas: true,
    grid: { show: true, hoverable: true, clickable: true },<commit_msg>Update multigraph.js<commit_after>//get_feed_data_async is defined in /Modules/vis/visualisations/common/api.js
/*global get_feed_data_async */
//tooltip and parse_timepicker_time are defined in Modules/vis/visualisations/common/vis.helper.js
/*global tooltip */
/*global parse_timepicker_time */
/*global view */
/*global multigraphFeedlist */
/*global embed*/
/*eslint no-undef: "error"*/
/*eslint no-console: ["error", { allow: ["warn", "error"] }] */

var plotdata = [];
var timeWindowChanged = 0;
var ajaxAsyncXdr = [];
var eventVisFeedData;
var eventRefresh;
var showlegend = true;
var datetimepicker1;
var datetimepicker2;
var datatype;
var graphtype;

function convertToPlotlist(multigraphFeedlist) {
  if (!multigraphFeedlist[0]) {return false;}
  var plotlist = [];
  
  var showtag = (typeof multigraphFeedlist[0]["showtag"] !== "undefined" ? multigraphFeedlist[0]["showtag"] : true);
  showlegend = (typeof multigraphFeedlist[0]["showlegend"] === "undefined" || multigraphFeedlist[0]["showlegend"]);
  var barwidth = 1;
  
  view.ymin = (typeof multigraphFeedlist[0]["ymin"] !== "undefined" ? multigraphFeedlist[0]["ymin"] : null);
  view.ymax = (typeof multigraphFeedlist[0]["ymax"] !== "undefined" ? multigraphFeedlist[0]["ymax"] : null);
  view.y2min = (typeof multigraphFeedlist[0]["y2min"] !== "undefined" ? multigraphFeedlist[0]["y2min"] : null);
  view.y2max = (typeof multigraphFeedlist[0]["y2max"] !== "undefined" ? multigraphFeedlist[0]["y2max"] : null);

  datatype=1;

  for (var z in multigraphFeedlist) {
    var currentFeed=multigraphFeedlist[parseInt(z,10)];
    var tag = (showtag && typeof currentFeed["tag"] !== "undefined" && currentFeed["tag"] !== "" ? currentFeed["tag"]+": " : "");
    var stacked = (typeof currentFeed["stacked"] !== "undefined" && currentFeed["stacked"]);
    barwidth = typeof currentFeed["barwidth"] === "undefined" ? 1 : currentFeed["barwidth"];

    if ( typeof currentFeed["graphtype"] === "undefined" ) {
      currentFeed["datatype"] === "1" ? graphtype="lines" : graphtype="bars";
    } else {
      graphtype=currentFeed["graphtype"];
    }

    if (currentFeed["datatype"] === "2") {
      datatype=2;
    }
    
    if (graphtype.substring(0, 5) === "lines") {
      plotlist[parseInt(z,10)] = {
        id: currentFeed["id"],
        selected: 1,
        plot: {
          data: null,
          label: tag + currentFeed["name"],
          stack: stacked,
          points: { 
            show: true,
            radius: 0,
            lineWidth: 1, // in pixels
            fill: false
          },
          lines: {
            show: true,
            fill: currentFeed["fill"] ? (stacked ? 1.0 : 0.5) : 0.0,
            steps: graphtype === "lineswithsteps" ? true : false
          }
        }
      };
    }

    else if (graphtype === "bars") {
      plotlist[parseInt(z,10)] = {
        id: currentFeed["id"],
        selected: 1,
        plot: {
          data: null,
          label: tag + currentFeed["name"],
          stack: stacked,
          bars: {
            show: true,
            align: "center", barWidth: 3600*24*1000*barwidth, fill: currentFeed["fill"] ? (stacked ? 1.0 : 0.5) : 0.0
          }
        }
      };
    } else {
      // custom console
      console.error("ERROR: Unknown plot graphtype! Graphtype: ", currentFeed["graphtype"]);
    }

    if (currentFeed["left"] === true) {
      plotlist[parseInt(z,10)].plot.yaxis = 1;
    } else if (currentFeed["right"] === true) {
      plotlist[parseInt(z,10)].plot.yaxis = 2;
    } else {
      // custom console
      console.error("ERROR: Unknown plot alignment! Alignment setting: ", currentFeed["right"]);
    }

    // Only set the plotcolour variable if we have a value to set it with
    if (currentFeed["lineColour"]) {
      // Some browsers really want the leading "#". It works without in chrome, not in IE and opera.
      // What the hell, people?
      if (currentFeed["lineColour"].indexOf("#") === -1) {
        plotlist[parseInt(z,10)].plot.color = "#" + currentFeed["lineColour"];
      } else {
        plotlist[parseInt(z,10)].plot.color = currentFeed["lineColour"];
      }
    }

    if (currentFeed["left"] === false && currentFeed["right"] === false) {
      plotlist[parseInt(z,10)].selected = 0;
    }
  }
  return plotlist;
}

function plot() {
  $.plot($("#graph"), plotdata, {
    canvas: true,
    grid: { show: true, hoverable: true, clickable: true },
{'fraction_non_alphanumeric': 0.16802628597326083, 'fraction_numerical': 0.017221844550192614, 'mean_word_length': 2.9869015356820237, 'pattern_counts': {'":': 2, '<': 3, '<?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': '3515652', 'n_tokens_mistral': 2948, 'n_tokens_neox': 2804, 'n_words': 624}