Permalink
Switch branches/tags
RELEASE_3_5_0 RELEASE_3_5_0RC2 RELEASE_3_5_0RC1 RELEASE_3_5_0BETA1 RELEASE_3_5_0ALPHA1 RELEASE_3_4_11 RELEASE_3_4_11RC1 RELEASE_3_4_10_2 RELEASE_3_4_10_1 RELEASE_3_4_10 RELEASE_3_4_10RC1 RELEASE_3_4_9 RELEASE_3_4_9RC1 RELEASE_3_4_8 RELEASE_3_4_8RC1 RELEASE_3_4_7_1 RELEASE_3_4_7 RELEASE_3_4_7RC1 RELEASE_3_4_6 RELEASE_3_4_6RC1 RELEASE_3_4_5 RELEASE_3_4_5RC1 RELEASE_3_4_4 RELEASE_3_4_4RC1 RELEASE_3_4_3_2 RELEASE_3_4_3_1 RELEASE_3_4_3 RELEASE_3_4_3RC1 RELEASE_3_4_2 RELEASE_3_4_2RC1 RELEASE_3_4_1 RELEASE_3_4_1RC1 RELEASE_3_4_0 RELEASE_3_4_0RC2 RELEASE_3_4_0RC1 RELEASE_3_4_0BETA4 RELEASE_3_4_0BETA3 RELEASE_3_4_0BETA2 RELEASE_3_4_0BETA1 RELEASE_3_4_0ALPHA2 RELEASE_3_4_0ALPHA1 RELEASE_3_3_10_5 RELEASE_3_3_10_4 RELEASE_3_3_10_3 RELEASE_3_3_10_2 RELEASE_3_3_10_1 RELEASE_3_3_10 RELEASE_3_3_10RC1 RELEASE_3_3_9_2 RELEASE_3_3_9_1 RELEASE_3_3_9 RELEASE_3_3_9RC1 RELEASE_3_3_8_1 RELEASE_3_3_8 RELEASE_3_3_8RC1 RELEASE_3_3_7 RELEASE_3_3_7RC1 RELEASE_3_3_6 RELEASE_3_3_6RC1 RELEASE_3_3_5_1 RELEASE_3_3_5 RELEASE_3_3_5RC1 RELEASE_3_3_4 RELEASE_3_3_4RC1 RELEASE_3_3_3 RELEASE_3_3_3RC1 RELEASE_3_3_2 RELEASE_3_3_2RC1 RELEASE_3_3_1 RELEASE_3_3_1RC1 RELEASE_3_3_0 RELEASE_3_3_0RC3 RELEASE_3_3_0RC2 RELEASE_3_3_0RC1 RELEASE_3_3_0BETA1 RELEASE_3_3_0ALPHA1 RELEASE_3_2_5 RELEASE_3_2_5RC2 RELEASE_3_2_5RC1 RELEASE_3_2_4 RELEASE_3_2_4RC1 RELEASE_3_2_3 RELEASE_3_2_3RC1 RELEASE_3_2_2_1 RELEASE_3_2_2 RELEASE_3_2_2RC1 RELEASE_3_2_0_1 RELEASE_3_2_0 RELEASE_3_2_0RC1 RELEASE_3_2_0BETA1 RELEASE_3_1_5 RELEASE_3_1_5RC1 RELEASE_3_1_4 RELEASE_3_1_4RC2 RELEASE_3_1_4RC1 RELEASE_3_1_3_2 RELEASE_3_1_3_1 RELEASE_3_1_3 RELEASE_3_1_3RC1 RELEASE_3_1_2
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
158 lines (145 sloc) 5.5 KB
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* handles creation of the chart
*
* @package PhpMyAdmin
*/
/**
*
*/
require_once 'libraries/common.inc.php';
$GLOBALS['js_include'][] = 'tbl_chart.js';
$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
/* < IE 9 doesn't support canvas natively */
if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
}
$GLOBALS['js_include'][] = 'canvg/canvg.js';
/**
* Runs common work
*/
if (strlen($GLOBALS['table'])) {
$url_params['goto'] = $cfg['DefaultTabTable'];
$url_params['back'] = 'tbl_sql.php';
include 'libraries/tbl_common.php';
include 'libraries/tbl_info.inc.php';
include 'libraries/tbl_links.inc.php';
} elseif (strlen($GLOBALS['db'])) {
$url_params['goto'] = $cfg['DefaultTabDatabase'];
$url_params['back'] = 'sql.php';
include 'libraries/db_common.inc.php';
include 'libraries/db_info.inc.php';
} else {
$url_params['goto'] = $cfg['DefaultTabServer'];
$url_params['back'] = 'sql.php';
include 'libraries/server_common.inc.php';
include 'libraries/server_links.inc.php';
}
/*
* Execute the query and return the result
*/
$data = array();
$result = PMA_DBI_try_query($sql_query);
while ($row = PMA_DBI_fetch_assoc($result)) {
$data[] = $row;
}
// get settings if any posted
$chartSettings = array();
if (PMA_isValid($_REQUEST['chartSettings'], 'array')) {
$chartSettings = $_REQUEST['chartSettings'];
}
$url_params['db'] = $GLOBALS['db'];
$url_params['reload'] = 1;
/**
* Displays the page
*/
// pma_token/url_query needed for chart export
?>
<script type="text/javascript">
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
url_query = '<?php echo $url_query;?>';
</script>
<!-- Display Chart options -->
<div id="div_view_options">
<form method="post" action="tbl_chart.php">
<?php echo PMA_generate_common_hidden_inputs($url_params); ?>
<fieldset>
<legend><?php echo __('Display chart'); ?></legend>
<div style="float:left;">
<input type="radio" name="chartType" value="bar" id="radio_bar" />
<label for ="radio_bar"><?php echo _pgettext('Chart type', 'Bar'); ?></label>
<input type="radio" name="chartType" value="column" id="radio_column" />
<label for ="radio_column"><?php echo _pgettext('Chart type', 'Column'); ?></label>
<input type="radio" name="chartType" value="line" id="radio_line" checked="checked" />
<label for ="radio_line"><?php echo _pgettext('Chart type', 'Line'); ?></label>
<input type="radio" name="chartType" value="spline" id="radio_spline" />
<label for ="radio_spline"><?php echo _pgettext('Chart type', 'Spline'); ?></label>
<input type="radio" name="chartType" value="pie" id="radio_pie" />
<label for ="radio_pie"><?php echo _pgettext('Chart type', 'Pie'); ?></label>
<span class="barStacked" style="display:none;">
<input type="checkbox" name="barStacked" value="1" id="checkbox_barStacked" />
<label for ="checkbox_barStacked"><?php echo __('Stacked'); ?></label>
</span>
<br>
<input type="text" name="chartTitle" value="<?php echo __('Chart title'); ?>">
<?php
$keys = array_keys($data[0]);
$yaxis = -1;
if (count($keys) > 1) { ?>
<br />
<label for="select_chartXAxis"><?php echo __('X-Axis:'); ?></label>
<select name="chartXAxis" id="select_chartXAxis">
<?php
foreach ($keys as $idx => $key) {
if ($yaxis == -1 && (($idx == count($data[0]) - 1) || preg_match("/(date|time)/i", $key))) {
echo '<option value="' . htmlspecialchars($idx) . '" selected="selected">' . htmlspecialchars($key) . '</option>';
$yaxis=$idx;
} else {
echo '<option value="' . htmlspecialchars($idx) . '">' . htmlspecialchars($key) . '</option>';
}
}
?>
</select><br />
<label for="select_chartSeries"><?php echo __('Series:'); ?></label>
<select name="chartSeries" id="select_chartSeries">
<option value="columns"><?php echo __('The remaining columns'); ?></option>
<?php
foreach ($keys as $idx => $key) {
echo '<option>' . htmlspecialchars($key) . '</option>';
}
?>
</select>
<?php
}
?>
</div>
<div style="float:left; padding-left:40px;">
<label for="xaxis_label"><?php echo __('X-Axis label:'); ?></label>
<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label"
value="<?php echo ($yaxis == -1) ? __('X Values') : htmlspecialchars($keys[$yaxis]); ?>" /><br />
<label for="yaxis_label"><?php echo __('Y-Axis label:'); ?></label>
<input type="text" name="yaxis_label" id="yaxis_label" value="<?php echo __('Y Values'); ?>" />
</div>
<p style="clear:both;">&nbsp;</p>
<div id="resizer" style="width:600px; height:400px;">
<div id="inner-resizer">
<div id="querychart" style="display:none;"></div>
</div>
</div>
</fieldset>
</form>
</div>
<script type="text/javascript">
//<![CDATA[
chart_data = <?php echo strtr(json_encode($data), array('<' => '&lt;', '>' => '&gt;')); ?>;
//]]>
</script>
<?php
/**
* Displays the footer
*/
require_once 'libraries/footer.inc.php';
?>