HTML Content - Custom Visual for Power BI
- 1.2.0 was using the latest Power BI Visuals API (3.8.0) but some versions of Power BI (e.g. Report Server) haven't caught up yet, so this has been reverted to 3.5.1.
Allow Text Select
The Content Formatting menu now includes a Allow Text Select property, which if enabled, will allow users to hightlight text using their mouse. Highlighted text can be copied to the clipboard with Ctrl + C (or system equaivalent).
Note that the visual context menu context and associated logic is specified by the main Power BI window, so it is not possible to use this to copy selected text.
Refer to the Stylesheet page for more information on how this works, and how to set up.
Show Raw HTML
If the Show Raw HTML property is enabled, HTML is now displayed in a read only
textarea element, e.g.:
This is scrollable, and it is possible to select text and copy to the clipboard with Ctrl + C (or your system's assigned shortcut).
The raw HTML will also include the
div used to encapsulate all body content, and the
div used to encapsulate individual rows from the visual dataset, which may also help with identifying how the DOM is structured, and for identifying CSS selectors for standard elements.
If a stylesheet has been assigned via a measure (as detailed above), the resolved CSS will also be included in a
"No Data" Message
Previously, the message displayed if there was no data available was hard-coded. The visual has now been modified to expose a "No Data" Message property. You can read more about how to use this feature on the "No Data" Message" page.
Default Title No Longer Used
When creating a new instance of the visual, the title will no longer be shown be default (like for the table visual). This can be enabled or modified in the usual way in the properties pane.
The visual would previously sort in the value order supplied from Power BI (typically alphabetically).
Standard sorting has been added to the visual, which is accessible from the visual header in the usual way, and will now permit you to sort by any measures or columns added to the visual's fields.
For example, if we have a visual that contains Granularity for Country, and measure that generates HTML to render the flag, total sales, and a sparkline of sales over time, there's quite a lot going on here. Power BI would sort it based on the query result, which would likely be by the Granularity field order (i.e. Canada first, USA last):
Now, we could specify that we sort by the Country in reverse order by choosing the standard sorting options in the visual header, e.g.:
But what if we want to sort by total sales?
As there is an existing row context for Country, we can add our \$ Sales measure to the Granularity field. This will resolve to the same value that's displayed in our HTML measure, and because it's in the visual's data we can sort by it, e.g.:
Because values in the Granularity field are used to generate row context for the visual and do not get rendered, you may need to consider what happens to your HTML by adding columns or measures to this field, but this should provide a pretty decent level of flexibility here.
The visual would not render ordered (
<ol/>) or unordered (
<ul/>) line item (
<li/>) elements due to styling applied higher up in the custom visual host container. This has been resolved to work as expected, e.g.:
Initial version released to the Power BI Marketplace.