• Resolved dryan1144

    (@dryan1144)


    Charts are empty when content is output on the frontend via the WP REST API.

    The containing div is present, but not the chart data itself:

    <div id="visualizer-185-1241877040" class="visualizer-front visualizer-front-185"></div>

    Is there a javascript callback that needs to be called in conjunction with my API call to grab the content?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Vytis

    (@bvytis)

    Hi @dryan1144,

    Please elaborate on how you are rendering charts. Does it work in the backend when you created a chart and only fails to render on the front-end?

    What’s the data source that you are using for your chart and what is the type of the chart? Thanks!

    Thread Starter dryan1144

    (@dryan1144)

    The charts are geo charts with a csv file data source. They render totally fine when they are output to a template statically using shortcodes.

    But, the charts do not load if this same content is dynamically loaded via AJAX.

    More specifically, I have several charts I’d like to show in a “tab” format on one page. If I insert all of the charts into the DOM at the same time, again using shortcodes, the charts will load but it is exceptionally slow. So I built a WP REST API endpoint that returns a specific chart’s output (using the same shortcode, but within an output buffer). When a tab is clicked, I make an AJAX call to grabs a specific chart’s output and then place it into the content area. At this point, I see the placeholder div of the requested chart, but the chart itself does not render

    Plugin Support Vytis

    (@bvytis)

    @dryan1144,

    Thank you for the confirmation.

    This is expected and we have this a feature request for our developers, however, we do not have a timeline when this will be implemented, unfortunately, so charts at this moment cannot be re-rendered without a page refresh with an AJAX call.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Charts are not initialized when loaded through REST API’ is closed to new replies.