PluginProbe
M Chart / 1.2.1
M Chart v1.2.1
2.3.2 2.3.1 2.3 2.2.2 2.2.1 2.2 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.10 1.10.1 1.11 1.11.1 1.11.2 1.12 1.2 1.2.1 1.3 1.3.1 1.3.2 All 53 releases
m-chart / components / templates / highcharts-chart.php

highcharts-chart.php in M Chart 1.2.1, at components/templates/highcharts-chart.php

55 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // If there's multiple instances of a chart on the page we don't want to redeclare this
3 // @TODO if the embeds end up being done via iframes this conditional won't be necessary anymore
4 if ( ! $this->options_set ) {
5 ?>
6 <script type="text/javascript">
7 (function( $ ) {
8 $( function() {
9 Highcharts.setOptions( <?php echo $this->unicode_aware_stripslashes( json_encode( $this->highcharts()->get_chart_options() ) ); ?>);
10 } );
11 })( jQuery );
12 </script>
13 <?php
14 $this->options_set = true;
15 }
16 ?>
17 <div id="m-chart-container-<?php echo absint( $post_id ); ?>" class="m-chart-container">
18 <div id="m-chart-<?php echo absint( $post_id ); ?>" class="m-chart"></div>
19 </div>
20 <script type="text/javascript">
21 var m_chart_highcharts_<?php echo absint( $post_id ); ?> = {
22 chart_args: <?php echo $this->unicode_aware_stripslashes( json_encode( $this->highcharts()->get_chart_args( $post_id, $args ) ) ); ?>,
23 post_id: <?php echo absint( $post_id ); ?>
24 };
25
26 (function( $ ) {
27 m_chart_highcharts_<?php echo absint( $post_id ); ?>.render_chart = function( ) {
28 $( '.m-chart' ).trigger({
29 type: 'render_start',
30 post_id: this.post_id
31 });
32
33 $( '#m-chart-' + this.post_id ).highcharts(
34 this.chart_args,
35 function( chart ) {
36 // Stuff to do after the chart has rendered goes here
37 <?php do_action( 'm_chart_post_render_javascript', $post_id, $args ); ?>
38
39 }
40 );
41
42 this.chart = $( '#m-chart-' + this.post_id ).highcharts();
43
44 $( '.m-chart' ).trigger({
45 type: 'render_done',
46 chart: this.chart,
47 post_id: this.post_id
48 });
49 };
50
51 $( function() {
52 m_chart_highcharts_<?php echo absint( $post_id ); ?>.render_chart();
53 } );
54 })( jQuery );
55 </script>