Dashboards & Visualizations

Display barchart of a dashboard with each bar in a different color based on the value

saichandjawari
Explorer

I have a dashboard panel with a simple query, which gives top 20 values of the event. For example, I am searching for number of customers of top 20 countries of my product. As expected each country comes up with a unique value. Hence I need each cauntry should be given a unique color in the bar chart of a dashboard while each bar represents a unique country. Please suggest. Thanks!

Tags (1)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Check this

<dashboard>
  <label>chart color</label>
  <row>
    <panel>
      <chart>
        <search>
          <query>index=_internal |top limit=5 sourcetype
          | transpose 0 header_field=sourcetype|search column=count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">bar</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.seriesColors">[0x1e93c6, 0xf2b827, 0xd6563c, 0x6a5c9e, 0x31a35f, 0xed8440]</option>
        <option name="refresh.display">progressbar</option>
      </chart>
    </panel>
  </row>
</dashboard>

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Check this

<dashboard>
  <label>chart color</label>
  <row>
    <panel>
      <chart>
        <search>
          <query>index=_internal |top limit=5 sourcetype
          | transpose 0 header_field=sourcetype|search column=count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">bar</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.seriesColors">[0x1e93c6, 0xf2b827, 0xd6563c, 0x6a5c9e, 0x31a35f, 0xed8440]</option>
        <option name="refresh.display">progressbar</option>
      </chart>
    </panel>
  </row>
</dashboard>
0 Karma

saichandjawari
Explorer

vnravikumar, thanks! That worked for me. Can you please let me know the logic behind naming convention of colors?

0 Karma

woodcock
Esteemed Legend

This answer allows you to pick the color pallet but Splunk assigns the colors as it chooses. If you need to map certain colors to certain values, then this is not the right way to do it; see my answer for the correct method.

0 Karma

woodcock
Esteemed Legend
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...