tbl_chart.twig 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <script type="text/javascript">
  2. url_query = '{{ url_query }}';
  3. </script>
  4. {# Display Chart options #}
  5. <div id="div_view_options">
  6. <form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">
  7. {{ get_hidden_inputs(url_params) }}
  8. <fieldset>
  9. <legend>
  10. {% trans 'Display chart' %}
  11. </legend>
  12. <div class="chartOption">
  13. <div class="formelement">
  14. <input type="radio" name="chartType" value="bar" id="radio_bar">
  15. <label for ="radio_bar">{% trans %}Bar{% context %}Chart type{% endtrans %}</label>
  16. </div>
  17. <div class="formelement">
  18. <input type="radio" name="chartType" value="column" id="radio_column">
  19. <label for ="radio_column">{% trans %}Column{% context %}Chart type{% endtrans %}</label>
  20. </div>
  21. <div class="formelement">
  22. <input type="radio" name="chartType" value="line" id="radio_line" checked="checked">
  23. <label for ="radio_line">{% trans %}Line{% context %}Chart type{% endtrans %}</label>
  24. </div>
  25. <div class="formelement">
  26. <input type="radio" name="chartType" value="spline" id="radio_spline">
  27. <label for ="radio_spline">{% trans %}Spline{% context %}Chart type{% endtrans %}</label>
  28. </div>
  29. <div class="formelement">
  30. <input type="radio" name="chartType" value="area" id="radio_area">
  31. <label for ="radio_area">{% trans %}Area{% context %}Chart type{% endtrans %}</label>
  32. </div>
  33. <span class="span_pie hide">
  34. <input type="radio" name="chartType" value="pie" id="radio_pie">
  35. <label for ="radio_pie">{% trans %}Pie{% context %}Chart type{% endtrans %}</label>
  36. </span>
  37. <span class="span_timeline hide">
  38. <input type="radio" name="chartType" value="timeline" id="radio_timeline">
  39. <label for ="radio_timeline">{% trans %}Timeline{% context %}Chart type{% endtrans %}</label>
  40. </span>
  41. <span class="span_scatter hide">
  42. <input type="radio" name="chartType" value="scatter" id="radio_scatter">
  43. <label for ="radio_scatter">{% trans %}Scatter{% context %}Chart type{% endtrans %}</label>
  44. </span>
  45. <br><br>
  46. <span class="barStacked hide">
  47. <input type="checkbox" name="barStacked" value="1" id="checkbox_barStacked">
  48. <label for ="checkbox_barStacked">{% trans 'Stacked' %}</label>
  49. </span>
  50. <br><br>
  51. <label for ="chartTitle">{% trans 'Chart title:' %}</label>
  52. <input type="text" name="chartTitle" id="chartTitle">
  53. </div>
  54. {% set xaxis = null %}
  55. <div class="chartOption">
  56. <label for="select_chartXAxis">{% trans 'X-Axis:' %}</label>
  57. <select name="chartXAxis" id="select_chartXAxis">
  58. {% for idx, key in keys %}
  59. {% if xaxis is same as(null) %}
  60. {% set xaxis = idx %}
  61. {% endif %}
  62. {% if xaxis is same as(idx) %}
  63. <option value="{{ idx }}" selected="selected">{{ key }}</option>
  64. {% else %}
  65. <option value="{{ idx }}">{{ key }}</option>
  66. {% endif %}
  67. {% endfor %}
  68. </select>
  69. <br>
  70. <label for="select_chartSeries">
  71. {% trans 'Series:' %}
  72. </label>
  73. <select name="chartSeries" id="select_chartSeries" multiple="multiple">
  74. {% for idx, key in keys %}
  75. {% if fields_meta[idx].type in numeric_types %}
  76. {% if idx == xaxis and numeric_column_count > 1 %}
  77. <option value="{{ idx }}">{{ key }}</option>
  78. {% else %}
  79. <option value="{{ idx }}" selected="selected">{{ key }}</option>
  80. {% endif %}
  81. {% endif %}
  82. {% endfor %}
  83. </select>
  84. <input type="hidden" name="dateTimeCols" value="
  85. {% set date_time_types = ['date', 'datetime', 'timestamp'] %}
  86. {% for idx, key in keys %}
  87. {% if fields_meta[idx].type in date_time_types %}
  88. {{ idx ~ ' ' }}
  89. {% endif %}
  90. {% endfor %}">
  91. <input type="hidden" name="numericCols" value="
  92. {% for idx, key in keys %}
  93. {% if fields_meta[idx].type in numeric_types %}
  94. {{ idx ~ ' ' }}
  95. {% endif %}
  96. {% endfor %}">
  97. </div>
  98. <div class="chartOption">
  99. <label for="xaxis_panel">
  100. {% trans 'X-Axis label:' %}
  101. </label>
  102. <input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label" value="{{ xaxis == -1 ? 'X Values'|trans : keys[xaxis] }}">
  103. <br>
  104. <label for="yaxis_label">
  105. {% trans 'Y-Axis label:' %}
  106. </label>
  107. <input type="text" name="yaxis_label" id="yaxis_label" value="{% trans 'Y Values' %}">
  108. <br>
  109. </div>
  110. <div class="clearfloat"></div>
  111. <div>
  112. <input type="checkbox" id="chkAlternative" name="chkAlternative" value="alternativeFormat">
  113. <label for="chkAlternative">{% trans 'Series names are in a column' %}</label>
  114. <br>
  115. <label for="select_seriesColumn">
  116. {% trans 'Series column:' %}
  117. </label>
  118. <select name="chartSeriesColumn" id="select_seriesColumn" disabled>
  119. {% for idx, key in keys %}
  120. <option value="{{ idx }}"
  121. {% if idx == 1 %}
  122. selected="selected"
  123. {% endif %}>
  124. {{ key }}
  125. </option>
  126. {% set series_column = idx %}
  127. {% endfor %}
  128. </select>
  129. <label for="select_valueColumn">
  130. {% trans 'Value Column:' %}
  131. </label>
  132. <select name="chartValueColumn" id="select_valueColumn" disabled>
  133. {% set selected = false %}
  134. {% for idx, key in keys %}
  135. {% if fields_meta[idx].type in numeric_types %}
  136. {% if not selected and idx != xaxis and idx != series_column %}
  137. <option value="{{ idx }}" selected="selected">{{ key }}</option>
  138. {% set selected = true %}
  139. {% else %}
  140. <option value="{{ idx }}">{{ key }}</option>
  141. {% endif %}
  142. {% endif %}
  143. {% endfor %}
  144. </select>
  145. </div>
  146. {{ get_start_and_number_of_rows_panel(sql_query) }}
  147. <div class="clearfloat"></div>
  148. <div id="resizer" style="width:600px; height:400px;">
  149. <div style="position: absolute; right: 10px; top: 10px; cursor: pointer; z-index: 1000;">
  150. <a class="disableAjax" id="saveChart" href="#" download="chart.png">
  151. {{ get_image('b_saveimage', 'Save chart as image'|trans) }}
  152. </a>
  153. </div>
  154. <div id="querychart" dir="ltr">
  155. </div>
  156. </div>
  157. </fieldset>
  158. </form>
  159. </div>