Create Charts with AWS Redshift

Use Amazon AWS Redshift as a datasource

This example shows you how to create a graph based on AWS Redshift.

This could be useful if you want to avoid making graphs directly from your production database.

circle-info

This tutorial is based on this database samplearrow-up-right.

We'll create 2 charts:

  1. Number of users (single value chart)

  2. Top 5 buyers (leaderboard chart)

Connect to a Redshift Database

Install the NodeJS packagearrow-up-right for your Forest Admin project

node install node-redshift --save

Create the database client and set up the credentials variables cf. package documentation: https://www.npmjs.com/package/node-redshiftarrow-up-right.

var Redshift = require('node-redshift');

var clientCredentials = {
  host: process.env.REDSHIFT_HOST,
  port: process.env.REDSHIFT_PORT,
  database: process.env.REDSHIFT_DATABASE,
  user: process.env.REDSHIFT_DB_USER,
  password: process.env.REDSHIFT_DB_PASSWORD,
};
 
const redshiftClient = new Redshift(clientCredentials);
circle-exclamation

Create the Single Value Chart

Step 1 - Create a Single Value Smart Chart in the Forest Admin Project Dashboard.

Learn more about Smart Chartarrow-up-right

Step 2 - Create the route to handle the Smart Chart

Create the Leaderboard Chart

Step 1 - Create a Leaderboard Smart Chart in the Forest Admin Project Dashboard.

Learn more about Smart Chartarrow-up-right

Step 2 - Create the route to handle the Smart Chart

Result

Last updated