<?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: What format is returned from colorPalette.getColor ()? Hex, RGB etc in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/436723#M13480</link>
    <description>&lt;P&gt;The getColor method returns an instance of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://github.com/Microsoft/PowerBI-visuals-tools/blob/d9a0d21f60b9e9831f87c37cb7a4380f4c4588da/templates/visuals/.api/v1.12.0/PowerBI-visuals.d.ts#L1253" target="_blank" rel="nofollow noopener noreferrer"&gt;IColorInfo&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To fix the issue you should return an object like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{
  value: "#ED1C24"
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ignat Vilesov,&lt;/P&gt;
&lt;P&gt;Software Engineer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="mailto:pbicvsupport@microsoft.com" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 08:07:37 GMT</pubDate>
    <dc:creator>v-viig</dc:creator>
    <dc:date>2018-06-11T08:07:37Z</dc:date>
    <item>
      <title>What format is returned from colorPalette.getColor ()? Hex, RGB etc</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/435693#M13436</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to change one line in pbiviz.json file to update the color:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Change json code from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var m = e.getColor(h.toString());&lt;/PRE&gt;&lt;P&gt;(above works and cycles through the different colours in the colour pallette)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To (does not work):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var m=\"#ED1C24\";

or

var m=\"ED1C24\";

or

var m=\"red\";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of the above works, and the visual always comes out black, irrespective of the hex code / color name used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My query is then what does e.getColor(String) return?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 15:19:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/435693#M13436</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-08T15:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: What format is returned from colorPalette.getColor ()? Hex, RGB etc</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/436723#M13480</link>
      <description>&lt;P&gt;The getColor method returns an instance of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://github.com/Microsoft/PowerBI-visuals-tools/blob/d9a0d21f60b9e9831f87c37cb7a4380f4c4588da/templates/visuals/.api/v1.12.0/PowerBI-visuals.d.ts#L1253" target="_blank" rel="nofollow noopener noreferrer"&gt;IColorInfo&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To fix the issue you should return an object like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{
  value: "#ED1C24"
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ignat Vilesov,&lt;/P&gt;
&lt;P&gt;Software Engineer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;
&lt;P&gt;&lt;A title="" href="mailto:pbicvsupport@microsoft.com" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 08:07:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/436723#M13480</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-06-11T08:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: What format is returned from colorPalette.getColor ()? Hex, RGB etc</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/437022#M13491</link>
      <description>&lt;P&gt;Great, thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More details ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getColor (string) returns IColorInfo in the format:&lt;/P&gt;&lt;P&gt;{ value: '#FFFFFF' }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See line 39 of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-visuals-core/blob/master/src/Clients/Visuals/dataColorPalette.ts" target="_blank"&gt;https://github.com/Microsoft/PowerBI-visuals-core/blob/master/src/Clients/Visuals/dataColorPalette.ts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, JSON in Power BI visual is updated from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;m = e.getColor(h.toString());&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;m={value:'#009EEC'};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to override the colour in the visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IColorPalette -&amp;gt; &lt;A href="https://github.com/maqsoftware/PowerBI-visuals/blob/master/src/CustomVisuals/Published/JSONGrid/src/colorPalette.ts" target="_blank"&gt;https://github.com/maqsoftware/PowerBI-visuals/blob/master/src/CustomVisuals/Published/JSONGrid/src/colorPalette.ts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power BI uses D3 for colour management: &lt;A href="https://github.com/d3/d3/wiki" target="_blank"&gt;https://github.com/d3/d3/wiki&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And ordinal scales in particular:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#ordinal" target="_blank"&gt;https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#ordinal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Process to edit a legacy .pbiviz file, eg the great Acquarium Visual &lt;A href="https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381112?tab=Overview" target="_self"&gt;https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381112?tab=Overview&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Download Winrar or similar zip utility&lt;/LI&gt;&lt;LI&gt;Download the visual .pbiviz file&lt;/LI&gt;&lt;LI&gt;Within Winrar, navigate to the .pbiviz file&lt;/LI&gt;&lt;LI&gt;Click on the .pbiviz file within Winrar (this is a zip file) and Winrar should open the file and show:&lt;OL&gt;&lt;LI&gt;resources (folder)&lt;/LI&gt;&lt;LI&gt;packages.json (file)&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Click on resources folder within Winrar (don't extract yet)&lt;/LI&gt;&lt;LI&gt;Copy the .pbiv.json file from within resources, eg:&amp;nbsp;Aquarium1442671919353.pbiviz.json to another windows folder&lt;/LI&gt;&lt;LI&gt;Edit&amp;nbsp;Aquarium1442671919353.pbiviz.json in a text editor as required&lt;/LI&gt;&lt;LI&gt;Do a find and replace within&amp;nbsp;Aquarium1442671919353.pbiviz.json and change '&lt;SPAN&gt;1442671919353' to another unique number, eg: '144267191935&lt;STRONG&gt;4&lt;/STRONG&gt;'&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Save as a new filename eg:&amp;nbsp;Aquarium144267191935&lt;STRONG&gt;4&lt;/STRONG&gt;.pbiviz.json which matches your 'find and replace' in step 8.&lt;/LI&gt;&lt;LI&gt;Copy&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;Aquarium144267191935&lt;/SPAN&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;SPAN&gt;.pbiviz.json back into the resources folder within Winrar (recommend that you keep Winrar window open for easy copying of files back into the .pbiviz file)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Extract packages.json and edit in a text editor.&amp;nbsp; Do a find and replace within packages.json as per step 8.&amp;nbsp; Eg Find&amp;nbsp;1442671919353 and replace with&amp;nbsp;144267191935&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Save package.json and copy back into Winrar overriding the existing packages.json&lt;/LI&gt;&lt;LI&gt;Import the custom visual into Power Bi as normal.&amp;nbsp; If Power BI gives an error, double check that all the renaming of the .pbiviz.json filename and contents within .pbiviz.json and within package.json are consistent.&amp;nbsp; Also check that the JSON edits in step 7 are correct&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my experience, the following didn't work:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract .pbiviz file to another windows folder&lt;/LI&gt;&lt;LI&gt;Make changes to files&lt;/LI&gt;&lt;LI&gt;Zip the folder again and rename extension to .pbiviz&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I had to keep the .pbiviz folder open within Winrar and copy the edited files back into the Winrar window.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:16:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/What-format-is-returned-from-colorPalette-getColor-Hex-RGB-etc/m-p/437022#M13491</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-11T13:16:59Z</dc:date>
    </item>
  </channel>
</rss>

