Adding a new tab to snoTHAW

<= Back to main page

To find a step in the prodcedure, search “SNOTHAW_NEWTOOL_[STEP #]”

In heatmap_query.dhtml

  1. Add a section
<section class="tool [toolCSSClass]" id="Tool_Name"></section>

In heatmapToolbox.js

  1. Instantiate your tool instance
    let newTool = new HeatmapNewTool(...)
  1. Add the tool to the toollist
tb.addTool(newTool);
  1. Create your tool class
class HeatmapNewTool extends HeatmapTool {
  constructor(name, [params]) {
    super(name);
    this.dataParser = new HeatmapNewToolDataParser(this);
    this.define();
    this.ready = true;
  }

  // ! Deprecated
  get makeHeatmapAddress() {
    return null;
  }

  define() {
    let THIS = this;
    $(document).ready(function() {
      $("#" + THIS.name)
        .append(
        //HTML string
        //...
        );
    });
    // Declare all your fields
    // ...

    this.addElements([
      /*Your comma separated fields*/
    ]);
  }
}
  1. Create your DataParser
class HeatmapNewToolDataParser extends HeatmapDataParser {
  constructor(tool) {
    super(tool);
  }

  // ! Deprecated
  verifyData() {
    return null;
  }

  /**
   * Acquires the asscoaited tool's data and fetches the entries in the datatable
   * @returns {Object} Data to be sent to the Visualization
   */
  parseData() {
    //Your parsing function
  }
}