linebarwfocuschart.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {# This template adds attributes unique
  2. to lineChart #}
  3. {% extends "content.html" %}
  4. {% block body %}
  5. {% block data %}
  6. data_{{ chart.name }}={{ chart.series_js|striptags }};
  7. {% endblock data %}
  8. {% block init %}
  9. {{super()}}
  10. {% endblock init %}
  11. {% block rendering_opts %}
  12. {{super()}}
  13. {% endblock rendering_opts %}
  14. {% block axes %}
  15. {{super()}}
  16. {% endblock axes %}
  17. {% block tooltip %}
  18. {{super()}}
  19. {% endblock tooltip %}
  20. chart.showLegend({{chart.show_legend|lower}});
  21. {# add custom chart attributes #}
  22. {% for attr, value in chart.chart_attr.items() %}
  23. {% if value is string and value.startswith(".") %}:
  24. chart.{{ attr }}{{ value }};
  25. {% else %}
  26. chart.{{ attr }}({{ value }});
  27. {% endif %}
  28. {% endfor %}
  29. {% if chart.x_axis_format == 'AM_PM' %}
  30. function get_am_pm(d){
  31. if (d > 12) {
  32. d = d - 12; return (String(d) + 'PM');
  33. }
  34. else {
  35. return (String(d) + 'AM');
  36. }
  37. };
  38. {% else %}
  39. chart.x(function(d,i) { return i });
  40. {% endif %}
  41. {% if chart.resize %}
  42. nv.utils.windowResize(chart.update);
  43. {% endif %}
  44. {% block inject %}
  45. {{super()}}
  46. {% endblock inject %}
  47. {% block extras %}
  48. {{ super () }}
  49. {% endblock extras %}
  50. {% block close %}
  51. });
  52. {% endblock close %}
  53. {% endblock body %}