• Resolved benspr

    (@benspr)


    Hi there!

    Title says it, mostly. I’d like to use the Highcharts Annotations Module to add callouts to a couple places on some of my charts, such as when the series crosses the x axis.

    Please let me know if you have any advice on how to do that within plugin files or simply the header of my wordpress page templates. Highcharts says to “Include the following file ‘modules/annotations.js’ after highcharts.js or highstock.js to enable annotations.” As a copy-and-paste coder, it would be helpful to know the ideal spot and syntax used to call that js file.

    I can probably handle editing the Highcharts theme file for the specific chart to add the annotation, but if you know of a quick way to arithmetically set the annotation to appear by when the series first crosses the x axis, I’d be much obliged.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author methnen

    (@methnen)

    @benspr I somehow missed this request earlier.

    I would use the m_chart_get_chart_start hook to enqueue the JS you need.

    Something like this would work:

    <?php 
    
    add_action( 'm_chart_get_chart_start', 'm_chart_get_chart_start_action', 10, 2 );
    
    public function m_chart_get_chart_start_action( $post_id, $args ) {
    	wp_enqueue( 'highcharts-annotations', URL_TO_ANNOTATIONS_JS_FILE, array( 'highcharts' ) );
    }
    
    ?>
    • This reply was modified 5 years, 1 month ago by methnen.
Viewing 1 replies (of 1 total)
  • The topic ‘Calling the Highcharts annotations module’ is closed to new replies.