ssossossosso

Forums

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

This topic contains 3 replies, has 3 voices, and was last updated by Madhur Madhur 1 year, 7 months ago.

  • Creator
    Topic
  • #17274
    Madhur
    Madhur
    Participant

    Hi,

    I have created a widget with Google Visualizations Gauge chart. The chart comes up, but I am having little problems. Please tell me what I am doing wrong.

    First the code to make sure that I have done everything correctly:

    dashboardchart.html.twig code:

    dashboard.yml code:

    Now the problems:
    1. When I try to add this widget in my dashboard by clicking on the Add button in the Add widget form, the add button keeps on rotating. I have to click on the close button and refresh the page. Then the widget is visible.
    2. The chart is hanging in the air, it doesn’t have the white container box around it. If I extend the twig template file from OroDashboardBundle:Dashboard:widget.html.twig, the the white container box comes up, but then the chart itself is not loaded and the whole dashboard page does not load.

    Please see the images below to understand exactly what I am taking about:
    When I try to add the widget:
    while adding a widget

    When the widget is added:
    after adding the widget

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #17305

    fred33
    Participant

    unfortunately I have no answer to give you, but I also try to use the google chart and I would like to know how you processes Thanks

    #17309
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, Madhur.

    This issue appears because widget component wasn’t initialized yet, so google widget was rendered before it – that’s why you have it separately from widget block.

    You should use JS components to render custom JS code in your widget. Here is example how it’s done for charts – feel free to use chart component as an example. Here is general documentation about JS page components.

    #17327
    Madhur
    Madhur
    Participant

    Hi Yevhen,

    What you said is right. The widget component was not getting initialized because I had not extended it from OroDashboardBundle:Dashboard:Widget.html.twig. But as soon as I extended it from that template the google.setOnLoadCallback would not fire. So I just copy pasted everything from the OroDashboardBundle:Dashboard:widget.html.twig file into my twig file. So now my twig file looks like this:

    And this is how my widget chart looks like. It is still work in progress, but I was able to get the chart working.

    widget chart

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

You must be logged in to reply to this topic.