<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add Legend to WordCloud Visual in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2350109#M34529</link>
    <description>&lt;P&gt;Dear Mr. Sheng&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;The CloudWord Visual does not have a legend support so far.&lt;/P&gt;&lt;P&gt;I need to implement it but I found very few information how to do that.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-chart#legend-service" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-chart#legend-service&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I found the link above, maybe someone can explain me where and how to use this functions in a custom Visual.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Dominik&lt;/P&gt;</description>
    <pubDate>Mon, 21 Feb 2022 06:12:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-02-21T06:12:09Z</dc:date>
    <item>
      <title>Add Legend to WordCloud Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2347434#M34493</link>
      <description>&lt;P&gt;Dear Community&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to do the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I am a very beginner but I could already add the place for the legend in&amp;nbsp;capabilities.json but I could not find any website that shows me how to add a legend to a costum visual (That I could understand). On top of that it needs to be able to change the position like I can do in for example the Stacked bar chart.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Dominik&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 10:30:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2347434#M34493</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-18T10:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add Legend to WordCloud Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2349939#M34525</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;AFAIK, current the word cloud custom visual does not support the legends field. Perhaps you can contact to power bi custom visual team to ask them to add the legend support in this visual.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 04:11:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2349939#M34525</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-21T04:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add Legend to WordCloud Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2350109#M34529</link>
      <description>&lt;P&gt;Dear Mr. Sheng&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;The CloudWord Visual does not have a legend support so far.&lt;/P&gt;&lt;P&gt;I need to implement it but I found very few information how to do that.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-chart#legend-service" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-chart#legend-service&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I found the link above, maybe someone can explain me where and how to use this functions in a custom Visual.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Dominik&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 06:12:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2350109#M34529</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-21T06:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add Legend to WordCloud Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2360096#M34620</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I could create a legend but now&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I would like to connect my created legend with the legend field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have installed the 'powerbi-visuals-utils-chartutils'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I added the following imports:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import { legendInterfaces, legend } from 'powerbi-visuals-utils-chartutils';
import createLegend = legend.createLegend;
import ILegend = legendInterfaces.ILegend;
import LegendDataPoint = legendInterfaces.LegendDataPoint;
import LegendPosition = legendInterfaces.LegendPosition;
import MarkerShape = legendInterfaces.MarkerShape;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In my Class I added the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;private target: HTMLElement;
private set: VisualSettings;
private legend: ILegend;
private host: IVisualHost;&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the Constructor I added the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;public constructor(options: VisualConstructorOptions) {
    this.target = options.element;
    this.host = options.host;
    this.legend = createLegend(this.target, false, null, true, LegendPosition.Top);&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And finally in the update function:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;public update(visualUpdateOptions: VisualUpdateOptions): void {
    this.set = WordCloud.parseSettings(visualUpdateOptions &amp;amp;&amp;amp; visualUpdateOptions.dataViews &amp;amp;&amp;amp; 
    visualUpdateOptions.dataViews[0]);
    let categoryRole = visualUpdateOptions.dataViews[0].categorical.categories[0];
    let myLegendDataPoints: LegendDataPoint[] = categoryRole.values.map(
            (c, i) =&amp;gt; (
                {
                    label: &amp;lt;string&amp;gt;c,
                    color: this.host.colorPalette.getColor(&amp;lt;string&amp;gt;c).value,
                    identity: this.host.createSelectionIdBuilder()
                        .withCategory(categoryRole, i)
                        .createSelectionId(),
                    selected: false,
                    markerShape: MarkerShape.circle
                }
            )
        );   
        this.legend.drawLegend(
            {
                title: `Test Legend`,
                fontSize: 10,
                dataPoints: myLegendDataPoints
            },
            visualUpdateOptions.viewport
        );&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Now every time when I start my visual the legend is already visible and the values are the same as in the Category field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to connect my legend field with my current legend. I am pretty sure that I need to change my implementation from my current legend to achieve my goal.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I need to do that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope my question is understandable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 02:49:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Add-Legend-to-WordCloud-Visual/m-p/2360096#M34620</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-25T02:49:47Z</dc:date>
    </item>
  </channel>
</rss>

