tbl_chart.twig 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. {{ Url_getHiddenInputs(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. />
  92. <input type="hidden" name="numericCols" value="
  93. {% for idx, key in keys %}
  94. {% if fields_meta[idx].type in numeric_types %}
  95. {{ idx ~ ' ' }}
  96. {% endif %}
  97. {% endfor %}"
  98. />
  99. </div>
  100. <div class="chartOption">
  101. <label for="xaxis_panel">
  102. {% trans 'X-Axis label:' %}
  103. </label>
  104. <input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label" value="{{ xaxis == -1 ? 'X Values'|trans : keys[xaxis] }}" />
  105. <br />
  106. <label for="yaxis_label">
  107. {% trans 'Y-Axis label:' %}
  108. </label>
  109. <input type="text" name="yaxis_label" id="yaxis_label" value="{% trans 'Y Values' %}" />
  110. <br />
  111. </div>
  112. <div class="clearfloat"></div>
  113. <div>
  114. <input type="checkbox" id="chkAlternative" name="chkAlternative" value="alternativeFormat" />
  115. <label for="chkAlternative">{% trans 'Series names are in a column' %}</label>
  116. <br />
  117. <label for="select_seriesColumn">
  118. {% trans 'Series column:' %}
  119. </label>
  120. <select name="chartSeriesColumn" id="select_seriesColumn" disabled>
  121. {% for idx, key in keys %}
  122. <option value="{{ idx }}"
  123. {% if idx == 1 %}
  124. selected="selected"
  125. {% endif %}>
  126. {{ key }}
  127. </option>
  128. {% set series_column = idx %}
  129. {% endfor %}
  130. </select>
  131. <label for="select_valueColumn">
  132. {% trans 'Value Column:' %}
  133. </label>
  134. <select name="chartValueColumn" id="select_valueColumn" disabled>
  135. {% set selected = false %}
  136. {% for idx, key in keys %}
  137. {% if fields_meta[idx].type in numeric_types %}
  138. {% if not selected and idx != xaxis and idx != series_column %}
  139. <option value="{{ idx }}" selected="selected">{{ key }}</option>
  140. {% set selected = true %}
  141. {% else %}
  142. <option value="{{ idx }}">{{ key }}</option>
  143. {% endif %}
  144. {% endif %}
  145. {% endfor %}
  146. </select>
  147. </div>
  148. {{ Util_getStartAndNumberOfRowsPanel(sql_query) }}
  149. <div class="clearfloat"></div>
  150. <div id="resizer" style="width:600px; height:400px;">
  151. <div style="position: absolute; right: 10px; top: 10px; cursor: pointer; z-index: 1000;">
  152. <a class="disableAjax" id="saveChart" href="#" download="chart.png">
  153. {{ Util_getImage('b_saveimage', 'Save chart as image'|trans) }}
  154. </a>
  155. </div>
  156. <div id="querychart" dir="ltr">
  157. </div>
  158. </div>
  159. </fieldset>
  160. </form>
  161. </div>