<?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: Synchronize color palette between Custom &amp;amp; Native visuals in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/4108035#M10353</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Have you been able to solve the issue.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have also gone through the same issue. When I click on any bar of the Barchart, initial color is populated on the custom visual.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank You!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2024 02:42:20 GMT</pubDate>
    <dc:creator>SKYViz</dc:creator>
    <dc:date>2024-08-20T02:42:20Z</dc:date>
    <item>
      <title>Synchronize color palette between Custom &amp; Native visuals</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3646210#M8769</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm requesting your help. I'm currently developping a custom visual using Plotly.JS library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, it's a line chart but with a few more customized features.&lt;/P&gt;&lt;P&gt;My aim is to fit the color between my custom visual and the native line chart visuel integrated into PowerBI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that, I use the color palette as described in the official documentation:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/add-colors-power-bi-visual" target="_blank"&gt;Add colors to your Power BI custom visuals - Power BI | Microsoft Learn&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results are good: in the custom visual, colors for each catory are assigned in the order of the colors in the palette.&lt;/P&gt;&lt;P&gt;I'm using this code to assign a color to a category:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var category_color = this.host.colorPalette.getColor(category)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BUT,&amp;nbsp;&lt;/STRONG&gt;you're guessing that if I'm writing this message right now it's because I have a problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When filtering with slicers, categories are not associated/mapped with a color in the same way between a default visual and a custom visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of my resultats:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I understand I that:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In native/default visual:&amp;nbsp;&lt;/STRONG&gt;all categories are mapped to a color, and the color's mapping remains fixed even if the page filters change&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In my custom visual:&lt;/STRONG&gt;I associate each category I come across with a color, regardless of its appearance order, in order of the palette colors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Result&lt;/STRONG&gt;: I get different colors when the filters change&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone explain the color assignment phenomenon for categories used in PowerBI captions? Also, is there any way I can get this color assignment to match the colors of my objects/legends in my custom visuals?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, if what I've written today is too incomprehensible, please let me know and I'll add more graphic examples to explain this color problem in my captions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for taking the time to reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:08:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3646210#M8769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-18T15:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Synchronize color palette between Custom &amp; Native visuals</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3658691#M8822</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;you can try the following steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;IVisualHost&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;interface to get the color palette for the native line chart visual.&lt;/LI&gt;&lt;LI&gt;Use the same color palette in your custom visual by setting the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;colorPalette&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;property of the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;IVisualHost&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;interface to the color palette obtained in step 1.&lt;/LI&gt;&lt;LI&gt;Use the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;getColor&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;method of the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;colorPalette&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;service to get the color for each category in your custom visual.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This should ensure that the colors are consistent between the native line chart visual and your custom visual, even when filtering with slicers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;Let me know if this works for you.&amp;nbsp;@ me in replies, or I'll lose your thread!!!&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;BR /&gt;&lt;U&gt;Note:&lt;/U&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If this post is helpful, please mark it as the&amp;nbsp;&lt;STRONG&gt;solution&lt;/STRONG&gt;&amp;nbsp;to help others find it easily. Also, if my answers contribute to a solution, show your appreciation by giving it a&amp;nbsp;&lt;STRONG&gt;thumbs up&lt;/STRONG&gt;!&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 25 Jan 2024 05:09:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3658691#M8822</guid>
      <dc:creator>DallasBaba</dc:creator>
      <dc:date>2024-01-25T05:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Synchronize color palette between Custom &amp; Native visuals</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3695876#M8921</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="446607" data-lia-user-login="DallasBaba" class="lia-mention lia-mention-user"&gt;DallasBaba&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;That is precisely what I do under my code, using the getColor() method from the colorPalette of the IVisualHost interface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;I created a simple dataset: 4 different legends &amp;amp; 4 values.&lt;/P&gt;&lt;P&gt;On the left the native PBI bar chart and on the right a custom one (from the AppSource, I get the same behave when I develop my own)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The color assigned for the different categories are not the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthemore, if I select a legend on the left chart, the filtering on the other chart clearly show that the color attribution is not synchronized:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My opinion is that the customs are using the colorPalette and the getColor() method but that the native are using an other method to assign the color to the categories.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I'm wrong, but I see this behavior between every native/custom that I'm using...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 09:58:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/3695876#M8921</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-14T09:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Synchronize color palette between Custom &amp; Native visuals</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/4108035#M10353</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Have you been able to solve the issue.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have also gone through the same issue. When I click on any bar of the Barchart, initial color is populated on the custom visual.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank You!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 02:42:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/4108035#M10353</guid>
      <dc:creator>SKYViz</dc:creator>
      <dc:date>2024-08-20T02:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Synchronize color palette between Custom &amp; Native visuals</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/4108575#M10357</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778722" data-lia-user-login="SKYViz" class="lia-mention lia-mention-user"&gt;SKYViz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatly, even though I manage to have selectors, even though I use the &lt;A href="https://learn.microsoft.com/en-my/power-bi/developer/visuals/add-colors-power-bi-visual" target="_self"&gt;colorPalette&lt;/A&gt; and even though I use the&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-my/power-bi/developer/visuals/utils-color" target="_self"&gt;colorHelper&lt;/A&gt; I still have the problem of "color synchronization"&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 07:21:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Synchronize-color-palette-between-Custom-amp-Native-visuals/m-p/4108575#M10357</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-20T07:21:55Z</dc:date>
    </item>
  </channel>
</rss>

