Change Pie Chart Color in Dashboard

Belmont
edited February 11, 2022 in Analytics #1
<p>I'd like to know if it's possible to change the pie chart category colors in the dashboard editor in iHub 3.1.1</p>
<p> </p>
<p>At the moment, I have two categories. The 'Yes' category is orange, and the 'No' category is green, which is the exact opposite of what I want. Any tips on a fix?</p>

Comments

  • <p>Hi,</p>
    <p> </p>
    <p>In Dashboards, the chart category colors can only be controlled by choosing a theme. The default themes (Modern, Clean Blue, Warm Red and Grayscale) are defined in Resources/ThemesReportItems3.rptlibrary. To modify the themes, you will need to import the rptlibrary file in BIRT Designer, make your changes, and re-publish it to iHub. You can either modify an existing theme or clone an existing theme before making your modifications. In your case, you need to modify the Series Pallette.</p>
    <p> </p>
    <p>Hope this helps,</p>
    <p> </p>
    <p>P.</p>
    Warning No formatter is installed for the format ipb
  • Belmont
    edited March 28, 2017 #3
    <p>Thank you, Pierre. I took a look in the /Resources folder and I don't see that ThemesReportItems3.rptlibrary exists. I did publish some files out to the Resources folder while I was developing earlier, but I don't think those would've overwritten it, since they were just report designs and data objects in directories with different names. I also took a look in the rest of the directories I have just to verify that it doesn't exist on my volume, and from what I can tell, I don't see it anywhere else either.</p>
    <p> </p>
    <p>Any ideas how I should pursue this?</p>
    <p> </p>
    <p>Edit: I managed to find some ThemesReportItems3.rptlibrary files on the server, but I don't know which one to import and modify.</p>
    <p> </p>
    <p>Do I modify the one located in</p>
    <p> </p>
    <p>BIRTiHub/iHub/resources/ThemesReportItems3.rptlibrary</p>
    <p> </p>
    <p>or</p>
    <p> </p>
    <p>BIRTiHub/iHub/web/iportal/resources/ThemesReportItems3.rptlibrary ? </p>
  • <p>If ThemesReportItems3.rptlibrary is not found in the volume Resources folder (like in your case), iHub will revert to the BIRTiHub/iHub/resources folder. (The reason there is a rptlibrary file at the file system level is to support scenarios where multiple iHub volumes share the same rptlibrary file) So, you can modify ThemesReportItem3.rptlibrary found in BIRTiHub/iHub/resources to see the changes in Dashboards.</p>
    <p> </p>
    <p>Hope this helps,</p>
    <p> </p>
    <p>P.</p>
    Warning No formatter is installed for the format ipb
  • Belmont
    edited March 29, 2017 #5
    <p>That helped. I copied over the file and made a clone of the Modern theme to make my own modifications to. From what I suspect, the colors for the results seem to be selected based on what result comes up first. I decided the route I needed to take was adding a little bit of my own scripting to select a color based on the name of a category from a pie chart. I dug through the forums a little to determine if someone had a similar issue, and I came across this topic: <a data-ipb='nomediaparse' href='http://developer.actuate.com/community/forum/index.php?/topic/30000-chart-scripting-pie-chart-series-color/'>http://developer.actuate.com/community/forum/index.php?/topic/30000-chart-scripting-pie-chart-series-color/</a></p&gt;
    <p> </p>
    <p>They came up with a similar result that I came up with. I wanted to modify the color for the categories of the pie chart so they specifically have a red or green color based on the category name. However, when I put this slight tweak into the beforeDrawDataPoint method and deploy this library out to iHub, I noticed that the pie chart doesn't render at all upon selecting my theme. Is there additional code I need to get it working? I'm not sure what I could be missing.</p>
    <p> </p>
    <p>Specifically, I added this to beforeDrawDataPoint:</p>
    <p> </p>
    <div>if(point.name == 'Y')</div>
    <div>pointOptions.color = "rgb(25,157,25)";</div>
    <div> </div>
    <div>if(point.name == 'N')</div>
    <div>pointOptions.color = "rgb(239,4,4)";</div>
    <div> </div>
    <div>I didn't add anything else to any other method. </div>
  • <p>Nevermind, I fixed it. It turns out it was a syntax issue on my part. I needed to put a comma after the final end bracket from beforeGeneration. Thanks again, Pierre! I have it working exactly as I wanted.</p>