D3 and function __exec

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • D3 and function __exec

    Hi everyone,

    I'm using the Jedox 4.0 and the d3 library to visualize data. It works but now I would like to get the data directly from the worksheet using function __exec(params).

    Somehow it does not work anymore, it seems to me that I cannot use the exec function when the script's source is a d3 library.

    Here is an example where the exec function works. In the commented tag you see alternative script tag linked to the d3 library. When I use the d3 library nothing seems to happen so I guess the function is not executed.

    HTML Source Code

    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. </head>
    5. <body>
    6. <script type="text/javascript"> <!-- script src="...link to d3 library d3.v3.min.js" -->
    7. /** Array storing the source range values from the worksheet A1:O4 */
    8. var myArray = new Array();
    9. function __exec(params) {
    10. for (var param in params)
    11. myArray.push(params[param]);
    12. alert("myArray[0]="+myArray[0]);
    13. }
    14. </script>
    15. </body>
    16. </html>
    Display All



    Do you have any advise?

    Cheers
  • Please verify whether the source of the d3.js library is correct, i.e the relative path where you have put the script.

    Take a demo d3.js chart example and try to add the chart library along with your sample page under Jedox Apache Http server and try it with web browser if it works.

    with __exec() function , you will need to add all the chart rendering codes under this function.

    The __exec(params) will then fire every time the worksheet source data is updated and if chart rendering code block is inside this function, it will also execute.


    Best regards,
    Noel.
  • Hi Noel,

    I have restructured my code so that all chart rendering functions are triggered by the __exec function.
    It now works fine on my local machine but I still have some trouble getting it to run on a server client system. The d3 library is stored on the server and the widgets using those d3 charts use the correct link to the d3.v3.min.js file (the correct ip address is shown). Nevertheless nothing is displayed
    I have also tried using the path <script src="http://d3js.org/d3.v3.min.js"></script> but it is not working either.


    Best regards
    Max
  • Hello Max,

    It could be that your not able to access the internet. I see that you are refering to d3.js java script library directly from d3js.org website.
    script src="http://d3js.org/d3.v3.min.js"
    You might want to download this javascript library from that site and change your script source to relative path of the local filesystem
    where you have put this library.


    Best regards,
    Noel.
  • Hi Noel,

    I also thought there could be some problem with the internet connection, but I can goto the address using a client's internet browser.

    My desired solution:
    - the d3 lib is stored locally on my server
    - the d3 widgets that the clients use on their machines should reference this lib file (using the file's link as shown in the file manager).

    That does not seem to work, even though there is definitely an active connection between server and clients.
    I cannot ask the clients to save the d3 lib on their local machine, because then everyone would have to adjust the relative path in the source tag.

    Best regards,
    max
  • Hello Max,

    So you are installing Palo Server on each of client's machine? if its one server everyone is using then it would be a one time job.
    Else you can use some convension so that with relative path everything would work fine.

    You can try to follow convension where you package your D3 JS project with folder structure:
    D3
    | __lib
    |__web

    put all your created pages under the web folder refering to D3.js library present in the 'lib' folder
    src="../lib/d3.v3.min.js"

    zip the D3 folder including the sub folders lib and src, and provide instructions to customer to unzip and place it under
    Palo Suite Install home httpd/app/docroot/pr

    Now in your spreadsheet widget if you need to refer to Page test.html present under D3/web folder then use relative reference
    url would be : /pr/d3/web/test.html
    you can export your reports and clients would just need 2 steps first unzip & copy the D3 folder under proper path, 2nd import the reports .


    Best regards,
    Noel.
  • Hello Max,

    So you are installing Palo Server on each of client's machine? if its one server everyone is using then it would be a one time job.
    Else you can use some convension so that with relative path everything would work fine.

    You can try to follow convension where you package your D3 JS project with folder structure:
    D3
    | __lib
    |__web

    put all your created pages under the web folder refering to D3.js library present in the 'lib' folder
    src="../lib/d3.v3.min.js"

    zip the D3 folder including the sub folders lib and src, and provide instructions to customer to unzip and place it under
    Palo Suite Install home httpd/app/docroot/pr

    Now in your spreadsheet widget if you need to refer to Page test.html present under D3/web folder then use relative reference
    url would be : /pr/d3/web/test.html
    you can export your reports and clients would just need 2 steps first unzip & copy the D3 folder under proper path, 2nd import the reports .


    Best regards,
    Noel.
  • Hi Noel,

    I installed 'Jedox for Excel' and the 'Sandbox' on the client machines.
    All clients connect to the same server, on which I also developed the web frontend with the d3 sheets.

    Thank you for your advise with the d3 folder on the local client machines, but I'd rather avoid any additional work for the clients.

    I just can't figure out why the clients can connect to the reports and files on the server, but cannot refer to the d3 lib file which is also on the server.

    Right now I think I'll try a another approach without d3, or maybe try you suggestion.

    I'll let you know if I should find a solution for my lib problem.

    Thank you and best regards
  • You don't need to install the d3.js library at client machine, only need to install it on the server.
    In anycase your web page code will refer to server library - I had mentioned installing on client thinking your clients have server installed on their machine .

    can you share your page code along with path where you have put your javascript library file ?, private message if needed .

    Best regards,
    Noel.
  • One last question: when I edit my external html file, the widget does not update. I refresh the worksheet, tried the user mode, but the widget seems to use the former code.


    EDIT: okay I have fixed it, if I enter a value in the source area of the widget, then the exec() function is obviously triggered and the widget is updated.