tbl_chart.twig 8.0 KB

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