In the previous lesson, you added a configuration option to your visualization that allows you to choose how you want to represent your data. This was different from the previous version of your code because, while you can still choose your chart type, you can now only do it before you create an instance of your visualization. But what does it mean to create an instance of your visualization? How do you use a visualization once you've configured it?
In this lesson, you'll learn how to create an instance of your visualization and add that instance to dashboard.
If you got lost in the previous steps and would like to see what your files should look like to start this lesson, check out the course project on Github.
From the root directory of your Nerdpack, publish and subscribe to your visualization:
$nr1 nerdpack:publish$nr1 nerdpack:subscribe
To publish a Nerdpack you must be a Full user with the Nerdpacks “modify” privilege (this is granted by default).
Read our Nerdpacks privileges documentation to learn more.
Next, find your published visualization in the New Relic Apps overlay.
From the New Relic homepage, select the Apps button in the top right navigation bar:
From the Apps page, click the Custom Visualizations launcher:
In the previous lesson, you changed your visualization to use the platform configurations panel for selecting a chart type. Use this panel to configure your chart:
Click Add to dashboard. Then, select a dashboard from the list of available dashboards, or select New dashboard:
If you decide to create a new dashboard, select an account and a name:
Click Add to dashboard.
Go to your dashboard to see your custom visualization:
Note that you can create another version of the visualization with the other chart type and add it to the same dashboard. That's why we call these instances of your visualization.
Once you've added your visualization to a dashboard, you can't edit it. You can't change the underyling query, account ID, chart type, or any other previously configurable option. So, if you're not happy with your visualization, delete it from your dashboard and walk through the steps in this guide again to add a new instance.
Click the ellipses button in the right-hand corner of the visualization, and click Delete:
Confirm that you want to delete your visualization:
Now you know how to:
- Create new custom visualizations with the New Relic One SDK
- Configure your visualizations using the SDK and configuration options
- Add your visualizations to a dashboards
To learn more about custom visualizations, check out the following resources:
- New Relic Quick Tips video: Dashboards and Custom Visualizations (6 minutes)
- New Relic NerdBytes video: Configuring custom visualizations for dashboards (7 minutes)
- New Relic Changelog live stream: Custom Data Visualizations on New Relic (30 minutes)
- New Relic One SDK components: Intro to New Relic One SDK Component library
Or, to learn more about other cool things you can build with the New Relic One SDK, check out our apps course!