<?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: Mapping two searches to the same chart element at different times? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260272#M78020</link>
    <description>&lt;P&gt;Bingo !!!! that i was looking for Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2015 09:36:50 GMT</pubDate>
    <dc:creator>kartik13</dc:creator>
    <dc:date>2015-10-08T09:36:50Z</dc:date>
    <item>
      <title>Mapping two searches to the same chart element at different times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260268#M78016</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am on runtime trying to change the search in the same chart element. As in the chart element refers to one search at a time by mangerid.&lt;/P&gt;

&lt;P&gt;For eg. &lt;BR /&gt;
    &lt;CODE&gt;{"managerid":"search1"}&lt;/CODE&gt; . By clicking the HTML list, I am changing the value of &lt;CODE&gt;managerid&lt;/CODE&gt; in the chart element. It's giving me an error:&lt;BR /&gt;
     &lt;CODE&gt;Already have instance with id: search1&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any leads on how to resolve this issue?&lt;/P&gt;

&lt;P&gt;Also, how can I re-render the chart if I am able to change the value of &lt;CODE&gt;managerid&lt;/CODE&gt; at runtime .&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 11:17:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260268#M78016</guid>
      <dc:creator>kartik13</dc:creator>
      <dc:date>2015-10-07T11:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping two searches to the same chart element at different times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260269#M78017</link>
      <description>&lt;P&gt;How are You changing this managerid value?&lt;/P&gt;

&lt;P&gt;Can You give more details - how these searches are different? It would be easier to change search string or add PostProcessManager than changing the whole manager.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 14:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260269#M78017</guid>
      <dc:creator>piUek</dc:creator>
      <dc:date>2015-10-07T14:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping two searches to the same chart element at different times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260270#M78018</link>
      <description>&lt;P&gt;Yeah i know but i have created a dropdown through bootstrap which has an id related to it, which corresponds to the search id of the searches . The searches are from summary indexes .Thats why couldn't use the PostProcessManager. So if by token change i will be able to map different searches to the same chart element. But i am not able to set the token of managerid in Chart element .Do u have any leads on that. Is that possible. &lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 05:41:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260270#M78018</guid>
      <dc:creator>kartik13</dc:creator>
      <dc:date>2015-10-08T05:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping two searches to the same chart element at different times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260271#M78019</link>
      <description>&lt;P&gt;Inspecting this issue I've noticed, that refreshing or changing the search will also refresh all the elements linked to it. For example if I have chart with managerid set to a search, i can easily redraw this chart by grabbing the search and refreshing it with for example .startSearch() method. It would all depend on the data and your needs. I have tailored a simple example of html dashboard which would change the search string for searchManager and by doing so it will redraw the chart corresponding to it. I've removed all unnecessary code, but in the production You might use tokens instead of setting the search string from dictionary.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
    &amp;lt;title&amp;gt;test3&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body class="simplexml preload locale-en"&amp;gt;
    &amp;lt;select style="width:350px;" tabindex="1" id='targetsDropdown'&amp;gt;
        &amp;lt;option&amp;gt;Search1&amp;lt;/option&amp;gt;
        &amp;lt;option&amp;gt;Search2&amp;lt;/option&amp;gt;
        &amp;lt;option&amp;gt;Search3&amp;lt;/option&amp;gt;
    &amp;lt;/select&amp;gt;
    &amp;lt;div id='mybarchart'&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;!-- 
END LAYOUT
--&amp;gt;
    &amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/config?autoload=1"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/static/js/i18n.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/i18ncatalog?autoload=1"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/static/js/build/simplexml.min/config.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="text/javascript"&amp;gt;
    // &amp;lt;![CDATA[
    require.config({
        baseUrl: "{{SPLUNKWEB_URL_PREFIX}}/static/js",
        waitSeconds: 0 // Disable require.js load timeout
    });

    require([
            "splunkjs/mvc",
            "underscore",
            "jquery",
            "splunkjs/mvc/searchmanager",
            "splunkjs/mvc/simplexml/urltokenmodel",
            "splunkjs/mvc/chartview"

        ],
        function(
            mvc,
            _,
            $,
            SearchManager,
            UrlTokenModel,
            chartView
        ) {
            var ChartView = require("splunkjs/mvc/chartview");

            // dictionary with searches (the names have to match the ones on dropdown)
            var searches = {
                'Search1': 'index=_internal | head 100 | stats count by source',
                'Search2': 'index=_internal | head 100 | stats count by processor',
                'Search3': 'index=_internal | head 100 | stats count by name'
            }

            // creating search
            var mysearch = new SearchManager({
                id: "mysearch1",
                earliest_time: "-48h",
                latest_time: "now",
                search: "index=_internal | head 100 | stats count by source"
            });

            // creating barchart
            var barchart = new ChartView({
                id: "example-chart",
                managerid: "mysearch1",
                type: "bar",
                "charting.chart.stackMode": "stacked",
                "charting.legend.placement": "bottom",
                el: $("#mybarchart"),
                height: 450
            }).render();

            // grab the dropdown menu
            var dropdown = $('#targetsDropdown');

            // on change set the search to the corresponding search string from the searches dictionary
            dropdown.on('change', function() {
                mysearch.set('search', searches[this.value]) // this.value is selected value on the dropdown
            })
        }
    );
    // ]]&amp;gt;
    &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2015 08:24:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260271#M78019</guid>
      <dc:creator>piUek</dc:creator>
      <dc:date>2015-10-08T08:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping two searches to the same chart element at different times?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260272#M78020</link>
      <description>&lt;P&gt;Bingo !!!! that i was looking for Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 09:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-two-searches-to-the-same-chart-element-at-different/m-p/260272#M78020</guid>
      <dc:creator>kartik13</dc:creator>
      <dc:date>2015-10-08T09:36:50Z</dc:date>
    </item>
  </channel>
</rss>

