Dashboards & Visualizations

charting.fieldColor is not applying the colors defined in token

valadasr
Explorer

Splunk Enterprise
Splunk Version: 7.2.7
Build: f817a93effc2

Hello everyone,

I've got a dashboard in which i've got colors defined as tokens and this solution has always worked up until now. The panel just refused the fieldColors definition of the chart panel.

<init>
<set token="Prio1Color">0xff0000</set>
    <set token="Prio2Color">0xffc000</set>
    <set token="Prio3Color">0x00b050</set>
    <set token="Prio4Color">0x2e75b6</set>
    <set token="Prio5Color">0x548235</set>
</init>

(...)

    <panel>
      <chart>
        <title>Resolved in $Report_Type$</title>
        <search base="BaseSearch">
          <query>| search CreationDate = "*" 
| search Priority IN($prio$)
| where Month&gt;=strftime(relative_time(strptime("$startTime$","%Y-%m-%d %H:%M:%S" ),"-1mon"),"%Y-%m") AND Month&lt;="$endTime$" 
| append 
    [| gentimes $gentime$ 
    | eval _time=strptime(strftime(endtime, "%Y-%m-%d %H").":00:00", "%Y-%m-%d %H:%M:%S") 
    | fields _time 
    | dedup _time] 
| fillnull value=0 $Report_Type$ 
| timechart span=1month sum($Report_Type$) as "Resolved in Team" by Priority
| fields - NULL 
| addtotals</query>
        </search>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
        <option name="charting.axisLabelsY.majorLabelVisibility">hide</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisY2.abbreviation">none</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart">column</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.overlayFields">Total</option>
        <option name="charting.chart.showDataLabels">all</option>
        <option name="charting.chart.stackMode">stacked</option>
        <option name="charting.fieldColors">{"Planned": $PlannedColor$,"Prio1":$Prio1Color$, "Prio2": $Prio2Color$,"Prio3":$Prio3Color$, "Prio4": $Prio4Color$,"Prio5":$Prio5Color$</option>
        <option name="charting.legend.placement">bottom</option>
      </chart>
    </panel>

This just doesn't work at all... I've checked and re-checked and this doesn't seem to add up..

alt text

Can you help me out with this issue?

Best Regards,
Rui

0 Karma
1 Solution

vnravikumar
Champion

Hi

Check with having "}"

   <option name="charting.fieldColors">{"Planned": $PlannedColor$,"Prio1":$Prio1Color$, "Prio2": $Prio2Color$,"Prio3":$Prio3Color$, "Prio4": $Prio4Color$,"Prio5":$Prio5Color$}</option>

View solution in original post

vnravikumar
Champion

Hi

Check with having "}"

   <option name="charting.fieldColors">{"Planned": $PlannedColor$,"Prio1":$Prio1Color$, "Prio2": $Prio2Color$,"Prio3":$Prio3Color$, "Prio4": $Prio4Color$,"Prio5":$Prio5Color$}</option>

valadasr
Explorer

Yeah, that's the problem, what a dunce didn't even notice this!
Thanks a lot!

0 Karma

vnravikumar
Champion

welcome!!!

0 Karma

dindu
Contributor

Hi,

Could you please try after modifying the init as below. Defining plannedColor in init as well.
Please try and let us know.

  <init>
     <set token="PlannedColor">0x5eb246</set>
       <set token="Prio1Color">0xff0000</set>
       <set token="Prio2Color">0xffc000</set>
       <set token="Prio3Color">0x00b050</set>
       <set token="Prio4Color">0x2e75b6</set>
       <set token="Prio5Color">0x548235</set>
   </init>
0 Karma

valadasr
Explorer

I've put it there, but still didn't solve the issue. It was just a lack of } in the option element.
Thanks anyway for your suggestion!

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...