4 Replies Latest reply on Aug 24, 2012 2:03 PM by 930525

    Studio Chart Color


      I was wondering if we can change the color of charts.
      I understand that we can change the complete theme but I just want to use color coding for individual charts, is there any way.

      Thanks in advance!
        • 1. Re: Studio Chart Color
          Assuming you mean the colours for the actual graph bars (pies, lines, etc), then if you're working with Latitude 2.2(.2) or earlier though, you have a customization option.

          You can use the existing endeca-corda-chart-portlet as source for a new custom portlet.

          1. Go into endeca-corda-chart-portlet-<version>.war, under \WEB-INF\src
          2. Look at the \com\endeca\portlet\corda\CordaStandardCrossTabVisualizationFormatter.java class
          3. The class has a private constant defined towards the top called DEFAULT_COLOR_RAMP. This contains 30 colour codes which the chart instances use in sequence.

          A fairly simple customization would then be to manually change that set of colours to be whatever you want. This would be a static change applied to all charts.

          If you want the colours to be specific to your chart instances (e.g. one chart with only blue bars, another chart with only red bars), then you'd be looking at a more serious customization using the portlet. This class should still be a good starting point for that kind of effort though.

          Good luck,


          Edited by: Jerome CB on Aug 21, 2012 6:25 AM

          [Removed references to Latitude 2.3 following Sasha's post below]
          • 2. Re: Studio Chart Color
            No need to customized to change the color palette in 2.3. Go to the Framework Settings control panel and update the value of the df.defaultChartColorPalette setting with, as noted in the setting description, 16-30 color hex codes. This will impact all charts on all pages. We have not, as yet, provided any capability to customize the colors on a chart-by-chart basis. We've discussed features in this area for future releases, and I'd be interested to hear the use case you're trying to fulfill.
            • 3. Re: Studio Chart Color
              Thanks for the response Jerome and Sasha. I am using 2.3 version.

              I have a page name count, which has 3 graphs: approved count per year, reported count per year and submitted count per year.

              Currently, all 3 graph bar chart are using cyan color. And the requirement is to show approved in green, reported in blue and submitted in red.

              please let me know if I can choose the color for each chart or if I can choose it per page.

              Thanks a lot!
              • 4. Re: Studio Chart Color
                The Framework Settings change that Sasha is talking about will apply to your Latitude instance. Meaning that all chart instances in your application will use the same set of colours (and will always apply them in the same order).

                So, no, it looks like you cannot choose a colour for each chart, or even per page.

                Your scenario is a little unclear to me though.

                1. Why not have the 3 charts merged into 1? You could then set the Framework Settings for the first three colours to be the green, blue and red in your requirements (noting that this will apply to all charts in your application).

                2. If you want to have a single value per chart (which is what it sounds like), then the metrics bar portlet might be a better fit. It will also allow you a very basic control of colouring as well (only options are green, yellow and red, so not quite the combination your requirements are looking for). Going down this path you could potentially do a hacky customization since the metrics bar portlet uses images (via CSS) for the bar colours...

                .titleBg-yellow {

                ... where you override an existing colour in the WAR file. Your "yellow_box.png" could, for example, actually be blue instead of yellow. You can see how this is hacky.

                3. Your last option, of course, is to submit a feature request. From what Sasha wrote, it sounds like chart instance-level colouring is something that engineering is looking at anyway, but unless they provide an ETA it may not be of help for your project.