Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding a new
DuneDashboard
component to let you embed a Dune dashboard to a blog post. Well, technically any embedding. Example:The component gives you control over:
Instructions
Follow these steps to use the component in your post:
Add the following line to your blog post file after all the headers, as shown in the example above:
When viewing a dashboard you can click the "Share" button to see the option to "Embed Iframe". What we want is the
src
property from the providediframe
. Select and copy that URL to use with the component.Add a component to your blog post
Add a
DuneDashboard
component to your post using the URL you just copied as thesource
parameter:Add a label - optional
If you'd like to provide some context on what the dashboard is showing, you can add a
label
option to the component. The label can be plain text or HTML.HTML labels need to be surrounded by
{<>…</>}
The label is optional. If you omit it, the dashboard will still appear.
Customize the proportions - optional
All dashboards are the same width but you can control how tall it is using the
aspectRatio
option.By default all dashboards have a squareish 16/13 aspect ratio and you can make it taller or shorter by altering that ratio. For instance, a 16/5 aspect ratio would make for a shorter dashboard, while a 16/18 ratio would mean a taller one.
The custom aspect ratio is optional. If you omit it, the component will default to 16/13.
Note on mobile view
The embedded dashboards will adapt to narrow phone screens to some extent, but Dune's support for it isn't great. The legend might overlap with the graph, or disappear entirely if there's not enough space.
It is strongly recommended that you test how the page looks on a phone screen and tweak the aspect ratio for any given dashboard accordingly. Sometimes it helps. Sometimes it doesn't. But it's important to keep that in mind.
If all else fails, a good label will get you very far:
As a last tip, you can use your browser's Dev Tools to mess with the page's dimensions, to simulate a phone screen! In Chrome, on Mac, you can hit
⌘+⌥+i
to open Dev Tools, then⌘+⇧+m
to turn on the mobile view simulator.