Dashboards & Visualizations

Can't get chart colors to work right.

the_wolverine
Champion

alt text


Version 4.3.4

The chart colors appear just fine in the legend, but not within the chart.

Also, notice that "count" field appears as an item in the legend -- why is the chart doing that? I've broken the counts up into ranges using rangemap so I expect that the count should be replaced by range. It looks like the color is being assigned due to the value of "count" be assigned GREEN. Here's the general syntax of my query:

"my events" | stats min(_time) as start by thing1 | eval duration=now()-start | rangemap field=duration "0m-20m"=1-1199 "20m-40m"=1200-2399 "40m-60m"=2400-3599 "60m+"=3600-15000 | stats count by range

  <row>
    <chart>
      <searchName>My Saved Search</searchName>
      <title>Count of events in My Saved Search</title>
      <option name="charting.chart">column</option>
      <option name="charting.chart.nullValueMode">gaps</option>
      <option name="charting.chart.stackMode">default</option>
      <option name="charting.layout.splitSeries">false</option>
      <option name="charting.legend.placement">bottom</option> 


      <option name="charting.fieldColors">{"0m-20m":0x00FF00,"20m-40m":0x3399CC,"40m-60m":0xFFFF00,"60m+":0xFF0000}</option>


      <option name="charting.legend.labels">["0m-20m","20m-40m","40m-60m","60m+"]</option>


      <option name="charting.seriesColors">[0x00FF00,0x3399CC,0xFFFF00,0xFF0000]</option>


      <option name="charting.fieldColors">{0m-20m:0x00FF00,20m-40m:0x3399CC,40m-60m:0xFFFF00,60m+:0xFF0000}</option>

      <option name="charting.legend.masterLegend"></option>

      <option name="charting.secondaryAxis.maximumNumber">""</option>
      <option name="charting.secondaryAxis.minimumNumber">""</option>
      <option name="charting.secondaryAxis.scale">""</option>
    </chart>
  </row>
0 Karma

lguinn2
Legend

Here's the deal: your search returns two fields: count and range. Splunk charts the count field, using the first color in the color series (green) for all values of count. You provided a legend, so it will always appear. However, count wasn't in the legend, so Splunk added it.

So that's why you got the result that you did.

If you want to color each bar separately, you will have to play some tricks. Take a look at this answer Change chart bar color based on data value for one way to approach it,

0 Karma

the_wolverine
Champion

I added count to the XML to try to workaround this issue. Why is Splunk adding "count" in addition to my specified series? I've updated my question to show that count is removed but regardless, "count" appears in the legend. Could this be a bug?

0 Karma
Get Updates on the Splunk Community!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...