Update

Updating a Dashboard

Initialization

To update an existing dashboard, you must first initiate the Vizzly SDK.

Initializing the Vizzly SDK

Ensure you have loaded the Vizzly package by following the prerequisite steps in our initializing guide.

If needed, you will also then be able to fetch the Vizzly instance using the following code.

const vizzly = Vizzly.use();

Usage

Once the SDK has been initiated, you can make updates to any of the user's dashboard for which they have read_write permission for.

const doUpdateDashboard = async (dashboardIdToUpdate: string) => {
  const vizzly = Vizzly.use();
 
  // Build out an changes to the dashboard you wish to make.
  // In this example, we'll build an empty dashboard, but you 
  // can any charts tables or maps to your dashboard before updating it
  // and persisting the changes.
  // For examples on fleshing out your dashboard, see
  // https://docs.vizzly.co/services/programmatic-dashboard-examples
  const myDashboard = new Vizzly.Dashboard();
 
  await vizzly.updateDashboard({
    // Provide the ID of the dashboard to update.
    dashboardId: dashboardIdToUpdate,
 
    // Optionally provide a new definition
    definition: myDashboard.build(),
 
    // Optionally provide a deleted boolean value
    // to remove the user's dashboard
    deleted: false,
 
    // Optionally provide an updated metadata value.
    metadata: {}
  });
};