<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Drilldown for Donut Custom Visualisation? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469961#M57772</link>
    <description>&lt;P&gt;Hi @niketnilay &lt;BR /&gt;
Thanks for your inputs.&lt;/P&gt;

&lt;P&gt;But how drilldown is working in this?&lt;BR /&gt;
how my next panel is visible on click ?&lt;/P&gt;

&lt;P&gt;As, all&lt;BR /&gt;
drilldown --&amp;gt; all&lt;BR /&gt;
drilldownRedirect --&amp;gt; true&lt;/P&gt;

&lt;P&gt;nothing seems to be working on this visualization.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2020 04:33:03 GMT</pubDate>
    <dc:creator>sarvesh_11</dc:creator>
    <dc:date>2020-04-09T04:33:03Z</dc:date>
    <item>
      <title>Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469959#M57770</link>
      <description>&lt;P&gt;Hey Splunkers,&lt;/P&gt;

&lt;P&gt;There is no drilldown functionality in :&lt;BR /&gt;
&lt;A href="https://splunkbase.splunk.com/app/3238/"&gt;https://splunkbase.splunk.com/app/3238/&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;To get that, i have tried with css, and also got the reference to write js for click events, for drill down.&lt;BR /&gt;
But how can i integrate that js with css. Below is my code:&lt;/P&gt;

&lt;P&gt;Donut Chart with CSS&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;panel&amp;gt;
   &amp;lt;html depends="$alwaysHideCSSStyle$"&amp;gt;
     &amp;lt;style&amp;gt;
       g.c3-shapes.c3-shapes-WARN path.c3-shape.c3-arc-WARNING{
           fill:amber !important;
       }
       g.c3-shapes.c3-shapes-ERROR path.c3-shape.c3-arc-CRITICAL{
           fill:red !important;
       }
       g.c3-shapes.c3-shapes-ERROR path.c3-shape.c3-arc-NORMAL{
           fill:green !important;
       }
       div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--WARNING td.name span{
           background-color:amber !important;
       }
       div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--CRITICAL td.name span{
           background-color:red !important;
       }
       div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--NORMAL td.name span{
           background-color:green !important;
       }
       g.c3-legend-item-WARN line.c3-legend-item-tile{
           stroke:amber !important;
       }
       g.c3-legend-item-ERROR line.c3-legend-item-tile{
           stroke:red !important;
       }
       g.c3-legend-item-NORMAL line.c3-legend-item-tile{
           stroke:green !important;
       }
     &amp;lt;/style&amp;gt;
   &amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 07:37:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469959#M57770</guid>
      <dc:creator>sarvesh_11</dc:creator>
      <dc:date>2020-04-08T07:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469960#M57771</link>
      <description>&lt;P&gt;@sarvesh_11 ideal place would be to fix in &lt;CODE&gt;visualization.js&lt;/CODE&gt; file which already handles hover and click events. But prints in console log instead of setting tokens to be used in Simple XML. Refer to Custom Visualization API for details.&lt;/P&gt;

&lt;P&gt;Following is quick and dirty workaround I was referring to where you can use Simple XML JS extension to handle the click event through jQuery and set the token through Splunk JS token model.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8650i67B26A96A28FF963/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Following is the Simple XML code for run anywhere example as per your question (PS: I have added &lt;CODE&gt;id="my_donut"&lt;/CODE&gt; to the donut viz for applying specific CSS and jQuery selector rather than generic):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="donut_click_handler.js"&amp;gt;
  &amp;lt;label&amp;gt;Donut with drilldown&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #my_donut g.c3-chart-arc.c3-target-NORMAL text{
            fill:black !important;
          }
          #my_donut g.c3-shapes.c3-shapes-WARN path.c3-shape.c3-arc-WARN{
              fill:orange !important;
          }
          #my_donut g.c3-shapes.c3-shapes-CRITICAL path.c3-shape.c3-arc-CRITICAL{
              fill:red !important;
          }
          #my_donut g.c3-shapes.c3-shapes-NORMAL path.c3-shape.c3-arc-NORMAL{
              fill:green !important;
          }
          #my_donut div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--WARN td.name span{
              background-color:orange !important;
          }
          #my_donut div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--CRITICAL td.name span{
              background-color:red !important;
          }
          #my_donut div.c3-tooltip-container table.c3-tooltip tr.c3-tooltip-name--NORMAL td.name span{
              background-color:green !important;
          }
          #my_donut g.c3-legend-item-WARN line.c3-legend-item-tile{
              stroke:orange !important;
          }
          #my_donut g.c3-legend-item-CRITICAL line.c3-legend-item-tile{
              stroke:red !important;
          }
          #my_donut g.c3-legend-item-NORMAL line.c3-legend-item-tile{
              stroke:green !important;
          }
        &amp;lt;/style&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;div&amp;gt;&amp;lt;b&amp;gt;Clicked Slice Label and Value&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div&amp;gt;tokLabel: $tokLabel$&amp;lt;/div&amp;gt;
          &amp;lt;div&amp;gt;tokValue: $tokValue$&amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;viz id="my_donut" type="viz_donut_c3.c3donut"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| eval kpi="WARN,CRITICAL,NORMAL"
| makemv kpi delim=","
| mvexpand kpi
| eval count=substr(tostring(random()),1,2)
| table kpi count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.expand"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.label_show"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.label_threshold"&amp;gt;.05&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.label_value"&amp;gt;value&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.legend_position"&amp;gt;bottom&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.legend_show"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.tooltip_format"&amp;gt;%&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.tooltip_show"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="viz_donut_c3.c3donut.tooltip_value"&amp;gt;default&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the JS file &lt;CODE&gt;donut_click_handler.js&lt;/CODE&gt; that needs to be placed under your app's &lt;CODE&gt;appserver/static&lt;/CODE&gt; folder. If you have not used  SimpleXML CSS extension or JS Extension then you should see the example on Splunk Dev site: &lt;A href="https://dev.splunk.com/enterprise/docs/developapps/webframework/usewebframework/modifydashboards/"&gt;https://dev.splunk.com/enterprise/docs/developapps/webframework/usewebframework/modifydashboards/&lt;/A&gt; or try out Splunk Dashboard Examples app: &lt;A href="https://splunkbase.splunk.com/app/1603/"&gt;https://splunkbase.splunk.com/app/1603/&lt;/A&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; require(["splunkjs/mvc",
         "jquery", 
         "splunkjs/ready!", 
         "splunkjs/mvc/simplexml/ready!"    
     ], function( mvc,
     $){ 
        var defaultTokenModel=mvc.Components.get("default");
        var submittedTokenModel=mvc.Components.get("submitted");
        var strValue;

         $(document).on("click","#my_donut g.c3-chart-arc.c3-target-WARN",function(){
            strValue=$(this).find("text").text();
            defaultTokenModel.set("tokLabel","WARN");
            submittedTokenModel.set("tokLabel","WARN");
            defaultTokenModel.set("tokValue",strValue);
            submittedTokenModel.set("tokValue",strValue);
         });

         $(document).on("click","#my_donut g.c3-chart-arc.c3-target-CRITICAL",function(){
            strValue=$(this).find("text").text();
            defaultTokenModel.set("tokLabel","CRITICAL");
            submittedTokenModel.set("tokLabel","CRITICAL");
            defaultTokenModel.set("tokValue",strValue);
            submittedTokenModel.set("tokValue",strValue);
         });

         $(document).on("click","#my_donut g.c3-chart-arc.c3-target-NORMAL",function(){
            strValue=$(this).find("text").text();
            defaultTokenModel.set("tokLabel","NORMAL");
            submittedTokenModel.set("tokLabel","NORMAL");
            defaultTokenModel.set("tokValue",strValue);
            submittedTokenModel.set("tokValue",strValue);
         });
     });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 14:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469960#M57771</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-08T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469961#M57772</link>
      <description>&lt;P&gt;Hi @niketnilay &lt;BR /&gt;
Thanks for your inputs.&lt;/P&gt;

&lt;P&gt;But how drilldown is working in this?&lt;BR /&gt;
how my next panel is visible on click ?&lt;/P&gt;

&lt;P&gt;As, all&lt;BR /&gt;
drilldown --&amp;gt; all&lt;BR /&gt;
drilldownRedirect --&amp;gt; true&lt;/P&gt;

&lt;P&gt;nothing seems to be working on this visualization.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 04:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469961#M57772</guid>
      <dc:creator>sarvesh_11</dc:creator>
      <dc:date>2020-04-09T04:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469962#M57773</link>
      <description>&lt;P&gt;When any donut Slice is clicked, it set the slice name as &lt;CODE&gt;tokLabel&lt;/CODE&gt; and value as &lt;CODE&gt;tokValue&lt;/CODE&gt;. It is very much specific to series name for example the series &lt;CODE&gt;NORMAL&lt;/CODE&gt; will have jQUery selector &lt;CODE&gt;#my_donut g.c3-chart-arc.c3-target-NORMAL&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Nothing seem to be working is difficult to solve please add more details on what you have tried and what is the issue you see. Are you comfortable with JS? Can you debug JS code for issue? The above code is run anywhere example so it should work if you put JS in the right place (it may require debug/refresh/restart Splunk instance and also clear browser history).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 04:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469962#M57773</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-09T04:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469963#M57774</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt; ,&lt;BR /&gt;
Thanks mate, the above thing worked for me.&lt;BR /&gt;
Now this is good when we have 1 single panel, but i have 15 such donut panels,&lt;BR /&gt;
so in donut_click_handler.js , i have to write 45 stanzas, giving different tokLabel, as value is same for all i.e Warn, Normal and critical?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:59:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469963#M57774</guid>
      <dc:creator>sarvesh_11</dc:creator>
      <dc:date>2020-09-30T04:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469964#M57775</link>
      <description>&lt;P&gt;@sarvesh_11 like mentioned above, best approach for you would need to handle click event already present in &lt;CODE&gt;visualization.js&lt;/CODE&gt; to assign to your custom tokens like &lt;CODE&gt;clickedValue&lt;/CODE&gt; and &lt;CODE&gt;clickedLabel&lt;/CODE&gt; so that they always get assigned without coding for each and every donut/slice.&lt;/P&gt;

&lt;P&gt;The above is just workaround example for you to handle drilldown. If you notice, the DOM selector for drilldown in Donut slice is the label of slice which is clicked for example if CRITICAL slice is clicked then the DOM selector target name is the following: &lt;CODE&gt;c3-target-CRITICAL&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;So instead of having specific CSS Selector you can have generic CSS Selector and extract the label name from selector i.e. CRITICAL. The value can always be generically assigned to Value token. This way you can have single JS for for all Donut drilldown. Also you can perform click handler for array of Donut Chart by Ids like &lt;CODE&gt;[#donut1, #donut2...]&lt;/CODE&gt; or else take out ID based selector completely. However this will depend on your dashboard use case.&lt;/P&gt;

&lt;P&gt;Ideally first approach is the best. Although &lt;CODE&gt;visualization.js&lt;/CODE&gt; has already been created for donut chart along with click handler (it currently only logs to console, does not pass back to Splunk Token Model), you can refer to Custom Visualization API for better understanding of how it works. &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/CustomVizTutorial"&gt;https://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/CustomVizTutorial&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Please try out and confirm as this is the maximum help/hint I can provide rather than writing the code for you!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 16:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/469964#M57775</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-10T16:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown for Donut Custom Visualisation?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/531274#M64305</link>
      <description>&lt;P&gt;Is it possible to have two words Status like "Not running"? I tried to put it in:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;g.c3-shapes.c3-shapes-Not Running path.c3-shape.c3-arc-Not Running{&lt;BR /&gt;fill:orange !important;&lt;/P&gt;&lt;P&gt;Tried: with underscore (Not_Running) and with d.quotes ("Not Running")&lt;/P&gt;&lt;P&gt;but no luck. It seems&amp;nbsp; status with space is not valid. Is there a way? Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 02:56:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Drilldown-for-Donut-Custom-Visualisation/m-p/531274#M64305</guid>
      <dc:creator>vin_ven27</dc:creator>
      <dc:date>2020-11-30T02:56:39Z</dc:date>
    </item>
  </channel>
</rss>

