1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>Charts — phpMyAdmin 5.2.2 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/classic.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="copyright" title="Copyright" href="copyright.html" />
<link rel="next" title="Import and export" href="import_export.html" />
<link rel="prev" title="Relations" href="relations.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="import_export.html" title="Import and export"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="relations.html" title="Relations"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">phpMyAdmin 5.2.2 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="user.html" accesskey="U">User Guide</a> »</li>
<li class="nav-item nav-item-this"><a href="">Charts</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="charts">
<span id="id1"></span><h1>Charts<a class="headerlink" href="#charts" title="Permalink to this heading">¶</a></h1>
<div class="versionadded">
<p><span class="versionmodified added">New in version 3.4.0.</span></p>
</div>
<p>Since phpMyAdmin version 3.4.0, you can easily generate charts from a SQL query
by clicking the “Display chart” link in the “Query results operations” area.</p>
<img alt="_images/query_result_operations.png" src="_images/query_result_operations.png" />
<p>A window layer “Display chart” is shown in which you can customize the chart with the following options.</p>
<ul class="simple">
<li><p>Chart type: Allows you to choose the type of chart. Supported types are bar charts, column charts, line charts, spline charts, area charts, pie charts and timeline charts (only the chart types applicable for current series selection are offered).</p></li>
<li><p>X-axis: Allows to choose the field for the main axis.</p></li>
<li><p>Series: Allows to choose series for the chart. You can choose multiple series.</p></li>
<li><p>Title: Allows specifying a title for the chart which is displayed above the chart.</p></li>
<li><p>X-axis and Y-axis labels: Allows specifying labels for axes.</p></li>
<li><p>Start row and a number of rows: Allows generating charts only for a specified number of rows of the results set.</p></li>
</ul>
<img alt="_images/chart.png" src="_images/chart.png" />
<section id="chart-implementation">
<h2>Chart implementation<a class="headerlink" href="#chart-implementation" title="Permalink to this heading">¶</a></h2>
<p>Charts in phpMyAdmin are drawn using <a class="reference external" href="http://www.jqplot.com/">jqPlot</a> jQuery library.</p>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this heading">¶</a></h2>
<section id="pie-chart">
<h3>Pie chart<a class="headerlink" href="#pie-chart" title="Permalink to this heading">¶</a></h3>
<p>Query results for a simple pie chart can be generated with:</p>
<div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="s1">'Food'</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'expense'</span><span class="p">,</span>
<span class="w"> </span><span class="mi">1250</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'amount'</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'Accommodation'</span><span class="p">,</span><span class="w"> </span><span class="mi">500</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'Travel'</span><span class="p">,</span><span class="w"> </span><span class="mi">720</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'Misc'</span><span class="p">,</span><span class="w"> </span><span class="mi">220</span>
</pre></div>
</div>
<p>And the result of this query is:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>expense</p></th>
<th class="head"><p>amount</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Food</p></td>
<td><p>1250</p></td>
</tr>
<tr class="row-odd"><td><p>Accommodation</p></td>
<td><p>500</p></td>
</tr>
<tr class="row-even"><td><p>Travel</p></td>
<td><p>720</p></td>
</tr>
<tr class="row-odd"><td><p>Misc</p></td>
<td><p>220</p></td>
</tr>
</tbody>
</table>
<p>Choosing expense as the X-axis and amount in series:</p>
<img alt="_images/pie_chart.png" src="_images/pie_chart.png" />
</section>
<section id="bar-and-column-chart">
<h3>Bar and column chart<a class="headerlink" href="#bar-and-column-chart" title="Permalink to this heading">¶</a></h3>
<p>Both bar charts and column chats support stacking. Upon selecting one of these types a checkbox is displayed to select stacking.</p>
<p>Query results for a simple bar or column chart can be generated with:</p>
<div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span>
<span class="w"> </span><span class="s1">'ACADEMY DINOSAUR'</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'title'</span><span class="p">,</span>
<span class="w"> </span><span class="mf">0.99</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'rental_rate'</span><span class="p">,</span>
<span class="w"> </span><span class="mf">20.99</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'replacement_cost'</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'ACE GOLDFINGER'</span><span class="p">,</span><span class="w"> </span><span class="mf">4.99</span><span class="p">,</span><span class="w"> </span><span class="mf">12.99</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'ADAPTATION HOLES'</span><span class="p">,</span><span class="w"> </span><span class="mf">2.99</span><span class="p">,</span><span class="w"> </span><span class="mf">18.99</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'AFFAIR PREJUDICE'</span><span class="p">,</span><span class="w"> </span><span class="mf">2.99</span><span class="p">,</span><span class="w"> </span><span class="mf">26.99</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'AFRICAN EGG'</span><span class="p">,</span><span class="w"> </span><span class="mf">2.99</span><span class="p">,</span><span class="w"> </span><span class="mf">22.99</span>
</pre></div>
</div>
<p>And the result of this query is:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>title</p></th>
<th class="head"><p>rental_rate</p></th>
<th class="head"><p>replacement_cost</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ACADEMY DINOSAUR</p></td>
<td><p>0.99</p></td>
<td><p>20.99</p></td>
</tr>
<tr class="row-odd"><td><p>ACE GOLDFINGER</p></td>
<td><p>4.99</p></td>
<td><p>12.99</p></td>
</tr>
<tr class="row-even"><td><p>ADAPTATION HOLES</p></td>
<td><p>2.99</p></td>
<td><p>18.99</p></td>
</tr>
<tr class="row-odd"><td><p>AFFAIR PREJUDICE</p></td>
<td><p>2.99</p></td>
<td><p>26.99</p></td>
</tr>
<tr class="row-even"><td><p>AFRICAN EGG</p></td>
<td><p>2.99</p></td>
<td><p>22.99</p></td>
</tr>
</tbody>
</table>
<p>Choosing title as the X-axis and rental_rate and replacement_cost as series:</p>
<img alt="_images/column_chart.png" src="_images/column_chart.png" />
</section>
<section id="scatter-chart">
<h3>Scatter chart<a class="headerlink" href="#scatter-chart" title="Permalink to this heading">¶</a></h3>
<p>Scatter charts are useful in identifying the movement of one or more variable(s) compared to another variable.</p>
<p>Using the same data set from bar and column charts section and choosing replacement_cost as the X-axis and rental_rate in series:</p>
<img alt="_images/scatter_chart.png" src="_images/scatter_chart.png" />
</section>
<section id="line-spline-and-timeline-charts">
<h3>Line, spline and timeline charts<a class="headerlink" href="#line-spline-and-timeline-charts" title="Permalink to this heading">¶</a></h3>
<p>These charts can be used to illustrate trends in underlying data. Spline charts draw smooth lines while timeline charts draw X-axis taking the distances between the dates/time into consideration.</p>
<p>Query results for a simple line, spline or timeline chart can be generated with:</p>
<div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span>
<span class="w"> </span><span class="kt">DATE</span><span class="p">(</span><span class="s1">'2006-01-08'</span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'date'</span><span class="p">,</span>
<span class="w"> </span><span class="mi">2056</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'revenue'</span><span class="p">,</span>
<span class="w"> </span><span class="mi">1378</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="s1">'cost'</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="kt">DATE</span><span class="p">(</span><span class="s1">'2006-01-09'</span><span class="p">),</span><span class="w"> </span><span class="mi">1898</span><span class="p">,</span><span class="w"> </span><span class="mi">2301</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="kt">DATE</span><span class="p">(</span><span class="s1">'2006-01-15'</span><span class="p">),</span><span class="w"> </span><span class="mi">1560</span><span class="p">,</span><span class="w"> </span><span class="mi">600</span><span class="w"> </span><span class="k">UNION</span>
<span class="k">SELECT</span><span class="w"> </span><span class="kt">DATE</span><span class="p">(</span><span class="s1">'2006-01-17'</span><span class="p">),</span><span class="w"> </span><span class="mi">3457</span><span class="p">,</span><span class="w"> </span><span class="mi">1565</span>
</pre></div>
</div>
<p>And the result of this query is:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>date</p></th>
<th class="head"><p>revenue</p></th>
<th class="head"><p>cost</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>2016-01-08</p></td>
<td><p>2056</p></td>
<td><p>1378</p></td>
</tr>
<tr class="row-odd"><td><p>2006-01-09</p></td>
<td><p>1898</p></td>
<td><p>2301</p></td>
</tr>
<tr class="row-even"><td><p>2006-01-15</p></td>
<td><p>1560</p></td>
<td><p>600</p></td>
</tr>
<tr class="row-odd"><td><p>2006-01-17</p></td>
<td><p>3457</p></td>
<td><p>1565</p></td>
</tr>
</tbody>
</table>
<img alt="_images/line_chart.png" src="_images/line_chart.png" />
<img alt="_images/spline_chart.png" src="_images/spline_chart.png" />
<img alt="_images/timeline_chart.png" src="_images/timeline_chart.png" />
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Charts</a><ul>
<li><a class="reference internal" href="#chart-implementation">Chart implementation</a></li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#pie-chart">Pie chart</a></li>
<li><a class="reference internal" href="#bar-and-column-chart">Bar and column chart</a></li>
<li><a class="reference internal" href="#scatter-chart">Scatter chart</a></li>
<li><a class="reference internal" href="#line-spline-and-timeline-charts">Line, spline and timeline charts</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="relations.html"
title="previous chapter">Relations</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="import_export.html"
title="next chapter">Import and export</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/charts.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="import_export.html" title="Import and export"
>next</a> |</li>
<li class="right" >
<a href="relations.html" title="Relations"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">phpMyAdmin 5.2.2 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="user.html" >User Guide</a> »</li>
<li class="nav-item nav-item-this"><a href="">Charts</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© <a href="copyright.html">Copyright</a> 2012 - 2024, The phpMyAdmin devel team.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
</div>
</body>
</html>
|