Error when providing AppState to an embeded visualization

Hi,

I am trying to provide an AppState to an embedded visualization:

visualizeLoader.embedVisualizationWithId(visContainer, $scope.selectedVisualization, {
      timeRange: timeRange, appState: AppState
    }).then(handler => {
      console.log('render complete');
    });

Being AppState included as a dependency in the controller:

> app.controller('WebinarDemo', function ($scope, Private, savedVisualizations, AppState) {

When I try to load it:

image

Am I doing something wrong? how do I go about this?

Regards.

I changed the AppState initialization like this (adding the getAppState service in my controller):

let currentAppState = getAppState();
  if (!currentAppState) {
      $scope.state = new AppState(getStateDefaults());
}


  function getStateDefaults() {
      return {
          query: '',
          index: 'c78aa9f0-bfec-11e7-bd67-eb6db07d9b4b',
          interval: 'auto',
          filters: {}
      };
  }

I'm using some hardcoded defaults for the appState initialization.

Then I use it as param in my embed visualization:

  $scope.$watch('selectedVisualization', () => {
    if (!$scope.selectedVisualization) return;
    visualizeLoader.embedVisualizationWithId(visContainer, $scope.selectedVisualization, {
      timeRange: timeRange, appState: $scope.state
    }).then(handler => {
      console.log('render complete');
    });
  });

But it's not affecting at all the visualization.

Regards.

It's nice to see that you are trying to build on the examples of one of the webinars. I will try to get the visualization team in here, because they can probably help you much more competently.

@weltenwort thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.