ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

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

  • Creator
    Topic
  • #18112
    adriwan_kenoby
    adriwan_kenoby
    Participant

    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 : https://www.amcharts.com/demos/date-based-data/

    This is an example using requirejs : http://www.amcharts.com/tips/using-requirejs-with-amcharts/

    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
    Replies
  • #18133

    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:

    #18140
    adriwan_kenoby
    adriwan_kenoby
    Participant

    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 ?

    #18176
    adriwan_kenoby
    adriwan_kenoby
    Participant

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

    #18178
    adriwan_kenoby
    adriwan_kenoby
    Participant
    #32850
    adriwan_kenoby
    adriwan_kenoby
    Participant

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

    #32861
    adriwan_kenoby
    adriwan_kenoby
    Participant

    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.