You are here

visitors_jqplot.html.twig in Visitors 8.2

<div id="visitors_chart" style="width: {{ width }}px; height: {{ height }}px;"></div>



{{ attach_library('visitors/jqplot.pointLabels') }}
{{ attach_library('visitors/jqplot.categoryAxisRenderer') }}
{{ attach_library('visitors/jqplot.barRenderer') }}
{{ attach_library('visitors/jquery.jqplot') }}

<script type="text/javascript">
  jQuery(document).ready(function($){
    var s = [{{ y | raw }}];
    var ticks = [{{ x | raw }}];

    $.jqplot('visitors_chart', [s], {
      width: {{ width }},
      height: {{ height }},
      seriesDefaults: {
        renderer: $.jqplot.BarRenderer,
        pointLabels: { show: true }
      },
      axes: {
        xaxis: {
          renderer: $.jqplot.CategoryAxisRenderer,
          ticks: ticks
        }
      }
    });
  });
</script>

File

templates/visitors_jqplot.html.twig
View source
  1. <div id="visitors_chart" style="width: {{ width }}px; height: {{ height }}px;"></div>
  2. {{ attach_library('visitors/jqplot.pointLabels') }}
  3. {{ attach_library('visitors/jqplot.categoryAxisRenderer') }}
  4. {{ attach_library('visitors/jqplot.barRenderer') }}
  5. {{ attach_library('visitors/jquery.jqplot') }}
  6. <script type="text/javascript">
  7. jQuery(document).ready(function($){
  8. var s = [{{ y | raw }}];
  9. var ticks = [{{ x | raw }}];
  10. $.jqplot('visitors_chart', [s], {
  11. width: {{ width }},
  12. height: {{ height }},
  13. seriesDefaults: {
  14. renderer: $.jqplot.BarRenderer,
  15. pointLabels: { show: true }
  16. },
  17. axes: {
  18. xaxis: {
  19. renderer: $.jqplot.CategoryAxisRenderer,
  20. ticks: ticks
  21. }
  22. }
  23. });
  24. });
  25. </script>