Dashboards & Visualizations

Change the bar chart color based on states

psriyanka
Explorer

Hi All,
Can someone help me in changing the color based on the state

I tried charting.fieldColors in option field, but its not working

CHART is giving only one color,its not changing based on the condition

alt text

Labels (2)
Tags (1)
0 Karma
1 Solution

psriyanka
Explorer

Thank you for replying vnravikumar

But after trying your code, I cannot see any change in the color for those different states, all the state showing the same color, that is the issue, I want different color for each state.

View solution in original post

0 Karma

psriyanka
Explorer

Thank you for replying vnravikumar

But after trying your code, I cannot see any change in the color for those different states, all the state showing the same color, that is the issue, I want different color for each state.

0 Karma

vnravikumar
Champion

have you used transpose command?

0 Karma

psriyanka
Explorer

Thank you vnravikumar!!!

transpose command worked.

0 Karma

vnravikumar
Champion

Can you please accept my answer?

psriyanka
Explorer

accepted ...

0 Karma

vnravikumar
Champion

Hi

Check this sample

<dashboard>
  <label>chart</label>
  <row>
    <panel>
      <chart>
        <search>
          <query>index=_internal 
| stats count by sourcetype 
| transpose 0 header_field=sourcetype |fields - column</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.drilldown">none</option>
           <option name="charting.seriesColors">[0x1e93c6, 0xf2b827, 0xd6563c, 0x6a5c9e, 0x31a35f, 0xed8440, 0x3863a0, 0xa2cc3e, 0xcc5068, 0x73427f, 0x11a88b]</option>
      </chart>
    </panel>
  </row>
</dashboard>
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...