src/model/vizmapper.js
/**
   * Get the computed style of an element in the Cytoscape stylesheet format
   * @param {Cytoscape.Collection} ele The element to calculate style for
   * @param {String} property The name of the property to get
   * @returns {(Number|String)} The flat property value in Cytoscape stylesheet format
   */
Get the computed style of an element in the Cytoscape stylesheet format
@param {Cytoscape.Collection} ele The element to calculate style for
@param {String} property The name of the property to get
@returns {(Number|String)} The flat property value in Cytoscape stylesheet format
Get the computed style of an element in the Cytoscape stylesheet format @param { Cytoscape . Collection } ele The element to calculate style for @param { String } property The name of the property to get @returns { ( Number|String ) } The flat property value in Cytoscape stylesheet format
calculate(ele, property){
    const data = this.cy.data();
    const selector = ele.isNode() ? 'node' : 'edge';
    const DEF_STYLE = ele.isNode() ? DEFAULT_NODE_STYLE : DEFAULT_EDGE_STYLE;
    const id = ele.id();
    const style = _.get(data, ['_styles', selector, property]);
    const bypass = _.get(data, ['_bypasses', id, property]);
    const def = _.get(DEF_STYLE, [property]);
    const styleStruct = bypass || style || def;
    log(`Getting style for ${ele.id()} and ${property} with struct`, styleStruct);
    let flatVal = getFlatStyleForEle(ele, styleStruct);
    if(flatVal === undefined || flatVal === null || Number.isNaN(flatVal)) {
      if(def.mapping === MAPPING.VALUE) {
        flatVal = def.stringValue;
      } else if(def.mapping === MAPPING.PASSTHROUGH && STYLE_TYPE.STRING) {
        flatVal = '';
      }
    }
    log(`Got flat value`, flatVal);
    return flatVal;
  }
calculate ( ele , property ) { const data = this . cy . data ( ) ; const selector = ele . isNode ( ) ? 'node' : 'edge' ; const DEF_STYLE = ele . isNode ( ) ? DEFAULT_NODE_STYLE : DEFAULT_EDGE_STYLE ; const id = ele . id ( ) ; const style = _ . get ( data , [ '_styles' , selector , property ] ) ; const bypass = _ . get ( data , [ '_bypasses' , id , property ] ) ; const def = _ . get ( DEF_STYLE , [ property ] ) ; const styleStruct = bypass || style || def ; log ( ` ${ ele . id ( ) } ${ property } ` , styleStruct ) ; let flatVal = getFlatStyleForEle ( ele , styleStruct ) ; if ( flatVal === undefined || flatVal === null || Number . isNaN ( flatVal ) ) { if ( def . mapping === MAPPING . VALUE ) { flatVal = def . stringValue ; } else if ( def . mapping === MAPPING . PASSTHROUGH && STYLE_TYPE . STRING ) { flatVal = '' ; } } log ( ` ` , flatVal ) ; return flatVal ; }
Get the computed style of an element in the Cytoscape stylesheet format
 @param {Cytoscape.Collection} ele The element to calculate style for
 @param {String} property The name of the property to get
 @returns {(Number|String)} The flat property value in Cytoscape stylesheet format
Get the computed style of an element in the Cytoscape stylesheet format @param { Cytoscape . Collection } ele The element to calculate style for @param { String } property The name of the property to get @returns { ( Number|String ) } The flat property value in Cytoscape stylesheet format
// TODO This is temporary, need better support for default styles  // if a data value falls outside the range of a mapping.