Defining dashboard layouts

The foundation of every dashboard is its layout. These can range from simple layouts with a single chart to much more complex layouts with many nested rows and columns and many different-sized charts, or even other components such as filters. When we create a dashboard, we usually define the layout before we define data sources or chart components. Without a layout, where would we place our charts? This recipe teaches you to create a simple layout using a responsive web framework called bootstrap.

Getting ready

To get ready for this recipe, you first need to start the MongoDB server with the same database as that of the last chapter. You will also have to start the Pentaho BA Server using the server control scripts. Once it is started, you can log in to the BI Server.

How to do it…

In this recipe, we are going to create a new dashboard and design a simple 2x2 layout. This layout will allow us to add a total of four components to the dashboard, be it charts, filters, or whatever:

  1. In the PUC, go to File | New | CDE Dashboard.
  2. Save your dashboard in Public | Pentaho MongoDB Cookbook | Dashboards with the name 2x2 Layout, like this:
    How to do it…
  3. Click on Settings on the CDE Main Menu.
  4. Set Dashboard Type to bootstrap, as shown here:
    How to do it…
  5. Click on the Layout tab.
  6. Then click on the Add Row button.
  7. Select the row.
  8. Click on the Add Column button.
  9. Make sure that the row is still selected.
  10. Click on the Add Column button again.
  11. Select the first nested column.
  12. Set the Medium Devices property to 6.
  13. Then set the Height property to 300.
  14. Next, set the Background Color property to #CCCCCC.
    How to do it…
  15. Select the second column.
  16. Set the Medium Devices property to 6.
  17. Then set the Height property to 300.
  18. Set the Background Color property to #BBBBBB.
  19. Click on Save.

Now that we have saved our dashboard, we are going to open it in render mode to see what it looks like:

  1. Click on the Opened menu on the Pentaho User Console and select Browse Files.
  2. Navigate to Public | Pentaho MongoDB Cookbook | Dashboards.
  3. Select the 2x2 Layout dashboard file, as shown in the next screenshot.
  4. Click on Open on the right-hand side menu.
    How to do it…

    You can see that we have created a simple two-column layout. We could technically start adding dashboard components such as charts and filters to these two areas. But, let's go back to the original dashboard we were editing and add some more layout.

    How to do it…
  5. Select the original row with the two nested columns.
  6. Click on the Add Row button to add a new row to the layout. This new row will appear below the original row in the root of the dashboard structure.
  7. Select the new row.
  8. Click on the Add Column button.
  9. Make sure that the row is still selected.
  10. Click on the Add Column button again.
  11. Select the first nested column.
  12. Set the Medium Devices property to 6.
  13. Then set the Height property to 300.
  14. Set the Background Color property to #CCCCCC.
  15. Select the second column.
  16. Set the Medium Devices property to 6.
  17. Next, set the Height property to 300.
  18. Set the Background Color property to #BBBBBB.
  19. Select the first row.
  20. Click on the Add Spacer button. This will add a small space between the two rows.
  21. Set the Height property of the spacer to 10.
    How to do it…
  22. Click on Save.

Now it's time to refresh the dashboard in render mode to see our latest changes.

  1. Select the 2x2 Layout tab in the Pentaho User Console.
  2. Right-click on the tab and select Reload Tab, as follows:
    How to do it…

    You will now see a simple 2x2 layout with four main panels, like this:

    How to do it…

    To finish off, we will add a simple HTML component to the top-left layout column.

  3. Select the first column in the first row of the dashboard is layout structure.
  4. Click on the Add HTML button.
  5. Open the HTML Editor property.
  6. Copy and paste the following HTML:
    <h2 style="margin-top:0px">My Dashboard</h2>
  7. Click on OK. The following screenshot shows the Layout Structure window:
    How to do it…
  8. Then click on Save.

Let's refresh our latest changes on the dashboard:

  1. Select the 2x2 Layout tab in the Pentaho User Console.
  2. Right-click on the tab and select Reload Tab.

    You can see that we have added some basic HTML to our dashboard, as follows:

    How to do it…

How it works…

In this recipe, we showed you how to create a new dashboard and define a layout of rows and nested columns. It's possible to nest further rows into columns and more columns into those rows. It is even possible to set the size of columns that add up to a total value of 12 based on the bootstrap framework. To create a 50 on 50 layout, we set each column to a width of 6. We could have also created a layout with four columns, each having a width of 3.

Plus, we were able to add some basic HTML to our layout. The ability to add HTML to our layout opens the door to all sorts of possibilities in dashboard layout design.

Basically, by using the bootstrap framework, CDE, and some imagination, it is possible create bespoke responsive dashboards that will fit in different screens types, such as desktops, tablets, or mobile phones.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset