Forums OroPlatform OroPlatform – HTML, JavaScript, CSS, Design Questions javascript amChart as a page-component

This topic contains 6 replies, has 2 voices, and was last updated by  adriwan_kenoby 10 months, 3 weeks ago.

  • Creator
  • #29053


    Hi everybody,

    I am trying to use amCharts as page-component. I think that my probleme maybe is I don’t define dependencies correctly OR it’s because of the amChart code don’t respect the requirejs standard API , I need help to better undestood the front-end architecture.

    This is the inline code of an amChart :

    This is an example using requirejs :

    And this is my code for replace it as a page-component:

    The view.html.twig ( whose extend OroUIBundle:actions:view.html.twig and where sondeData is an associative array ) :

    And the yaml configuration file for requirejs :

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
  • #29054

    Hryhorii Hrebiniuk

    Hello @adriwan_kenoby,

    You did everything right, defining modules over requirejs.yml configuration. But this is not enough, amCharts needs init-function in shim configuration. And it is not possible to define a function in yml-configuration file. For such cases we have workaround, that allows us to configure requirejs in JavaScript syntax. See Runtime require.js main config extension.

    In other words, you have to define requirejs.config.js.twig in your bundle

    And declare this template file as content for requirejs_config_extend placeholder:



    Thanks a lot @Hryhorii,

    I had forgot to talk about that init function and in fact I had notice that it is not configurable in yaml file.

    In requirejs.config.js.twig should I use require.config({…}) instead of require() ?

    I have still an error on the rendering but it is in the amcharts.js file, their is an undefined element.

    Any idea ?



    My error was that i pass $elem in makeChart(), but this method use an id.




    My chart can’t be loaded since upgrade 2.0. I don’t understand why. What are the changes I have to make ?



    It seems that placeholders.yml is not loaded properly. I had move it under Resources/config/oro and it look like this :

    What is the problem ?

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.