<?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: Using D3 chart in HTMLDashboard causes problem with require.js in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138226#M44462</link>
    <description>&lt;P&gt;Hello, you are missing require.config in html dashboard. You need the require.config to specify the path to the lib.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require.config({
   paths: {
     "app": "../app"
   }
 });
 require([
 "splunkjs/mvc",
 "splunkjs/mvc/utils",
 "splunkjs/mvc/tokenutils",
 "underscore",
 "jquery",
 "app/&amp;lt;your_app&amp;gt;/components/d3/d3", // this is the path under appserver/static directory in your app.
 "splunk.util",
 "splunkjs/mvc/simplexml",
 "splunkjs/mvc/headerview",
 "splunkjs/mvc/footerview",
 "splunkjs/mvc/simplexml/dashboardview",
 "splunkjs/mvc/simplexml/dashboard/panelref",
 "splunkjs/mvc/simplexml/element/html",
 "splunkjs/mvc/simplexml/element/list",
 "splunkjs/mvc/simplexml/element/map",
 "splunkjs/mvc/simpleform/formutils",
 "splunkjs/mvc/simplexml/eventhandler",
 "splunkjs/mvc/simpleform/input/dropdown",
 "splunkjs/mvc/simpleform/input/multiselect",
 "splunkjs/mvc/simpleform/input/text",
 "splunkjs/mvc/simpleform/input/submit",
 "splunkjs/mvc/textinputview",
 "splunkjs/mvc/radiogroupview",
 "splunkjs/mvc/multidropdownview",
 "splunkjs/mvc/searchmanager",
 // Add comma-separated libraries and modules manually here, for example:
 // ..."splunkjs/mvc/simplexml/urltokenmodel",
 // "splunkjs/mvc/checkboxview" ],
function(
mvc,
utils,
TokenUtils,
_,
$,
d3,
SplunkUtil,
DashboardController,
HeaderView,
FooterView,
Dashboard,
PanelRef,
HtmlElement,
ListElement,
MapElement,
FormUtils,
EventHandler,
DropdownInput,
MultiSelectInput,
TextInput,
SubmitButton,
TextInputView,
RadioGroupView,
MultiDropdownView,
SearchManager)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should fix this issue.  You can check out my apps in Splunk Base, &lt;A href="https://github.com/httpstergeek/config-modeler/blob/master/config_modeler/appserver/static/modeler.js"&gt;config modeler app&lt;/A&gt; use this method to load d3.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2015 22:36:57 GMT</pubDate>
    <dc:creator>bmacias84</dc:creator>
    <dc:date>2015-11-10T22:36:57Z</dc:date>
    <item>
      <title>Using D3 chart in HTMLDashboard causes problem with require.js</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138224#M44460</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I would like to use the a d3 Chart in a HTML-Dashboard. &lt;BR /&gt;
Dearly I have got a problem in combination with require.js that is used by splunk. &lt;/P&gt;

&lt;P&gt;In the following you could find a first require, that works (I corrected the path so that d3 works, and I get the d3-Version in the console.) &lt;/P&gt;

&lt;P&gt;Afterwards I use the same thing again, but this time in combination with some other modules. As a result, d3 is undefined. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require(["d3"],function(d3){
console.log(d3.version);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;});&lt;BR /&gt;&lt;BR /&gt;
//&lt;BR /&gt;
// LIBRARY REQUIREMENTS&lt;BR /&gt;
//&lt;BR /&gt;
// In the require function, we include the necessary libraries and modules for&lt;BR /&gt;
// the HTML dashboard. Then, we pass variable names for these libraries and&lt;BR /&gt;
// modules as function parameters, in order.&lt;BR /&gt;
// &lt;BR /&gt;
// When you add libraries or modules, remember to retain this mapping order&lt;BR /&gt;
// between the library or module and its function parameter. You can do this by&lt;BR /&gt;
// adding to the end of these lists, as shown in the commented examples below.&lt;/P&gt;

&lt;P&gt;require([&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"splunkjs/mvc",
"splunkjs/mvc/utils",
"splunkjs/mvc/tokenutils",
"underscore",
"jquery",
"splunkjs/mvc/simplexml",
"splunkjs/mvc/headerview",
"splunkjs/mvc/footerview",
"splunkjs/mvc/simplexml/dashboardview",
"splunkjs/mvc/simplexml/element/chart",
"splunkjs/mvc/simplexml/element/event",
"splunkjs/mvc/simplexml/element/html",
"splunkjs/mvc/simplexml/element/list",
"splunkjs/mvc/simplexml/element/map",
"splunkjs/mvc/simplexml/element/single",
"splunkjs/mvc/simplexml/element/table",
"splunkjs/mvc/simpleform/formutils",
"splunkjs/mvc/simpleform/input/dropdown",
"splunkjs/mvc/simpleform/input/radiogroup",
"splunkjs/mvc/simpleform/input/multiselect",
"splunkjs/mvc/simpleform/input/checkboxgroup",
"splunkjs/mvc/simpleform/input/text",
"splunkjs/mvc/simpleform/input/timerange",
"splunkjs/mvc/simpleform/input/submit",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/savedsearchmanager",
"splunkjs/mvc/postprocessmanager",
"splunkjs/mvc/simplexml/urltokenmodel",

// Add comma-separated libraries and modules manually here, for example:
// ..."splunkjs/mvc/simplexml/urltokenmodel",
// "splunkjs/mvc/checkboxview"
"d3"],{
console.log(d3.version);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The specific error message I receive from chrome at this point is the following: &lt;BR /&gt;
"Uncaught ReferenceError: d3 is not defined "&lt;/P&gt;

&lt;P&gt;Do you have any idea, how to fix such an issue? Thank you very much for your support!&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE Work-around 16th July 2014&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Meanwhile it works, but the solution looks very creepy: &lt;/P&gt;

&lt;P&gt;I require a few of the packages mentioned above (I think all before the map-element + d3) and print the d3-version-number into the commandline before I require everything in sum and run my normal stuff. &lt;/P&gt;

&lt;P&gt;If someone would have an idea, which module could use its own d3  here, it would be great to fix that.&lt;/P&gt;

&lt;P&gt;Kind regards, &lt;/P&gt;

&lt;P&gt;Xantor&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2014 22:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138224#M44460</guid>
      <dc:creator>splunkbeginner2</dc:creator>
      <dc:date>2014-07-10T22:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using D3 chart in HTMLDashboard causes problem with require.js</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138225#M44461</link>
      <description>&lt;P&gt;Hi splunkbeginner21, can you paste the code regarding the Work-around 16th July 2014 you mentioned? I have the exact same problem and seems like nobody answered back since July 2014. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 10:00:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138225#M44461</guid>
      <dc:creator>kikexclusive</dc:creator>
      <dc:date>2015-11-10T10:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using D3 chart in HTMLDashboard causes problem with require.js</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138226#M44462</link>
      <description>&lt;P&gt;Hello, you are missing require.config in html dashboard. You need the require.config to specify the path to the lib.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require.config({
   paths: {
     "app": "../app"
   }
 });
 require([
 "splunkjs/mvc",
 "splunkjs/mvc/utils",
 "splunkjs/mvc/tokenutils",
 "underscore",
 "jquery",
 "app/&amp;lt;your_app&amp;gt;/components/d3/d3", // this is the path under appserver/static directory in your app.
 "splunk.util",
 "splunkjs/mvc/simplexml",
 "splunkjs/mvc/headerview",
 "splunkjs/mvc/footerview",
 "splunkjs/mvc/simplexml/dashboardview",
 "splunkjs/mvc/simplexml/dashboard/panelref",
 "splunkjs/mvc/simplexml/element/html",
 "splunkjs/mvc/simplexml/element/list",
 "splunkjs/mvc/simplexml/element/map",
 "splunkjs/mvc/simpleform/formutils",
 "splunkjs/mvc/simplexml/eventhandler",
 "splunkjs/mvc/simpleform/input/dropdown",
 "splunkjs/mvc/simpleform/input/multiselect",
 "splunkjs/mvc/simpleform/input/text",
 "splunkjs/mvc/simpleform/input/submit",
 "splunkjs/mvc/textinputview",
 "splunkjs/mvc/radiogroupview",
 "splunkjs/mvc/multidropdownview",
 "splunkjs/mvc/searchmanager",
 // Add comma-separated libraries and modules manually here, for example:
 // ..."splunkjs/mvc/simplexml/urltokenmodel",
 // "splunkjs/mvc/checkboxview" ],
function(
mvc,
utils,
TokenUtils,
_,
$,
d3,
SplunkUtil,
DashboardController,
HeaderView,
FooterView,
Dashboard,
PanelRef,
HtmlElement,
ListElement,
MapElement,
FormUtils,
EventHandler,
DropdownInput,
MultiSelectInput,
TextInput,
SubmitButton,
TextInputView,
RadioGroupView,
MultiDropdownView,
SearchManager)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should fix this issue.  You can check out my apps in Splunk Base, &lt;A href="https://github.com/httpstergeek/config-modeler/blob/master/config_modeler/appserver/static/modeler.js"&gt;config modeler app&lt;/A&gt; use this method to load d3.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 22:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-D3-chart-in-HTMLDashboard-causes-problem-with-require-js/m-p/138226#M44462</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2015-11-10T22:36:57Z</dc:date>
    </item>
  </channel>
</rss>

