Hitachi Vantara Pentaho Community Forums
Results 1 to 32 of 32

Thread: How to use D3 Component library in Require.js Dashboard

  1. #1
    Join Date
    Aug 2013
    Posts
    100

    Default How to use D3 Component library in Require.js Dashboard

    How to use D3 Component library plugin in Require.js Dashboard.?Right now d3 component library is missing in Require.js dashboard.

    Anyone have faced the same problem.Please suggest any workaround for this.

  2. #2
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    The issue is with outdated cpk libs. We're working on fixing it but you can just take the cpk libs from sparkl or so and should work
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3
    Join Date
    Jan 2014
    Posts
    189

    Default

    Other than the problem with CPK libraries, the plugin only provides components for the legacy dashboards.

    The conversion of the components to RequireJS should present no challenge though.
    The code is available at https://github.com/webdetails/d3ComponentLibrary

    If you do end up porting the components to RequireJS, please consider submitting a pull request to so that the community benefits from the update.

  4. #4
    Join Date
    Aug 2013
    Posts
    100

    Default

    As you suggest i have copied the cpk libs ie cpk-core-7.1.0.0-12,cpk-pentaho5-7.1.0.0-12 from the sparkl plugin.Getting below mentioned error:

    org.pentaho.caching.impl.PentahoCacheManagerFactory$RegistrationHandler$1.onSuccess New Caching Service registered
    14:32:55,994 ERROR [Logger] Error: Pentaho
    14:32:55,999 ERROR [Logger] misc-class org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager: PluginManager.ERROR_0011 - Failed to register plugin d3ComponentLibrary
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'd3ComponentLibrary.api' defined in file [G:\shared\p7.1\pentaho-server\pentaho-solutions\system\d3ComponentLibrary\plugin.spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pt.webdetails.cpk.CpkApi]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager.reload(PentahoSystemPluginManager.java:286)
    at org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager.reload(PentahoSystemPluginManager.java:176)
    at org.pentaho.platform.plugin.services.pluginmgr.PluginAdapter.startup(PluginAdapter.java:40)
    at org.pentaho.platform.engine.core.system.PentahoSystem$2.call(PentahoSystem.java:443)
    at org.pentaho.platform.engine.core.system.PentahoSystem$2.call(PentahoSystem.java:434)
    at org.pentaho.platform.engine.core.system.PentahoSystem.runAsSystem(PentahoSystem.java:413)
    at org.pentaho.platform.engine.core.system.PentahoSystem.notifySystemListenersOfStartup(PentahoSystem.java:434)
    at org.pentaho.platform.engine.core.system.PentahoSystem.access$000(PentahoSystem.java:84)
    at org.pentaho.platform.engine.core.system.PentahoSystem$1.call(PentahoSystem.java:365)
    at org.pentaho.platform.engine.core.system.PentahoSystem$1.call(PentahoSystem.java:362)
    at org.pentaho.platform.engine.core.system.PentahoSystem.runAsSystem(PentahoSystem.java:413)
    at org.pentaho.platform.engine.core.system.PentahoSystem.notifySystemListenersOfStartup(PentahoSystem.java:362)
    at org.pentaho.platform.engine.core.system.PentahoSystem.init(PentahoSystem.java:332)
    at org.pentaho.platform.engine.core.system.PentahoSystem.init(PentahoSystem.java:228)
    at org.pentaho.platform.web.http.context.SolutionContextListener.contextInitialized(SolutionContextListener.java:162)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [pt.webdetails.cpk.CpkApi]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098)
    ... 38 more
    Caused by: java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at pt.webdetails.cpk.CpkEngine.loadElements(CpkEngine.java:232)
    at pt.webdetails.cpk.CpkEngine.reload(CpkEngine.java:158)
    at pt.webdetails.cpk.CpkEngine.initializeKettleResultCache(CpkEngine.java:147)
    at pt.webdetails.cpk.CpkEngine.init(CpkEngine.java:110)
    at pt.webdetails.cpk.CpkCoreService.<init>(CpkCoreService.java:51)
    at pt.webdetails.cpk.CpkApi.init(CpkApi.java:87)
    at pt.webdetails.cpk.CpkApi.<init>(CpkApi.java:81)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
    ... 40 more
    Caused by: java.lang.ClassNotFoundException: pt.webdetails.cpf.utils.XmlParserFactoryProducer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader.loadClass(PluginClassLoader.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 52 more
    Quote Originally Posted by pmalves View Post
    The issue is with outdated cpk libs. We're working on fixing it but you can just take the cpk libs from sparkl or so and should work

  5. #5
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: Could you please help me on this to make d3 component library to works with require.js.
    Quote Originally Posted by crusso View Post
    Other than the problem with CPK libraries, the plugin only provides components for the legacy dashboards.

    The conversion of the components to RequireJS should present no challenge though.
    The code is available at https://github.com/webdetails/d3ComponentLibrary

    If you do end up porting the components to RequireJS, please consider submitting a pull request to so that the community benefits from the update.

  6. #6
    Join Date
    Jan 2014
    Posts
    189

    Default

    What you are asking is for a full-blown tutorial. Currently I don't have that much time available.

    Start by reading http://redmine.webdetails.org/projec...wiki/RequireJS

    Take a look at https://github.com/webdetails/sparkl for some inspiration: that plugin contains the legacy and requirejs variants of the "SparklPluginCardComponent".

    You'll see that the file plugin.xml declares a requirejs configuration file
    Code:
    <external-resources>
      <file context="requirejs">content/sparkl/resources/sparkl-require-js-cfg.js</file>
    </external-resources>
    Near the end of sparkl-require-js-cfg.js, you'll see the definition of an AMD id for the module that returns the requirejs variant of the component:

    Code:
    requirePaths['sparkl/components/SparklPluginCardComponent'] = prefix + '/SparklCards/SparklPluginCardComponent';
    You'll need to know that the requireJS variant of the component is located under resources/amd-component, and that the file resources/components/SparklCards/component.xml was modified to add support for the requireJS variant:

    Code:
    <Implementation supportsLegacy="true" supportsAMD="true">
    Dive into the code, compare legacy and requireJS variants.

  7. #7
    Join Date
    Jan 2014
    Posts
    189

    Default

    What he meant was: "Replace the folder system/d3ComponentLibrary/lib with whatever is in system/sparkl/lib"


    Quote Originally Posted by Sumit_Bansal View Post
    As you suggest i have copied the cpk libs ie cpk-core-7.1.0.0-12,cpk-pentaho5-7.1.0.0-12 from the sparkl plugin.Getting below mentioned error:

    org.pentaho.caching.impl.PentahoCacheManagerFactory$RegistrationHandler$1.onSuccess New Caching Service registered
    14:32:55,994 ERROR [Logger] Error: Pentaho
    14:32:55,999 ERROR [Logger] misc-class org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager: PluginManager.ERROR_0011 - Failed to register plugin d3ComponentLibrary
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'd3ComponentLibrary.api' defined in file [G:\shared\p7.1\pentaho-server\pentaho-solutions\system\d3ComponentLibrary\plugin.spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [pt.webdetails.cpk.CpkApi]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager.reload(PentahoSystemPluginManager.java:286)
    at org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager.reload(PentahoSystemPluginManager.java:176)
    at org.pentaho.platform.plugin.services.pluginmgr.PluginAdapter.startup(PluginAdapter.java:40)
    at org.pentaho.platform.engine.core.system.PentahoSystem$2.call(PentahoSystem.java:443)
    at org.pentaho.platform.engine.core.system.PentahoSystem$2.call(PentahoSystem.java:434)
    at org.pentaho.platform.engine.core.system.PentahoSystem.runAsSystem(PentahoSystem.java:413)
    at org.pentaho.platform.engine.core.system.PentahoSystem.notifySystemListenersOfStartup(PentahoSystem.java:434)
    at org.pentaho.platform.engine.core.system.PentahoSystem.access$000(PentahoSystem.java:84)
    at org.pentaho.platform.engine.core.system.PentahoSystem$1.call(PentahoSystem.java:365)
    at org.pentaho.platform.engine.core.system.PentahoSystem$1.call(PentahoSystem.java:362)
    at org.pentaho.platform.engine.core.system.PentahoSystem.runAsSystem(PentahoSystem.java:413)
    at org.pentaho.platform.engine.core.system.PentahoSystem.notifySystemListenersOfStartup(PentahoSystem.java:362)
    at org.pentaho.platform.engine.core.system.PentahoSystem.init(PentahoSystem.java:332)
    at org.pentaho.platform.engine.core.system.PentahoSystem.init(PentahoSystem.java:228)
    at org.pentaho.platform.web.http.context.SolutionContextListener.contextInitialized(SolutionContextListener.java:162)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [pt.webdetails.cpk.CpkApi]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098)
    ... 38 more
    Caused by: java.lang.NoClassDefFoundError: pt/webdetails/cpf/utils/XmlParserFactoryProducer
    at pt.webdetails.cpk.CpkEngine.loadElements(CpkEngine.java:232)
    at pt.webdetails.cpk.CpkEngine.reload(CpkEngine.java:158)
    at pt.webdetails.cpk.CpkEngine.initializeKettleResultCache(CpkEngine.java:147)
    at pt.webdetails.cpk.CpkEngine.init(CpkEngine.java:110)
    at pt.webdetails.cpk.CpkCoreService.<init>(CpkCoreService.java:51)
    at pt.webdetails.cpk.CpkApi.init(CpkApi.java:87)
    at pt.webdetails.cpk.CpkApi.<init>(CpkApi.java:81)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
    ... 40 more
    Caused by: java.lang.ClassNotFoundException: pt.webdetails.cpf.utils.XmlParserFactoryProducer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.pentaho.platform.plugin.services.pluginmgr.PluginClassLoader.loadClass(PluginClassLoader.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 52 more

  8. #8
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso As per your guideline i have done changes :
    I have defined the require.js configuration in plugin.xml:

    Code:
    <external-resources>
            <file context="requirejs">content/d3ComponentLibrary/resources/d3-require-js-cfg.js</file>
    </external-resources>
    in the d3-require-js-cfg.js I have defined the definition of an AMD id for the module that returns the requirejs variant of the component:

    Code:
    requirePaths['d3ComponentLibrary/components/d3ComponentBase'] = prefix + '/common/d3ComponentBase';
      requirePaths['d3ComponentLibrary/components/box'] = prefix + '/d3BoxPlots/d3BoxPlots';
      requirePaths['d3ComponentLibrary/components/d3CalendarView'] = prefix + '/d3CalendarView/d3CalendarView';
      requirePaths['d3ComponentLibrary/components/d3Component'] = prefix + '/d3Component/d3Component';
      requirePaths['d3ComponentLibrary/components/MotionScatterPlot'] = prefix + '/d3MotionScatterPlot/d3MotionScatterPlot';
      requirePaths['d3ComponentLibrary/components/d3ScatterplotMatrix'] = prefix + '/d3ScatterplotMatrix/d3ScatterplotMatrix';
    Also modified the component.xml file to add the support of Require.js
    Code:
     <Implementation supportsLegacy="true" supportsAMD="true">
    But i am getting the error which i have mentioned below :

    Code:
    org.pentaho.platform.plugin.services.pluginmgr.SystemPathXmlPluginProvider: SystemPathXmlPluginProvider.ERROR_0001 - Failed to process plugin in G:\shared\p7.1\pentaho-server\pentaho-solutions\system\d3ComponentLibrary
    org.pentaho.platform.api.engine.PlatformPluginRegistrationException: PluginManager.ERROR_0005 - Failed to process plugin.xml: system/d3ComponentLibrary/plugin.xml
    if possible can you please tell me where i m doing wrong .


    Quote Originally Posted by crusso View Post
    What you are asking is for a full-blown tutorial. Currently I don't have that much time available.

    Start by reading http://redmine.webdetails.org/projec...wiki/RequireJS

    Take a look at https://github.com/webdetails/sparkl for some inspiration: that plugin contains the legacy and requirejs variants of the "SparklPluginCardComponent".

    You'll see that the file plugin.xml declares a requirejs configuration file
    Code:
    <external-resources>
      <file context="requirejs">content/sparkl/resources/sparkl-require-js-cfg.js</file>
    </external-resources>
    Near the end of sparkl-require-js-cfg.js, you'll see the definition of an AMD id for the module that returns the requirejs variant of the component:

    Code:
    requirePaths['sparkl/components/SparklPluginCardComponent'] = prefix + '/SparklCards/SparklPluginCardComponent';
    You'll need to know that the requireJS variant of the component is located under resources/amd-component, and that the file resources/components/SparklCards/component.xml was modified to add support for the requireJS variant:

    Code:
    <Implementation supportsLegacy="true" supportsAMD="true">
    Dive into the code, compare legacy and requireJS variants.

  9. #9
    Join Date
    Jan 2014
    Posts
    189

    Default

    Most likely you simply pasted the block <external-resources> outside of the <plugin> tag, or violated some XML.
    I would need to see the entire plugin.xml to tell what's wrong

  10. #10
    Join Date
    Aug 2013
    Posts
    100

    Post

    @crusso Thanks for your guideline and finally i am able to see D3 Component .when i am creating sample dashboard with the help D3 component then i am unable to see the chart and getting below mentioned error:
    Code:
    Error: Script error for: d3ComponentLibrary/components/D3Component http://requirejs.org/docs/errors.html#scripterror
    Quote Originally Posted by crusso View Post
    Most likely you simply pasted the block <external-resources> outside of the <plugin> tag, or violated some XML.
    I would need to see the entire plugin.xml to tell what's wrong

  11. #11
    Join Date
    Jan 2014
    Posts
    189

    Default

    You have typos in the require js config file.

    You should have

    Code:
    requirePaths['d3ComponentLibrary/components/D3Component'] = prefix + '/d3Component/d3Component';
    Note the letter casing

  12. #12
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso getting below mentioned error after the changes:
    Code:
    ReferenceError: D3ComponentBase is not defined[Learn More]  d3Component.js
    TypeError: D3Component is not a constructor[Learn More]  generatedContent:76:17
    Also ,i have mentioned below the d3-require-js-cfg.Let me know where i am doing wrong :
    Code:
    /**
     * RequireJS configuration file for d3ComponentLibrary
     */
    
    
    (function() {
    
    
      var requirePaths = requireCfg.paths;
    
    
      var prefix;
      if(typeof KARMA_RUN !== "undefined") { // unit tests
        prefix = requirePaths['d3ComponentLibrary/components'] = 'resources/amd-components';
    
    
      } else if(typeof CONTEXT_PATH !== "undefined") { // production
        prefix = requirePaths['d3ComponentLibrary/components']  = CONTEXT_PATH +'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else if(typeof FULL_QUALIFIED_URL != "undefined") { // embedded production
        prefix = requirePaths['d3ComponentLibrary/components']  = FULL_QUALIFIED_URL + 'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else { // build
        prefix = requirePaths['d3ComponentLibrary/components'] = '../resources/amd-components';
      }
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/common/d3ComponentBase';
      requirePaths['d3ComponentLibrary/components/D3BoxPlots'] = prefix + '/d3BoxPlots/d3BoxPlots';
      requirePaths['d3ComponentLibrary/components/D3CalendarView'] = prefix + '/d3CalendarView/d3CalendarView';
      requirePaths['d3ComponentLibrary/components/D3Component'] = prefix + '/d3Component/d3Component';
      requirePaths['d3ComponentLibrary/components/D3MotionScatterPlot'] = prefix + '/d3MotionScatterPlot/d3MotionScatterPlot';
      requirePaths['d3ComponentLibrary/components/D3ScatterplotMatrix'] = prefix + '/d3ScatterplotMatrix/d3ScatterplotMatrix';
    })();

    Quote Originally Posted by crusso View Post
    You have typos in the require js config file.

    You should have

    Code:
    requirePaths['d3ComponentLibrary/components/D3Component'] = prefix + '/d3Component/d3Component';
    Note the letter casing

  13. #13
    Join Date
    Jan 2014
    Posts
    189

    Default

    The problem now lies within d3Component.js
    You probably failed to declare a define block:

    Code:
    define(['d3ComponentLibrary/components/D3BaseComponent'], function(D3BaseComponent){
    
    return ....
    });

  14. #14
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso thanks for your quick response..i have changes the file which is located at :system\d3ComponentLibrary\resources\amd-components\d3Component
    After changes my files looks like :
    Code:
    /*
     * d3 component, using the d3ComponentBase
     */
     define(['d3ComponentLibrary/components/D3BaseComponent'], function(D3BaseComponent){
     var D3Component =  D3ComponentBase.extend({
        defaultWidth: 600,
        defaultHeight: 400
    
    
       });
    
    
    });
    it is correct ?

    Quote Originally Posted by crusso View Post
    The problem now lies within d3Component.js
    You probably failed to declare a define block:

    Code:
     define(['d3ComponentLibrary/components/D3BaseComponent'], function(D3BaseComponent){
    retrun..
    });
    Last edited by Sumit_Bansal; 07-24-2017 at 03:16 PM.

  15. #15
    Join Date
    Jan 2014
    Posts
    189

    Default

    just add:

    return D3Component;

  16. #16
    Join Date
    Aug 2013
    Posts
    100

    Arrow

    @crusso: getting same error as like previously
    Code:
    GET http://localhost:8083/pentaho/api/repos/d3ComponentLibrary/resources/amd-components/D3BaseComponent.js [HTTP/1.1 404 Not Found 12ms]
    Error: Script error for: d3ComponentLibrary/components/D3BaseComponenthttp://requirejs.org/docs/errors.html#scripterror
    Quote Originally Posted by crusso View Post
    just add:

    return D3Component;
    Last edited by Sumit_Bansal; 07-24-2017 at 03:51 PM.

  17. #17
    Join Date
    Jan 2014
    Posts
    189

    Default

    This is no proper way for debugging code. You would need to post the code somewhere, e.g. your own fork of the component in github, so that people can inspect the code

  18. #18
    Join Date
    Jan 2014
    Posts
    189

    Default

    Actually, the problem is another typo:

    Code:
    /*
     * d3 component, using the d3ComponentBase
     */
     define(['d3ComponentLibrary/components/D3ComponentBase'], function(D3ComponentBase){
     var D3Component =  D3ComponentBase.extend({
        defaultWidth: 600,
        defaultHeight: 400
       });
    
      return D3Component;
    });
    Note that every js file under amd-components must be edited to be contained within define() blocks.

  19. #19
    Join Date
    Aug 2013
    Posts
    100

    Default

    As per my understanding, we need to make compatible of d3ComponentBase.js with require.js.The d3ComponentBase.js code i have mentioned below:
    Code:
    /*
     * d3 component, using the chartComponent
     */
    
    
     var D3ComponentBase =  ChartComponent.extend({
    
    
        defaultWidth: 600,
        defaultHeight: 400,
      
         update : function() {
           if (this.parameters == undefined) {
             this.parameters = [];
           };
    
    
           this.renderChart();
         },
    
    
         render: function(values) {
    
    
           this.customfunction.call(this,values);
         },
    
    
         cdaResultToD3Array: function(d){
    
    
           var result = [];
           _.each(d.resultset,function(row, o){
               var line = {};
               _.each(row,function(cell,idx){
                   line[_.findWhere(d.metadata,{colIndex:idx})["colName"]] = cell;
                 });
               result.push(line);
             });
    
    
           return result;
         },
    
    
         getHeight: function(){
           var $ph = this.placeholder();
           return this.height?this.height:($ph.height()>0?$ph.height():this.defaultHeight);
         },
    
    
         getWidth: function(){
           var $ph = this.placeholder();
           return this.width?this.width:($ph.width()>0?$ph.width():this.defaultWidth);
         }
    
    
       });
    Quote Originally Posted by crusso View Post
    This is no proper way for debugging code. You would need to post the code somewhere, e.g. your own fork of the component in github, so that people can inspect the code

  20. #20
    Join Date
    Jan 2014
    Posts
    189

    Default

    In this case you need to have:

    Code:
    define(["cdf/components/ChartComponent"], function(ChartComponent){
    
    // content of legacy d3ComponentBase.js goes here
    
    return D3ComponentBase;
    });
    I hope you were able to pick up the pattern here

  21. #21
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: same pattern already follow but getting same error :

    Code:
    Error: Script error for: d3ComponentLibrary/components/D3ComponentBasehttp://requirejs.org/docs/errors.html#scripterror
    But i have copied my code in github repository and provides the link https://github.com/sumit140/d3componentlibrary
    Quote Originally Posted by crusso View Post
    In this case you need to have:

    Code:
    define(["cdf/components/ChartComponent"], function(ChartComponent){
    
    // content of legacy d3ComponentBase.js goes here
    
    return D3ComponentBase;
    });
    I hope you were able to pick up the pattern here
    Last edited by Sumit_Bansal; 07-24-2017 at 05:05 PM.

  22. #22
    Join Date
    Jan 2014
    Posts
    189

    Default

    RequireJS is failing to find the module at the path d3ComponentLibrary/components/D3ComponentBase


    You shouldn't have deleted the requirejs path definitions for all the other modules, as you had initially. Keep the config file as:

    Code:
    /**
     * RequireJS configuration file for d3ComponentLibrary
     */
    
    
    (function() {
    
    
      var requirePaths = requireCfg.paths;
    
    
      var prefix;
      if(typeof KARMA_RUN !== "undefined") { // unit tests
        prefix = requirePaths['d3ComponentLibrary/components'] = 'resources/amd-components';
    
    
      } else if(typeof CONTEXT_PATH !== "undefined") { // production
        prefix = requirePaths['d3ComponentLibrary/components']  = CONTEXT_PATH +'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else if(typeof FULL_QUALIFIED_URL != "undefined") { // embedded production
        prefix = requirePaths['d3ComponentLibrary/components']  = FULL_QUALIFIED_URL + 'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else { // build
        prefix = requirePaths['d3ComponentLibrary/components'] = '../resources/amd-components';
      }
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/common/d3ComponentBase';
      requirePaths['d3ComponentLibrary/components/D3BoxPlots'] = prefix + '/d3BoxPlots/d3BoxPlots';
      requirePaths['d3ComponentLibrary/components/D3CalendarView'] = prefix + '/d3CalendarView/d3CalendarView';
      requirePaths['d3ComponentLibrary/components/D3Component'] = prefix + '/d3Component/d3Component';
      requirePaths['d3ComponentLibrary/components/D3MotionScatterPlot'] = prefix + '/d3MotionScatterPlot/d3MotionScatterPlot';
      requirePaths['d3ComponentLibrary/components/D3ScatterplotMatrix'] = prefix + '/d3ScatterplotMatrix/d3ScatterplotMatrix';
    })();

  23. #23
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: thanks a lot for the help .but i have already tried the same thing and also i have updated my whole complete code in github:https://github.com/sumit140/d3componentlibrary getting same error as like previous:

    Code:
    Error: Script error for: d3ComponentLibrary/components/D3ComponentBasehttp://requirejs.org/docs/errors.html#scripterror
    Quote Originally Posted by crusso View Post
    RequireJS is failing to find the module at the path d3ComponentLibrary/components/D3ComponentBase


    You shouldn't have deleted the requirejs path definitions for all the other modules, as you had initially. Keep the config file as:

    Code:
    /**
     * RequireJS configuration file for d3ComponentLibrary
     */
    
    
    (function() {
    
    
      var requirePaths = requireCfg.paths;
    
    
      var prefix;
      if(typeof KARMA_RUN !== "undefined") { // unit tests
        prefix = requirePaths['d3ComponentLibrary/components'] = 'resources/amd-components';
    
    
      } else if(typeof CONTEXT_PATH !== "undefined") { // production
        prefix = requirePaths['d3ComponentLibrary/components']  = CONTEXT_PATH +'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else if(typeof FULL_QUALIFIED_URL != "undefined") { // embedded production
        prefix = requirePaths['d3ComponentLibrary/components']  = FULL_QUALIFIED_URL + 'api/repos/d3ComponentLibrary/resources/amd-components';
    
    
      } else { // build
        prefix = requirePaths['d3ComponentLibrary/components'] = '../resources/amd-components';
      }
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/common/d3ComponentBase';
      requirePaths['d3ComponentLibrary/components/D3BoxPlots'] = prefix + '/d3BoxPlots/d3BoxPlots';
      requirePaths['d3ComponentLibrary/components/D3CalendarView'] = prefix + '/d3CalendarView/d3CalendarView';
      requirePaths['d3ComponentLibrary/components/D3Component'] = prefix + '/d3Component/d3Component';
      requirePaths['d3ComponentLibrary/components/D3MotionScatterPlot'] = prefix + '/d3MotionScatterPlot/d3MotionScatterPlot';
      requirePaths['d3ComponentLibrary/components/D3ScatterplotMatrix'] = prefix + '/d3ScatterplotMatrix/d3ScatterplotMatrix';
    })();

  24. #24
    Join Date
    Jan 2014
    Posts
    189

    Default

    This is beyond what can be done via forum messaging.

    Here's a bunch of things you can try

    0) Restart the server. The message you are getting may mean that the requirejs configuration is not loaded. It is only loaded when the server/plugin starts, afaik.

    1) Try to refer to D3ComponentBase using a relative path, e.g.

    Code:
    define(['../commons/d3ComponentBase'], function(D3ComponentBase){
    ...
    2) Remove all component.xml from within resources/amd-components, and add define blocks for all js files within amd-components.
    Do not delete the component.xml files within resources/components

  25. #25
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: yes i will do all the actions what you have explained.Have u seen my code in github?may be i know your skype id or personal email id if possible.Thanks a lot once again for the help.
    Quote Originally Posted by crusso View Post
    This is beyond what can be done via forum messaging.

    Here's a bunch of things you can try

    0) Restart the server. The message you are getting may mean that the requirejs configuration is not loaded. It is only loaded when the server/plugin starts, afaik.

    1) Try to refer to D3ComponentBase using a relative path, e.g.

    Code:
    define(['../commons/d3ComponentBase'], function(D3ComponentBase){
    ...
    2) Remove all component.xml from within resources/amd-components, and add define blocks for all js files within amd-components.
    Do not delete the component.xml files within resources/components
    Last edited by Sumit_Bansal; 07-25-2017 at 05:19 AM.

  26. #26
    Join Date
    Aug 2013
    Posts
    100

    Default

    After all the changes i am getting this error in console :
    Code:
     Error: Script error for: d3ComponentLibrary/commons/d3ComponentBasehttp://requirejs.org/docs/errors.html#scripterror
    in log getting this error
    Code:
    2017-07-25 17:56:34,445 ERROR [org.pentaho.platform.engine.core.system.objfac.references.AbstractPentahoObjectReference] Error creating object. Null will be returned.org.pentaho.platform.api.engine.ObjectFactoryException: Error creating instance
    	at org.pentaho.platform.engine.core.system.objfac.references.PrototypePentahoObjectReference.createObject(PrototypePentahoObjectReference.java:34)
    	at org.pentaho.platform.engine.core.system.objfac.references.AbstractPentahoObjectReference.getObject(AbstractPentahoObjectReference.java:43)
    	at org.pentaho.platform.engine.core.system.objfac.AggregateObjectFactory.get(AggregateObjectFactory.java:267)
    	at org.pentaho.platform.engine.core.system.PentahoSystem.get(PentahoSystem.java:684)
    	at org.pentaho.platform.plugin.services.pluginmgr.PentahoSystemPluginManager.getContentGenerator(PentahoSystemPluginManager.java:864)
    	at org.pentaho.platform.web.http.api.resources.RepositoryResource$ContentTypeCGFactory.create(RepositoryResource.java:804)
    	at org.pentaho.platform.web.http.api.resources.RepositoryResource.getContentGeneratorResponse(RepositoryResource.java:874)
    	at org.pentaho.platform.web.http.api.resources.RepositoryResource.doService(RepositoryResource.java:688)
    	at org.pentaho.platform.web.http.api.resources.RepositoryResource.doGet(RepositoryResource.java:598)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
    	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
    	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
    	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
    	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
    	at org.pentaho.platform.web.servlet.JAXRSServlet.service(JAXRSServlet.java:109)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    	at org.pentaho.platform.web.servlet.JAXRSServlet.service(JAXRSServlet.java:114)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.PentahoWebContextFilter.doFilter(PentahoWebContextFilter.java:195)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.PentahoRequestContextFilter.doFilter(PentahoRequestContextFilter.java:87)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    	at org.pentaho.platform.web.http.filters.PreFlightReportingFilter.doFilter(PreFlightReportingFilter.java:47)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.pentaho.platform.web.http.security.RequestParameterAuthenticationFilter.doFilter(RequestParameterAuthenticationFilter.java:191)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)
    	at org.pentaho.platform.web.http.security.PentahoBasicProcessingFilter.doFilterInternal(PentahoBasicProcessingFilter.java:125)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.pentaho.platform.web.http.filters.HttpSessionPentahoSessionIntegrationFilter.doFilter(HttpSessionPentahoSessionIntegrationFilter.java:271)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.SystemStatusFilter.doFilter(SystemStatusFilter.java:55)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:114)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.WebappRootForwardingFilter.doFilter(WebappRootForwardingFilter.java:70)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.pentaho.platform.web.http.filters.PentahoPathDecodingFilter.doFilter(PentahoPathDecodingFilter.java:34)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2521)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2510)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: pt.webdetails.cpk.CpkContentGenerator cannot be cast to org.pentaho.platform.api.engine.IContentGenerator
    Quote Originally Posted by crusso View Post
    This is beyond what can be done via forum messaging.

    Here's a bunch of things you can try

    0) Restart the server. The message you are getting may mean that the requirejs configuration is not loaded. It is only loaded when the server/plugin starts, afaik.

    1) Try to refer to D3ComponentBase using a relative path, e.g.

    Code:
    define(['../commons/d3ComponentBase'], function(D3ComponentBase){
    ...
    2) Remove all component.xml from within resources/amd-components, and add define blocks for all js files within amd-components.
    Do not delete the component.xml files within resources/components

  27. #27
    Join Date
    Jan 2014
    Posts
    189

    Default

    Quote Originally Posted by Sumit_Bansal View Post
    After all the changes i am getting this error in console :
    Code:
     Error: Script error for: d3ComponentLibrary/commons/d3ComponentBasehttp://requirejs.org/docs/errors.html#scripterror
    in log getting this error
    Ok, so the relative path did not work, you'll need to keep using the absolute path: "d3ComponentLibrary/components/D3ComponentBase"

    Also, note that in your requirejs config file there is a typo on the path:
    Code:
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/common/d3ComponentBase';
    It should be
    Code:
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/commons/d3ComponentBase';
    Last edited by crusso; 07-25-2017 at 09:17 AM.

  28. #28
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: finally there is no error on console regarding the d3component library .thanks a lot for your time and effort which you have put on this thread.
    After writing the d3 chart code getting some other error which i have mentioned below that i am trying to resolve :
    Code:
    [error] WD: TypeError: Cannot read property 'each' of undefined
    localhost:8083/pentaho/plugin/pentaho-cdf/api/resources/js/compressed/Logger.js:4
    Quote Originally Posted by crusso View Post
    Ok, so the relative path did not work, you'll need to keep using the absolute path: "d3ComponentLibrary/components/D3ComponentBase"

    Also, note that in your requirejs config file there is a typo on the path:
    Code:
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/common/d3ComponentBase';
    It should be
    Code:
    requirePaths['d3ComponentLibrary/components/D3ComponentBase'] = prefix + '/commons/d3ComponentBase';

  29. #29
    Join Date
    Jan 2014
    Posts
    189

    Default

    My guess is that there is a missing dependency. For instance, on https://github.com/sumit140/d3compon...entBase.js#L27 the code assumes underscore has been loaded.

    Try to replace the header of the define block:
    Code:
    define(["cdf/components/ChartComponent", "cdf/lib/underscore"], function(ChartComponent, _){

  30. #30
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso : works fine ..now able to render d3 chart.Thanks for your support .
    Quote Originally Posted by crusso View Post
    My guess is that there is a missing dependency. For instance, on https://github.com/sumit140/d3compon...entBase.js#L27 the code assumes underscore has been loaded.

    Try to replace the header of the define block:
    Code:
    define(["cdf/components/ChartComponent", "cdf/lib/underscore"], function(ChartComponent, _){

  31. #31
    Join Date
    Jan 2014
    Posts
    189

    Default

    If you are willing to share your effort with the community, you could place a pull request against the main git repository.

    A pull request typically means a professional will review and validate the code.
    Once merged, your changes justify a new version of the plugin that could appear in the marketplace.

  32. #32
    Join Date
    Aug 2013
    Posts
    100

    Default

    @crusso: thanks a lot for your effort and i will pull the request today to main d3componentlibrary repository so that changes will reflecting after the review.
    Quote Originally Posted by crusso View Post
    If you are willing to share your effort with the community, you could place a pull request against the main git repository.

    A pull request typically means a professional will review and validate the code.
    Once merged, your changes justify a new version of the plugin that could appear in the marketplace.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.