Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Plotly.js heatmap DATA.ZMAX CHANGE?

I have an input field that shows max Z value of the heatmap. On change of this value i call the following function:
function adaptScale () {
$scope.data.zmax = $scope.maxZvalue;
Plotly.newPlot($element[0].children[0], $scope.data);
}

I get the following error:

Solution:

function adaptScale () {
  if($scope.maxZvalue && $scope.maxZvalue != 0){
    var layout = $element[0].children[0].layout;
    $scope.data.zmax = $scope.maxZvalue;
    $scope.data.zmin = -Math.abs($scope.maxZvalue);
    Plotly.newPlot($element[0].children[0], [$scope.data], layout);
  }
}

Correct. The second argument (data) to Plotly.newPlot must be an array.

1 Like