alteryx / Optimization

Alteryx Optimization Tool
GNU General Public License v3.0
0 stars 1 forks source link

Show "sensitivity report" on UI only for LP problems #13

Closed kuol closed 8 years ago

kuol commented 8 years ago

I don't have back end code to support sensitivity analysis to quadratic programming at the moment.

ramnathv commented 8 years ago

Update Gui/layout.html

Add the following snippet to each of the three modes. This will display the toggle in all three views.

<div id='sensitivity-checkbox'>
  {{ showSensitivity }}
</div>

Update index.js

Add the function displayTarget to index.js or src\utils.jsx and then call it inside Alteryx.Gui.AfterLoad as shown below. This step will require building app.min.js using the build tools.

function displayTarget(targetId, di, condition){
  if (typeof condition == "undefined"){
    var condition = function(v){return v}
  };
  var dataItem = Alteryx.Gui.manager.GetDataItem(di)
  var targetDiv = document.getElementById(targetId)
  console.log(targetDiv)
  function display(v){
    targetDiv.style.display = condition(v) ? 'none' : 'block'
  }
  dataItem.BindUserDataChanged(display)
  display(dataItem.value)
}

Alteryx.Gui.AfterLoad = function(manager){
  ...
  displayTarget("sensitivity-checkbox", "showSensitivity", function(d){return d === "LP"})

}
ramnathv commented 8 years ago

Done.