| @@ -243,9 +243,14 @@ | ||
| 243 | 243 | <label class="gvnsql-inlinecheck"><input type="checkbox" name="guaven_sqlcharts_round_y_values" value="1" |
| 244 | 244 | <?php echo $gvnsql_meta('guaven_sqlcharts_round_y_values') !== '' ? 'checked' : ''; ?>> Show only round numbers on the Y axis</label> |
| 245 | 245 | <label class="gvnsql-inlinecheck"><input type="checkbox" name="guaven_sqlcharts_nostacked" value="1" |
| 246 | 246 | <?php echo $gvnsql_meta('guaven_sqlcharts_nostacked') !== '' ? 'checked' : ''; ?>> Disable stacking of multiple datasets (Bar charts)</label> |
| 247 | + <label class="gvnsql-inlinecheck"><input type="checkbox" name="guaven_sqlcharts_timeaxis" value="1" | |
| 248 | + <?php echo $gvnsql_meta('guaven_sqlcharts_timeaxis') !== '' ? 'checked' : ''; ?>> Scale X axis by date/time (Bar and Line charts)</label> | |
| 247 | 249 | </div> |
| 250 | + <p class="gvnsql-hint">Date/time scaling places each point by real elapsed time instead of equal steps. X values must be dates such as | |
| 251 | + <code>2024-02-23</code>, <code>2024-02</code>, <code>2024</code> or <code>2024-02-23 14:30</code>. If any X value is not a date, the normal axis is used. | |
| 252 | + Bars are sized from the closest pair of dates, so very uneven gaps produce thin bars.</p> | |
| 248 | 253 | |
| 249 | 254 | <h4 class="gvnsql-step">Remote MySQL database (optional)</h4> |
| 250 | 255 | <p class="gvnsql-hint">Leave all fields empty to use this WordPress site's own database.</p> |
| 251 | 256 | <div class="gvnsql-grid2"> |
| @@ -310,8 +315,20 @@ | ||
| 310 | 315 | </h4> |
| 311 | 316 | <p>Note: Shortcodes support width and height attributes, f.e. [gvn_schart<?php |
| 312 | 317 | echo esc_attr($postfix); |
| 313 | 318 | ?> id="1" width="500" height="400"]. Without attributes, the width/height from the Style tab is used. |
| 319 | +<?php | |
| 320 | + preg_match_all('/\{arg([0-9]+)\}/', guaven_sqlcharts_get_code($post->ID), $gvnsql_argtags); | |
| 321 | + $gvnsql_argtags = array_unique($gvnsql_argtags[1]); | |
| 322 | + sort($gvnsql_argtags); | |
| 323 | + if (!empty($gvnsql_argtags)) { | |
| 324 | + $gvnsql_argexample = ''; | |
| 325 | + foreach ($gvnsql_argtags as $gvnsql_argn) $gvnsql_argexample .= ' arg' . (int) $gvnsql_argn . '="..."'; | |
| 326 | +?> | |
| 327 | +<br><br><strong>This query uses shortcode arguments.</strong> Pass the values in the shortcode: | |
| 328 | +[gvn_schart<?php echo esc_attr($postfix); ?> id="<?php echo esc_attr($post->ID); ?>"<?php echo esc_html($gvnsql_argexample); ?>]. | |
| 329 | +The live preview below runs without them (every {arg} is 0), so check the real result on a page or post. | |
| 330 | +<?php } ?> | |
| 314 | 331 | </div> |
| 315 | 332 | <hr> |
| 316 | 333 | <h3 id="sqldemo" name="sqldemo">Live Preview <small style="font-weight:normal">(reflects the last saved state — press Update to refresh)</small></h3> |
| 317 | 334 | <?php |