apexcharter/articles/extra/shiny-integration.html

313 lines
71 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="apexcharter">
<title>Use in Shiny application • apexcharter</title>
<script src="../../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="../../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../../deps/Poppins-0.4.9/font.css" rel="stylesheet">
<!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../../pkgdown.js"></script><meta property="og:title" content="Use in Shiny application">
<meta property="og:description" content="apexcharter">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><div class="container">
<a class="navbar-brand me-2" href="../../index.html">apexcharter</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.4.1.9300</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="../../articles/apexcharter.html">Get started</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../reference/index.html">Reference</a>
</li>
<li class="active nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
<div class="dropdown-menu" aria-labelledby="dropdown-articles">
<a class="dropdown-item" href="../../articles/extra/advanced-configuration.html">Advanced configuration examples</a>
<a class="dropdown-item" href="../../articles/extra/chart-options.html">Customize chart options</a>
<a class="dropdown-item" href="../../articles/extra/facets.html">Create grid of charts</a>
<a class="dropdown-item" href="../../articles/extra/shiny-integration.html">Use in Shiny application</a>
<a class="dropdown-item" href="../../articles/extra/spark-box.html">Create boxes with sparklines</a>
<a class="dropdown-item" href="../../articles/extra/sync-charts.html">Synchronize charts with each other</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../../news/index.html">Changelog</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../../search.json" id="search-input" placeholder="Search for" autocomplete="off">
</form>
<ul class="navbar-nav">
<li class="nav-item">
<a class="external-link nav-link" href="https://github.com/dreamRs/apexcharter/" aria-label="github">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
</div>
</nav><div class="container template-article">
<script src="shiny-integration_files/htmlwidgets-1.6.4/htmlwidgets.js"></script><script src="shiny-integration_files/apexcharter-binding-0.4.1.9300/apexcharter.js"></script><div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>Use in Shiny application</h1>
<small class="dont-index">Source: <a href="https://github.com/dreamRs/apexcharter/blob/HEAD/vignettes/extra/shiny-integration.Rmd" class="external-link"><code>vignettes/extra/shiny-integration.Rmd</code></a></small>
<div class="d-none name"><code>shiny-integration.Rmd</code></div>
</div>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/dreamRs/apexcharter" class="external-link">apexcharter</a></span><span class="op">)</span></span></code></pre></div>
<div class="section level2">
<h2 id="charts">Charts<a class="anchor" aria-label="anchor" href="#charts"></a>
</h2>
<div class="section level3">
<h3 id="create-and-update-or-destroy-and-re-create">Create and update (or destroy and re-create)<a class="anchor" aria-label="anchor" href="#create-and-update-or-destroy-and-re-create"></a>
</h3>
<p>When a graph has been generated in Shiny, if the values change (via a
reactive function), the graph is <em>not regenerated</em>, only the data
is <em>updated</em>. If you have changed specific options in the graphic
(such as maximum y axis value, charts title, …) these will not be
updated. This behavior can be controlled with <code>auto_update</code>
argument (available in <code><a href="../../reference/apexchart.html">apexchart()</a></code> and <code><a href="../../reference/apex.html">apex()</a></code>)
:</p>
<p>By default, <code>auto_update</code> is <code>TRUE</code> :</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">...</span>, auto_update <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
<p>If you want to re-create the whole chart, set the option to
<code>FALSE</code>:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">...</span>, auto_update <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<p>You can also use <code><a href="../../reference/config_update.html">config_update()</a></code> to specify what to
update :</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">...</span>, auto_update <span class="op">=</span> <span class="fu"><a href="../../reference/config_update.html">config_update</a></span><span class="op">(</span>update_options <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="proxy">Proxy<a class="anchor" aria-label="anchor" href="#proxy"></a>
</h3>
<p>A proxy is also implemented to update charts manually server-side.
You can update data:</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">output</span><span class="op">$</span><span class="va">my_chart</span> <span class="op">&lt;-</span> <span class="fu"><a href="../../reference/apexcharter-shiny.html">renderApexchart</a></span><span class="op">(</span><span class="op">{</span></span>
<span> <span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span>data <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/pkg/shiny/man/isolate.html" class="external-link">isolate</a></span><span class="op">(</span><span class="fu">data_reactive</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>, <span class="va">...</span>, auto_update <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="op">}</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/pkg/shiny/man/observeEvent.html" class="external-link">observeEvent</a></span><span class="op">(</span><span class="va">input</span><span class="op">$</span><span class="va">update</span>, <span class="op">{</span></span>
<span> <span class="fu"><a href="../../reference/apexchartProxy.html">apexchartProxy</a></span><span class="op">(</span><span class="st">"my_chart"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/ax_proxy_series.html">ax_proxy_series</a></span><span class="op">(</span><span class="fu">data_reactive</span><span class="op">(</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="op">}</span><span class="op">)</span></span></code></pre></div>
<p>Be sure to use <code><a href="https://rdrr.io/pkg/shiny/man/isolate.html" class="external-link">shiny::isolate()</a></code> to block any reactivity
in <code>renderApexchart</code> function and to set
<code>auto_update</code> to FALSE to prevent updating twice. Then you
can use in an observe function (or any reactive function)
<code><a href="../../reference/apexchartProxy.html">apexchartProxy()</a></code> with the output id to get the chart
instance and <code><a href="../../reference/ax_proxy_series.html">ax_proxy_series()</a></code> to update data.</p>
<p>If you want to update charts options, use :</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/pkg/shiny/man/observeEvent.html" class="external-link">observeEvent</a></span><span class="op">(</span><span class="va">input</span><span class="op">$</span><span class="va">update</span>, <span class="op">{</span></span>
<span> <span class="fu"><a href="../../reference/apexchartProxy.html">apexchartProxy</a></span><span class="op">(</span><span class="st">"my_chart"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/ax_proxy_options.html">ax_proxy_options</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
<span> title <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
<span> text <span class="op">=</span> <span class="st">"New title"</span></span>
<span> <span class="op">)</span>,</span>
<span> xaxis <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span></span>
<span> max <span class="op">=</span> <span class="va">NEW_VALUE</span></span>
<span> <span class="op">)</span></span>
<span> <span class="op">)</span><span class="op">)</span></span>
<span><span class="op">}</span><span class="op">)</span></span></code></pre></div>
</div>
</div>
<div class="section level2">
<h2 id="interactions">Interactions<a class="anchor" aria-label="anchor" href="#interactions"></a>
</h2>
<div class="section level3">
<h3 id="click">Click<a class="anchor" aria-label="anchor" href="#click"></a>
</h3>
<p>Click on a chart to select a data point and retrieve value server
side with <code><a href="../../reference/set_input_click.html">set_input_click()</a></code> :</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span>
<span> month <span class="op">=</span> <span class="va">month.abb</span>,</span>
<span> value <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">100</span>, <span class="fl">12</span><span class="op">)</span></span>
<span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">month</span>, <span class="va">value</span><span class="op">)</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/ax_title.html">ax_title</a></span><span class="op">(</span><span class="st">"Click a bar:"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_click.html">set_input_click</a></span><span class="op">(</span><span class="st">"click"</span><span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-a16f7eccd3427b39c459" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-a16f7eccd3427b39c459">{"x":{"ax_opts":{"chart":{"type":"bar"},"series":[{"name":"value","type":"bar","data":[{"x":"Jan","y":51},{"x":"Feb","y":97},{"x":"Mar","y":45},{"x":"Apr","y":93},{"x":"May","y":47},{"x":"Jun","y":41},{"x":"Jul","y":85},{"x":"Aug","y":64},{"x":"Sep","y":66},{"x":"Oct","y":70},{"x":"Nov","y":17},{"x":"Dec","y":39}]}],"dataLabels":{"enabled":false},"plotOptions":{"bar":{"horizontal":false,"isDumbbell":false}},"tooltip":{"shared":true,"intersect":false,"followCursor":true},"grid":{"yaxis":{"lines":{"show":true}},"xaxis":{"lines":{"show":false}}},"yaxis":{"labels":{"style":{"colors":"#848484"}}},"xaxis":{"labels":{"style":{"colors":"#848484"}}},"title":{"text":"Click a bar:"},"states":{"active":{"allowMultipleDataPointsSelection":false,"filter":{"type":"darken","value":0.35}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":"Apr","max":"Sep"},"type":"column","shinyEvents":{"click":{"inputId":"click"}}},"evals":[],"jsHooks":[]}</script><p>Value server-side will be available through
<code>input$click</code>.</p>
<p>Depending on the type of graphic, you can retrieve :</p>
<ul>
<li>
<strong>bar and column:</strong> category (x-axis).</li>
<li>
<strong>pie and donut:</strong> label.</li>
<li>
<strong>time-series:</strong> retrieve x-axis value, you have to
display markers with size &gt; 0 and set tooltips options
<code>intersect = TRUE</code> and <code>shared = FALSE</code>.</li>
<li>
<strong>scatter:</strong> retrieve XY coordinates.</li>
</ul>
<p>Multiple selection is possible and you can change the darken effect
of selected bars :</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span>
<span> month <span class="op">=</span> <span class="va">month.abb</span>,</span>
<span> value <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">100</span>, <span class="fl">12</span><span class="op">)</span></span>
<span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">month</span>, <span class="va">value</span><span class="op">)</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/ax_title.html">ax_title</a></span><span class="op">(</span><span class="st">"Click several bars:"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_click.html">set_input_click</a></span><span class="op">(</span></span>
<span> inputId <span class="op">=</span> <span class="st">"click"</span>, </span>
<span> multiple <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span> effect_value <span class="op">=</span> <span class="fl">0.1</span></span>
<span> <span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-d8a59172ac5f2564b238" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-d8a59172ac5f2564b238">{"x":{"ax_opts":{"chart":{"type":"bar"},"series":[{"name":"value","type":"bar","data":[{"x":"Jan","y":34},{"x":"Feb","y":77},{"x":"Mar","y":84},{"x":"Apr","y":67},{"x":"May","y":58},{"x":"Jun","y":69},{"x":"Jul","y":90},{"x":"Aug","y":89},{"x":"Sep","y":38},{"x":"Oct","y":18},{"x":"Nov","y":45},{"x":"Dec","y":92}]}],"dataLabels":{"enabled":false},"plotOptions":{"bar":{"horizontal":false,"isDumbbell":false}},"tooltip":{"shared":true,"intersect":false,"followCursor":true},"grid":{"yaxis":{"lines":{"show":true}},"xaxis":{"lines":{"show":false}}},"yaxis":{"labels":{"style":{"colors":"#848484"}}},"xaxis":{"labels":{"style":{"colors":"#848484"}}},"title":{"text":"Click several bars:"},"states":{"active":{"allowMultipleDataPointsSelection":true,"filter":{"type":"darken","value":0.1}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":"Apr","max":"Sep"},"type":"column","shinyEvents":{"click":{"inputId":"click"}}},"evals":[],"jsHooks":[]}</script><p>More examples are available with:</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/run_demo_input.html">run_demo_input</a></span><span class="op">(</span><span class="st">"click"</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="zoom">Zoom<a class="anchor" aria-label="anchor" href="#zoom"></a>
</h3>
<p>Retrieve the coordinates of the axes when the graph is zoomed in:</p>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="st">"economics"</span>, package <span class="op">=</span> <span class="st">"ggplot2"</span><span class="op">)</span></span>
<span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">economics</span>, <span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">date</span>, <span class="va">psavert</span><span class="op">)</span>, type <span class="op">=</span> <span class="st">"line"</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_zoom.html">set_input_zoom</a></span><span class="op">(</span><span class="st">"zoom"</span><span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-3e0312e5aee8f694a0b9" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-3e0312e5aee8f694a0b9">{"x":{"ax_opts":{"chart":{"type":"line"},"series":[{"name":"psavert","type":"line","data":[[-79056000000,12.6],[-76377600000,12.6],[-73699200000,11.9],[-71107200000,12.9],[-68428800000,12.8],[-65836800000,11.8],[-63158400000,11.7],[-60480000000,12.3],[-57974400000,11.7],[-55296000000,12.3],[-52704000000,12],[-50025600000,11.7],[-47433600000,10.7],[-44755200000,10.5],[-42076800000,10.6],[-39484800000,10.8],[-36806400000,10.6],[-34214400000,11.1],[-31536000000,10.3],[-28857600000,9.699999999999999],[-26438400000,10.2],[-23760000000,9.699999999999999],[-21168000000,10.1],[-18489600000,11.1],[-15897600000,11.8],[-13219200000,11.5],[-10540800000,11.6],[-7948800000,11.4],[-5270400000,11.6],[-2678400000,11.8],[0,11.8],[2678400000,11.7],[5097600000,12.4],[7776000000,13.3],[10368000000,12.4],[13046400000,12.3],[15638400000,13.5],[18316800000,13.4],[20995200000,12.9],[23587200000,13.1],[26265600000,13.6],[28857600000,13.2],[31536000000,13.3],[34214400000,13.3],[36633600000,13.5],[39312000000,13.2],[41904000000,13.6],[44582400000,14.7],[47174400000,13.8],[49852800000,13.6],[52531200000,13.3],[55123200000,13.3],[57801600000,13.1],[60393600000,13],[63072000000,12.5],[65750400000,12.8],[68256000000,11.8],[70934400000,11.5],[73526400000,11.7],[76204800000,11.7],[78796800000,11.7],[81475200000,12],[84153600000,12.2],[86745600000,13],[89424000000,13.6],[92016000000,13.7],[94694400000,12.4],[97372800000,12.5],[99792000000,12.7],[102470400000,13.2],[105062400000,13.2],[107740800000,13.6],[110332800000,13.2],[113011200000,13.9],[115689600000,13.1],[118281600000,14.4],[120960000000,14.4],[123552000000,14.8],[126230400000,14.3],[128908800000,14.2],[131328000000,13.4],[134006400000,13.1],[136598400000,12.8],[139276800000,12.8],[141868800000,12.8],[144547200000,12.1],[147225600000,12.9],[149817600000,13.4],[152496000000,13.8],[155088000000,14],[157766400000,13.2],[160444800000,12.5],[162864000000,12.7],[165542400000,14.2],[168134400000,17.3],[170812800000,14.3],[173404800000,12.6],[176083200000,13],[178761600000,13],[181353600000,13.4],[184032000000,12.7],[186624000000,12],[189302400000,11.7],[191980800000,12.3],[194486400000,12.2],[197164800000,11.7],[199756800000,12.3],[202435200000,11.4],[205027200000,11.7],[207705600000,11.7],[210384000000,11.4],[212976000000,11.1],[215654400000,11.4],[218246400000,10.6],[220924800000,10.6],[223603200000,9.300000000000001],[226022400000,10.5],[228700800000,10.5],[231292800000,10.3],[233971200000,10.6],[236563200000,10.5],[239241600000,10.9],[241920000000,11.1],[244512000000,11],[247190400000,11.2],[249782400000,11.4],[252460800000,11.9],[255139200000,11.1],[257558400000,11],[260236800000,10.8],[262828800000,10.3],[265507200000,10],[268099200000,10.9],[270777600000,10.5],[273456000000,10.6],[276048000000,10.7],[278726400000,10.5],[281318400000,10.4],[283996800000,11.1],[286675200000,11.1],[289094400000,11.2],[291772800000,11],[294364800000,10.3],[297043200000,9.9],[299635200000,10.6],[302313600000,9.699999999999999],[304992000000,9.4],[307584000000,9.699999999999999],[310262400000,9.699999999999999],[312854400000,10.1],[315532800000,9.9],[318211200000,10.1],[320716800000,10.2],[323395200000,11.3],[325987200000,11.4],[328665600000,11.2],[331257600000,11.3],[333936000000,11.3],[336614400000,11.7],[339206400000,11.3],[341884800000,11.6],[344476800000,11.4],[347155200000,10.9],[349833600000,10.8],[352252800000,10.8],[354931200000,10.9],[357523200000,11],[360201600000,10.8],[362793600000,12.3],[365472000000,12],[368150400000,12.4],[370742400000,13],[373420800000,13.2],[376012800000,12.5],[378691200000,12.7],[381369600000,12.1],[383788800000,12.2],[386467200000,12.9],[389059200000,12.3],[391737600000,12.3],[394329600000,12.5],[397008000000,12.6],[399686400000,11.8],[402278400000,11.3],[404956800000,10.9],[407548800000,10.9],[410227200000,11.1],[412905600000,11.1],[415324800000,10.6],[418003200000,10.3],[420595200000,9.9],[423273600000,9.1],[425865600000,9.6],[428544000000,9.199999999999999],[431222400000,9.6],[433814400000,9.699999999999999],[436492800000,10.3],[439084800000,10.1],[441763200000,10],[444441600000,11.7],[446947200000,11.5],[449625600000,11.5],[452217600000,11.1],[454896000000,11.1],[457488000000,11.6],[460166400000,11.8],[462844800000,11.8],[465436800000,11.7],[468115200000,10.9],[470707200000,11.2],[473385600000,10.3],[476064000000,9.1],[478483200000,8.699999999999999],[481161600000,9.9],[483753600000,11.1],[486432000000,9.6],[489024000000,9.1],[491702400000,8.199999999999999],[494380800000,7.3],[496972800000,9.1],[499651200000,9],[502243200000,8.6],[504921600000,8.6],[507600000000,9.300000000000001],[510019200000,9.9],[512697600000,9.699999999999999],[515289600000,9.300000000000001],[517968000000,9.4],[520560000000,9.300000000000001],[523238400000,9],[525916800000,7.2],[528508800000,8.4],[531187200000,8.800000000000001],[533779200000,7],[536457600000,9.699999999999999],[539136000000,8.5],[541555200000,8.5],[544233600000,4.5],[546825600000,8.199999999999999],[549504000000,7.7],[552096000000,7.5],[554774400000,7.2],[557452800000,7.6],[560044800000,8.300000000000001],[562723200000,8.5],[565315200000,8.699999999999999],[567993600000,8.1],[570672000000,8.6],[573177600000,8.199999999999999],[575856000000,8.800000000000001],[578448000000,8.4],[581126400000,8.4],[583718400000,8.6],[586396800000,8.4],[589075200000,8.9],[591667200000,8.6],[594345600000,8.4],[596937600000,8.300000000000001],[599616000000,8.5],[602294400000,9],[604713600000,9.5],[607392000000,8.4],[609984000000,8.1],[612662400000,8.199999999999999],[615254400000,8.199999999999999],[617932800000,7.6],[620611200000,8.1],[623203200000,8.5],[625881600000,8.6],[628473600000,7.8],[631152000000,8],[633830400000,8.6],[636249600000,8.300000000000001],[638928000000,8.800000000000001],[641520000000,8.699999999999999],[644198400000,8.6],[646790400000,8.699999999999999],[649468800000,8.1],[652147200000,8.1],[654739200000,7.8],[657417600000,7.9],[660009600000,8.800000000000001],[662688000000,9.300000000000001],[665366400000,8.800000000000001],[667785600000,8],[670464000000,8.6],[673056000000,8.4],[675734400000,8.9],[678326400000,8.199999999999999],[681004800000,8.6],[683683200000,8.800000000000001],[686275200000,9.300000000000001],[688953600000,9],[691545600000,9.699999999999999],[694224000000,9.4],[696902400000,9.800000000000001],[699408000000,9.699999999999999],[702086400000,9.9],[704678400000,9.9],[707356800000,10.1],[709948800000,9.6],[712627200000,9.699999999999999],[715305600000,8.699999999999999],[717897600000,8],[720576000000,8],[723168000000,10.6],[725846400000,8.6],[728524800000,8.9],[730944000000,8.9],[733622400000,8.699999999999999],[736214400000,8.300000000000001],[738892800000,7.8],[741484800000,7.6],[744163200000,7.7],[746841600000,6.9],[749433600000,6.3],[752112000000,6.3],[754704000000,9.1],[757382400000,7.1],[760060800000,6.5],[762480000000,6.8],[765158400000,6.4],[767750400000,7.6],[770428800000,6.9],[773020800000,7],[775699200000,6.5],[778377600000,6.8],[780969600000,7.1],[783648000000,7],[786240000000,7.2],[788918400000,7.5],[791596800000,7.8],[794016000000,7.5],[796694400000,6.9],[799286400000,7.1],[801964800000,6.7],[804556800000,7.1],[807235200000,6.7],[809913600000,6.8],[812505600000,7.1],[815184000000,6.6],[817776000000,6.1],[820454400000,6.7],[823132800000,6.7],[825638400000,6.6],[828316800000,5.7],[830908800000,6.7],[833587200000,7.1],[836179200000,6.7],[838857600000,6.6],[841536000000,6.7],[844128000000,6.4],[846806400000,6.4],[849398400000,6.4],[852076800000,6.2],[854755200000,6.2],[857174400000,6.4],[859852800000,6.5],[862444800000,6.8],[865123200000,6.6],[867715200000,6.1],[870393600000,6],[873072000000,6.2],[875664000000,6.2],[878342400000,6.4],[880934400000,6.4],[883612800000,7.4],[886291200000,7.4],[888710400000,7.5],[891388800000,7.2],[893980800000,6.9],[896659200000,6.8],[899251200000,6.9],[901929600000,6.8],[904608000000,6.4],[907200000000,6.2],[909878400000,6.3],[912470400000,5.8],[915148800000,6.4],[917827200000,6.2],[920246400000,5.9],[922924800000,5.2],[925516800000,4.9],[928195200000,4.8],[930787200000,4.8],[933465600000,4.7],[936144000000,4.2],[938736000000,4.6],[941414400000,4.8],[944006400000,4.4],[946684800000,5.4],[949363200000,4.8],[951868800000,4.5],[954547200000,5],[957139200000,4.9],[959817600000,4.9],[962409600000,5.2],[965088000000,5.2],[967766400000,4.5],[970358400000,4.6],[973036800000,4.5],[975628800000,4.2],[978307200000,4.8],[980985600000,4.9],[983404800000,5.3],[986083200000,5],[988675200000,4.5],[991353600000,4.5],[993945600000,5.6],[996624000000,6.8],[999302400000,7],[1001894400000,3.4],[1004572800000,4.1],[1007164800000,4.5],[1009843200000,6.1],[1012521600000,5.8],[1014940800000,5.9],[1017619200000,5.8],[1020211200000,6.5],[1022889600000,6.4],[1025481600000,5.5],[1028160000000,5.4],[1030838400000,5.7],[1033430400000,5.7],[1036108800000,5.7],[1038700800000,5.5],[1041379200000,5.5],[1044057600000,5.6],[1046476800000,5.3],[1049155200000,5.3],[1051747200000,5.8],[1054425600000,5.6],[1057017600000,6.3],[1059696000000,6],[1062374400000,5.2],[1064966400000,5.3],[1067644800000,5.4],[1070236800000,5.4],[1072915200000,5],[1075593600000,5],[1078099200000,4.9],[1080777600000,5.3],[1083369600000,5.3],[1086048000000,5.8],[1088640000000,5.3],[1091318400000,5.2],[1093996800000,4.6],[1096588800000,4.5],[1099267200000,4.1],[1101859200000,6.9],[1104537600000,3.7],[1107216000000,3.4],[1109635200000,3.6],[1112313600000,3.1],[1114905600000,3.5],[1117584000000,2.9],[1120176000000,2.2],[1122854400000,2.7],[1125532800000,2.7],[1128124800000,3.1],[1130803200000,3.5],[1133395200000,3.7],[1136073600000,4.2],[1138752000000,4.2],[1141171200000,4.2],[1143849600000,4],[1146441600000,3.8],[1149120000000,4],[1151712000000,3.4],[1154390400000,3.6],[1157068800000,3.6],[1159660800000,3.6],[1162339200000,3.9],[1164931200000,3.7],[1167609600000,3.7],[1170288000000,4.1],[1172707200000,4.4],[1175385600000,4.2],[1177977600000,4],[1180656000000,3.8],[1183248000000,3.7],[1185926400000,3.4],[1188604800000,3.5],[1191196800000,3.4],[1193875200000,3.1],[1196467200000,3.6],[1199145600000,3.7],[1201824000000,4.1],[1204329600000,4],[1207008000000,3.4],[1209600000000,7.8],[1212278400000,5.5],[1214870400000,4.4],[1217548800000,3.8],[1220227200000,4.7],[1222819200000,5.5],[1225497600000,6.4],[1228089600000,6.4],[1230768000000,6.2],[1233446400000,5.5],[1235865600000,5.9],[1238544000000,6.8],[1241136000000,8.199999999999999],[1243814400000,6.7],[1246406400000,6],[1249084800000,4.9],[1251763200000,5.9],[1254355200000,5.4],[1257033600000,5.9],[1259625600000,5.9],[1262304000000,6.1],[1264982400000,5.8],[1267401600000,5.7],[1270080000000,6.4],[1272672000000,7],[1275350400000,6.9],[1277942400000,6.8],[1280620800000,6.9],[1283299200000,6.7],[1285891200000,6.6],[1288569600000,6.6],[1291161600000,7.1],[1293840000000,7.4],[1296518400000,7.6],[1298937600000,7],[1301616000000,6.9],[1304208000000,6.9],[1306886400000,7.2],[1309478400000,7.3],[1312156800000,7.2],[1314835200000,6.8],[1317427200000,6.8],[1320105600000,7],[1322697600000,7.8],[1325376000000,8],[1328054400000,8],[1330560000000,8.5],[1333238400000,8.699999999999999],[1335830400000,8.800000000000001],[1338508800000,9.1],[1341100800000,8.199999999999999],[1343779200000,8],[1346457600000,8.199999999999999],[1349049600000,8.800000000000001],[1351728000000,9.699999999999999],[1354320000000,12],[1356998400000,6.3],[1359676800000,5.8],[1362096000000,5.9],[1364774400000,6.4],[1367366400000,6.7],[1370044800000,6.8],[1372636800000,6.6],[1375315200000,6.7],[1377993600000,6.8],[1380585600000,6.3],[1383264000000,6.2],[1385856000000,6.4],[1388534400000,7.1],[1391212800000,7.3],[1393632000000,7.4],[1396310400000,7.4],[1398902400000,7.4],[1401580800000,7.4],[1404172800000,7.5],[1406851200000,7.2],[1409529600000,7.4],[1412121600000,7.2],[1414800000000,7.3],[1417392000000,7.6],[1420070400000,7.7],[1422748800000,7.9],[1425168000000,7.4],[1427846400000,7.6]]}],"dataLabels":{"enabled":false},"stroke":{"curve":"straight","width":2},"yaxis":{"decimalsInFloat":2,"labels":{"style":{"colors":"#848484"}}},"xaxis":{"type":"datetime","labels":{"style":{"colors":"#848484"}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":"1967-07-01","max":"2015-04-01"},"type":"line","shinyEvents":{"zoomed":{"inputId":"zoom"}}},"evals":[],"jsHooks":[]}</script><p>Value server-side will be available through <code>input$zoom</code>
under the form :</p>
<pre><code><span><span class="co">#&gt; $x</span></span>
<span><span class="co">#&gt; $x$min</span></span>
<span><span class="co">#&gt; [1] "1981-10-24 15:41:16 UTC"</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $x$max</span></span>
<span><span class="co">#&gt; [1] "1992-01-24 06:40:22 UTC"</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $y</span></span>
<span><span class="co">#&gt; $y$min</span></span>
<span><span class="co">#&gt; NULL</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $y$max</span></span>
<span><span class="co">#&gt; NULL</span></span></code></pre>
<p>Here values for <code>y</code> are <code>NULL</code> because zoom is
only possible on x-axis, but for a scatter chart for example you can
zoom on both axis.</p>
<p>More examples are available with:</p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/run_demo_input.html">run_demo_input</a></span><span class="op">(</span><span class="st">"zoom"</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="selection">Selection<a class="anchor" aria-label="anchor" href="#selection"></a>
</h3>
<p>Retrieve the coordinates of the axes when user select an area on a
chart (without zooming):</p>
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">economics</span>, <span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">date</span>, <span class="va">psavert</span><span class="op">)</span>, type <span class="op">=</span> <span class="st">"line"</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_selection.html">set_input_selection</a></span><span class="op">(</span><span class="st">"selection"</span><span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-6056bd1294ebb932a75e" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-6056bd1294ebb932a75e">{"x":{"ax_opts":{"chart":{"type":"line","selection":{"enabled":true,"type":"x","fill":{"color":"#24292e","opacity":0.1},"stroke":{"width":1,"dashArray":3,"color":"#24292e","opacity":0.4}},"toolbar":{"autoSelected":"selection"}},"series":[{"name":"psavert","type":"line","data":[[-79056000000,12.6],[-76377600000,12.6],[-73699200000,11.9],[-71107200000,12.9],[-68428800000,12.8],[-65836800000,11.8],[-63158400000,11.7],[-60480000000,12.3],[-57974400000,11.7],[-55296000000,12.3],[-52704000000,12],[-50025600000,11.7],[-47433600000,10.7],[-44755200000,10.5],[-42076800000,10.6],[-39484800000,10.8],[-36806400000,10.6],[-34214400000,11.1],[-31536000000,10.3],[-28857600000,9.699999999999999],[-26438400000,10.2],[-23760000000,9.699999999999999],[-21168000000,10.1],[-18489600000,11.1],[-15897600000,11.8],[-13219200000,11.5],[-10540800000,11.6],[-7948800000,11.4],[-5270400000,11.6],[-2678400000,11.8],[0,11.8],[2678400000,11.7],[5097600000,12.4],[7776000000,13.3],[10368000000,12.4],[13046400000,12.3],[15638400000,13.5],[18316800000,13.4],[20995200000,12.9],[23587200000,13.1],[26265600000,13.6],[28857600000,13.2],[31536000000,13.3],[34214400000,13.3],[36633600000,13.5],[39312000000,13.2],[41904000000,13.6],[44582400000,14.7],[47174400000,13.8],[49852800000,13.6],[52531200000,13.3],[55123200000,13.3],[57801600000,13.1],[60393600000,13],[63072000000,12.5],[65750400000,12.8],[68256000000,11.8],[70934400000,11.5],[73526400000,11.7],[76204800000,11.7],[78796800000,11.7],[81475200000,12],[84153600000,12.2],[86745600000,13],[89424000000,13.6],[92016000000,13.7],[94694400000,12.4],[97372800000,12.5],[99792000000,12.7],[102470400000,13.2],[105062400000,13.2],[107740800000,13.6],[110332800000,13.2],[113011200000,13.9],[115689600000,13.1],[118281600000,14.4],[120960000000,14.4],[123552000000,14.8],[126230400000,14.3],[128908800000,14.2],[131328000000,13.4],[134006400000,13.1],[136598400000,12.8],[139276800000,12.8],[141868800000,12.8],[144547200000,12.1],[147225600000,12.9],[149817600000,13.4],[152496000000,13.8],[155088000000,14],[157766400000,13.2],[160444800000,12.5],[162864000000,12.7],[165542400000,14.2],[168134400000,17.3],[170812800000,14.3],[173404800000,12.6],[176083200000,13],[178761600000,13],[181353600000,13.4],[184032000000,12.7],[186624000000,12],[189302400000,11.7],[191980800000,12.3],[194486400000,12.2],[197164800000,11.7],[199756800000,12.3],[202435200000,11.4],[205027200000,11.7],[207705600000,11.7],[210384000000,11.4],[212976000000,11.1],[215654400000,11.4],[218246400000,10.6],[220924800000,10.6],[223603200000,9.300000000000001],[226022400000,10.5],[228700800000,10.5],[231292800000,10.3],[233971200000,10.6],[236563200000,10.5],[239241600000,10.9],[241920000000,11.1],[244512000000,11],[247190400000,11.2],[249782400000,11.4],[252460800000,11.9],[255139200000,11.1],[257558400000,11],[260236800000,10.8],[262828800000,10.3],[265507200000,10],[268099200000,10.9],[270777600000,10.5],[273456000000,10.6],[276048000000,10.7],[278726400000,10.5],[281318400000,10.4],[283996800000,11.1],[286675200000,11.1],[289094400000,11.2],[291772800000,11],[294364800000,10.3],[297043200000,9.9],[299635200000,10.6],[302313600000,9.699999999999999],[304992000000,9.4],[307584000000,9.699999999999999],[310262400000,9.699999999999999],[312854400000,10.1],[315532800000,9.9],[318211200000,10.1],[320716800000,10.2],[323395200000,11.3],[325987200000,11.4],[328665600000,11.2],[331257600000,11.3],[333936000000,11.3],[336614400000,11.7],[339206400000,11.3],[341884800000,11.6],[344476800000,11.4],[347155200000,10.9],[349833600000,10.8],[352252800000,10.8],[354931200000,10.9],[357523200000,11],[360201600000,10.8],[362793600000,12.3],[365472000000,12],[368150400000,12.4],[370742400000,13],[373420800000,13.2],[376012800000,12.5],[378691200000,12.7],[381369600000,12.1],[383788800000,12.2],[386467200000,12.9],[389059200000,12.3],[391737600000,12.3],[394329600000,12.5],[397008000000,12.6],[399686400000,11.8],[402278400000,11.3],[404956800000,10.9],[407548800000,10.9],[410227200000,11.1],[412905600000,11.1],[415324800000,10.6],[418003200000,10.3],[420595200000,9.9],[423273600000,9.1],[425865600000,9.6],[428544000000,9.199999999999999],[431222400000,9.6],[433814400000,9.699999999999999],[436492800000,10.3],[439084800000,10.1],[441763200000,10],[444441600000,11.7],[446947200000,11.5],[449625600000,11.5],[452217600000,11.1],[454896000000,11.1],[457488000000,11.6],[460166400000,11.8],[462844800000,11.8],[465436800000,11.7],[468115200000,10.9],[470707200000,11.2],[473385600000,10.3],[476064000000,9.1],[478483200000,8.699999999999999],[481161600000,9.9],[483753600000,11.1],[486432000000,9.6],[489024000000,9.1],[491702400000,8.199999999999999],[494380800000,7.3],[496972800000,9.1],[499651200000,9],[502243200000,8.6],[504921600000,8.6],[507600000000,9.300000000000001],[510019200000,9.9],[512697600000,9.699999999999999],[515289600000,9.300000000000001],[517968000000,9.4],[520560000000,9.300000000000001],[523238400000,9],[525916800000,7.2],[528508800000,8.4],[531187200000,8.800000000000001],[533779200000,7],[536457600000,9.699999999999999],[539136000000,8.5],[541555200000,8.5],[544233600000,4.5],[546825600000,8.199999999999999],[549504000000,7.7],[552096000000,7.5],[554774400000,7.2],[557452800000,7.6],[560044800000,8.300000000000001],[562723200000,8.5],[565315200000,8.699999999999999],[567993600000,8.1],[570672000000,8.6],[573177600000,8.199999999999999],[575856000000,8.800000000000001],[578448000000,8.4],[581126400000,8.4],[583718400000,8.6],[586396800000,8.4],[589075200000,8.9],[591667200000,8.6],[594345600000,8.4],[596937600000,8.300000000000001],[599616000000,8.5],[602294400000,9],[604713600000,9.5],[607392000000,8.4],[609984000000,8.1],[612662400000,8.199999999999999],[615254400000,8.199999999999999],[617932800000,7.6],[620611200000,8.1],[623203200000,8.5],[625881600000,8.6],[628473600000,7.8],[631152000000,8],[633830400000,8.6],[636249600000,8.300000000000001],[638928000000,8.800000000000001],[641520000000,8.699999999999999],[644198400000,8.6],[646790400000,8.699999999999999],[649468800000,8.1],[652147200000,8.1],[654739200000,7.8],[657417600000,7.9],[660009600000,8.800000000000001],[662688000000,9.300000000000001],[665366400000,8.800000000000001],[667785600000,8],[670464000000,8.6],[673056000000,8.4],[675734400000,8.9],[678326400000,8.199999999999999],[681004800000,8.6],[683683200000,8.800000000000001],[686275200000,9.300000000000001],[688953600000,9],[691545600000,9.699999999999999],[694224000000,9.4],[696902400000,9.800000000000001],[699408000000,9.699999999999999],[702086400000,9.9],[704678400000,9.9],[707356800000,10.1],[709948800000,9.6],[712627200000,9.699999999999999],[715305600000,8.699999999999999],[717897600000,8],[720576000000,8],[723168000000,10.6],[725846400000,8.6],[728524800000,8.9],[730944000000,8.9],[733622400000,8.699999999999999],[736214400000,8.300000000000001],[738892800000,7.8],[741484800000,7.6],[744163200000,7.7],[746841600000,6.9],[749433600000,6.3],[752112000000,6.3],[754704000000,9.1],[757382400000,7.1],[760060800000,6.5],[762480000000,6.8],[765158400000,6.4],[767750400000,7.6],[770428800000,6.9],[773020800000,7],[775699200000,6.5],[778377600000,6.8],[780969600000,7.1],[783648000000,7],[786240000000,7.2],[788918400000,7.5],[791596800000,7.8],[794016000000,7.5],[796694400000,6.9],[799286400000,7.1],[801964800000,6.7],[804556800000,7.1],[807235200000,6.7],[809913600000,6.8],[812505600000,7.1],[815184000000,6.6],[817776000000,6.1],[820454400000,6.7],[823132800000,6.7],[825638400000,6.6],[828316800000,5.7],[830908800000,6.7],[833587200000,7.1],[836179200000,6.7],[838857600000,6.6],[841536000000,6.7],[844128000000,6.4],[846806400000,6.4],[849398400000,6.4],[852076800000,6.2],[854755200000,6.2],[857174400000,6.4],[859852800000,6.5],[862444800000,6.8],[865123200000,6.6],[867715200000,6.1],[870393600000,6],[873072000000,6.2],[875664000000,6.2],[878342400000,6.4],[880934400000,6.4],[883612800000,7.4],[886291200000,7.4],[888710400000,7.5],[891388800000,7.2],[893980800000,6.9],[896659200000,6.8],[899251200000,6.9],[901929600000,6.8],[904608000000,6.4],[907200000000,6.2],[909878400000,6.3],[912470400000,5.8],[915148800000,6.4],[917827200000,6.2],[920246400000,5.9],[922924800000,5.2],[925516800000,4.9],[928195200000,4.8],[930787200000,4.8],[933465600000,4.7],[936144000000,4.2],[938736000000,4.6],[941414400000,4.8],[944006400000,4.4],[946684800000,5.4],[949363200000,4.8],[951868800000,4.5],[954547200000,5],[957139200000,4.9],[959817600000,4.9],[962409600000,5.2],[965088000000,5.2],[967766400000,4.5],[970358400000,4.6],[973036800000,4.5],[975628800000,4.2],[978307200000,4.8],[980985600000,4.9],[983404800000,5.3],[986083200000,5],[988675200000,4.5],[991353600000,4.5],[993945600000,5.6],[996624000000,6.8],[999302400000,7],[1001894400000,3.4],[1004572800000,4.1],[1007164800000,4.5],[1009843200000,6.1],[1012521600000,5.8],[1014940800000,5.9],[1017619200000,5.8],[1020211200000,6.5],[1022889600000,6.4],[1025481600000,5.5],[1028160000000,5.4],[1030838400000,5.7],[1033430400000,5.7],[1036108800000,5.7],[1038700800000,5.5],[1041379200000,5.5],[1044057600000,5.6],[1046476800000,5.3],[1049155200000,5.3],[1051747200000,5.8],[1054425600000,5.6],[1057017600000,6.3],[1059696000000,6],[1062374400000,5.2],[1064966400000,5.3],[1067644800000,5.4],[1070236800000,5.4],[1072915200000,5],[1075593600000,5],[1078099200000,4.9],[1080777600000,5.3],[1083369600000,5.3],[1086048000000,5.8],[1088640000000,5.3],[1091318400000,5.2],[1093996800000,4.6],[1096588800000,4.5],[1099267200000,4.1],[1101859200000,6.9],[1104537600000,3.7],[1107216000000,3.4],[1109635200000,3.6],[1112313600000,3.1],[1114905600000,3.5],[1117584000000,2.9],[1120176000000,2.2],[1122854400000,2.7],[1125532800000,2.7],[1128124800000,3.1],[1130803200000,3.5],[1133395200000,3.7],[1136073600000,4.2],[1138752000000,4.2],[1141171200000,4.2],[1143849600000,4],[1146441600000,3.8],[1149120000000,4],[1151712000000,3.4],[1154390400000,3.6],[1157068800000,3.6],[1159660800000,3.6],[1162339200000,3.9],[1164931200000,3.7],[1167609600000,3.7],[1170288000000,4.1],[1172707200000,4.4],[1175385600000,4.2],[1177977600000,4],[1180656000000,3.8],[1183248000000,3.7],[1185926400000,3.4],[1188604800000,3.5],[1191196800000,3.4],[1193875200000,3.1],[1196467200000,3.6],[1199145600000,3.7],[1201824000000,4.1],[1204329600000,4],[1207008000000,3.4],[1209600000000,7.8],[1212278400000,5.5],[1214870400000,4.4],[1217548800000,3.8],[1220227200000,4.7],[1222819200000,5.5],[1225497600000,6.4],[1228089600000,6.4],[1230768000000,6.2],[1233446400000,5.5],[1235865600000,5.9],[1238544000000,6.8],[1241136000000,8.199999999999999],[1243814400000,6.7],[1246406400000,6],[1249084800000,4.9],[1251763200000,5.9],[1254355200000,5.4],[1257033600000,5.9],[1259625600000,5.9],[1262304000000,6.1],[1264982400000,5.8],[1267401600000,5.7],[1270080000000,6.4],[1272672000000,7],[1275350400000,6.9],[1277942400000,6.8],[1280620800000,6.9],[1283299200000,6.7],[1285891200000,6.6],[1288569600000,6.6],[1291161600000,7.1],[1293840000000,7.4],[1296518400000,7.6],[1298937600000,7],[1301616000000,6.9],[1304208000000,6.9],[1306886400000,7.2],[1309478400000,7.3],[1312156800000,7.2],[1314835200000,6.8],[1317427200000,6.8],[1320105600000,7],[1322697600000,7.8],[1325376000000,8],[1328054400000,8],[1330560000000,8.5],[1333238400000,8.699999999999999],[1335830400000,8.800000000000001],[1338508800000,9.1],[1341100800000,8.199999999999999],[1343779200000,8],[1346457600000,8.199999999999999],[1349049600000,8.800000000000001],[1351728000000,9.699999999999999],[1354320000000,12],[1356998400000,6.3],[1359676800000,5.8],[1362096000000,5.9],[1364774400000,6.4],[1367366400000,6.7],[1370044800000,6.8],[1372636800000,6.6],[1375315200000,6.7],[1377993600000,6.8],[1380585600000,6.3],[1383264000000,6.2],[1385856000000,6.4],[1388534400000,7.1],[1391212800000,7.3],[1393632000000,7.4],[1396310400000,7.4],[1398902400000,7.4],[1401580800000,7.4],[1404172800000,7.5],[1406851200000,7.2],[1409529600000,7.4],[1412121600000,7.2],[1414800000000,7.3],[1417392000000,7.6],[1420070400000,7.7],[1422748800000,7.9],[1425168000000,7.4],[1427846400000,7.6]]}],"dataLabels":{"enabled":false},"stroke":{"curve":"straight","width":2},"yaxis":{"decimalsInFloat":2,"labels":{"style":{"colors":"#848484"}}},"xaxis":{"type":"datetime","labels":{"style":{"colors":"#848484"}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":"1967-07-01","max":"2015-04-01"},"type":"line","shinyEvents":{"selection":{"inputId":"selection","type":"x"}}},"evals":[],"jsHooks":[]}</script><p>Value server-side will be available through
<code>input$selection</code> under the form :</p>
<pre><code><span><span class="co">#&gt; $x</span></span>
<span><span class="co">#&gt; $x$min</span></span>
<span><span class="co">#&gt; [1] "1981-10-24 15:41:16 UTC"</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $x$max</span></span>
<span><span class="co">#&gt; [1] "1992-01-24 06:40:22 UTC"</span></span></code></pre>
<p>You can define a selected area at start:</p>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">economics</span>, <span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">date</span>, <span class="va">psavert</span><span class="op">)</span>, type <span class="op">=</span> <span class="st">"line"</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_selection.html">set_input_selection</a></span><span class="op">(</span></span>
<span> inputId <span class="op">=</span> <span class="st">"selection"</span>, </span>
<span> xmin <span class="op">=</span> <span class="fu"><a href="../../reference/format_date.html">format_date</a></span><span class="op">(</span><span class="st">"1980-01-01"</span><span class="op">)</span>, </span>
<span> xmax <span class="op">=</span> <span class="fu"><a href="../../reference/format_date.html">format_date</a></span><span class="op">(</span><span class="st">"1985-01-01"</span><span class="op">)</span></span>
<span> <span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-c081a7164c6a72436253" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-c081a7164c6a72436253">{"x":{"ax_opts":{"chart":{"type":"line","selection":{"enabled":true,"type":"x","fill":{"color":"#24292e","opacity":0.1},"stroke":{"width":1,"dashArray":3,"color":"#24292e","opacity":0.4},"xaxis":{"min":"new Date('1980-01-01').getTime()","max":"new Date('1985-01-01').getTime()"}},"toolbar":{"autoSelected":"selection"}},"series":[{"name":"psavert","type":"line","data":[[-79056000000,12.6],[-76377600000,12.6],[-73699200000,11.9],[-71107200000,12.9],[-68428800000,12.8],[-65836800000,11.8],[-63158400000,11.7],[-60480000000,12.3],[-57974400000,11.7],[-55296000000,12.3],[-52704000000,12],[-50025600000,11.7],[-47433600000,10.7],[-44755200000,10.5],[-42076800000,10.6],[-39484800000,10.8],[-36806400000,10.6],[-34214400000,11.1],[-31536000000,10.3],[-28857600000,9.699999999999999],[-26438400000,10.2],[-23760000000,9.699999999999999],[-21168000000,10.1],[-18489600000,11.1],[-15897600000,11.8],[-13219200000,11.5],[-10540800000,11.6],[-7948800000,11.4],[-5270400000,11.6],[-2678400000,11.8],[0,11.8],[2678400000,11.7],[5097600000,12.4],[7776000000,13.3],[10368000000,12.4],[13046400000,12.3],[15638400000,13.5],[18316800000,13.4],[20995200000,12.9],[23587200000,13.1],[26265600000,13.6],[28857600000,13.2],[31536000000,13.3],[34214400000,13.3],[36633600000,13.5],[39312000000,13.2],[41904000000,13.6],[44582400000,14.7],[47174400000,13.8],[49852800000,13.6],[52531200000,13.3],[55123200000,13.3],[57801600000,13.1],[60393600000,13],[63072000000,12.5],[65750400000,12.8],[68256000000,11.8],[70934400000,11.5],[73526400000,11.7],[76204800000,11.7],[78796800000,11.7],[81475200000,12],[84153600000,12.2],[86745600000,13],[89424000000,13.6],[92016000000,13.7],[94694400000,12.4],[97372800000,12.5],[99792000000,12.7],[102470400000,13.2],[105062400000,13.2],[107740800000,13.6],[110332800000,13.2],[113011200000,13.9],[115689600000,13.1],[118281600000,14.4],[120960000000,14.4],[123552000000,14.8],[126230400000,14.3],[128908800000,14.2],[131328000000,13.4],[134006400000,13.1],[136598400000,12.8],[139276800000,12.8],[141868800000,12.8],[144547200000,12.1],[147225600000,12.9],[149817600000,13.4],[152496000000,13.8],[155088000000,14],[157766400000,13.2],[160444800000,12.5],[162864000000,12.7],[165542400000,14.2],[168134400000,17.3],[170812800000,14.3],[173404800000,12.6],[176083200000,13],[178761600000,13],[181353600000,13.4],[184032000000,12.7],[186624000000,12],[189302400000,11.7],[191980800000,12.3],[194486400000,12.2],[197164800000,11.7],[199756800000,12.3],[202435200000,11.4],[205027200000,11.7],[207705600000,11.7],[210384000000,11.4],[212976000000,11.1],[215654400000,11.4],[218246400000,10.6],[220924800000,10.6],[223603200000,9.300000000000001],[226022400000,10.5],[228700800000,10.5],[231292800000,10.3],[233971200000,10.6],[236563200000,10.5],[239241600000,10.9],[241920000000,11.1],[244512000000,11],[247190400000,11.2],[249782400000,11.4],[252460800000,11.9],[255139200000,11.1],[257558400000,11],[260236800000,10.8],[262828800000,10.3],[265507200000,10],[268099200000,10.9],[270777600000,10.5],[273456000000,10.6],[276048000000,10.7],[278726400000,10.5],[281318400000,10.4],[283996800000,11.1],[286675200000,11.1],[289094400000,11.2],[291772800000,11],[294364800000,10.3],[297043200000,9.9],[299635200000,10.6],[302313600000,9.699999999999999],[304992000000,9.4],[307584000000,9.699999999999999],[310262400000,9.699999999999999],[312854400000,10.1],[315532800000,9.9],[318211200000,10.1],[320716800000,10.2],[323395200000,11.3],[325987200000,11.4],[328665600000,11.2],[331257600000,11.3],[333936000000,11.3],[336614400000,11.7],[339206400000,11.3],[341884800000,11.6],[344476800000,11.4],[347155200000,10.9],[349833600000,10.8],[352252800000,10.8],[354931200000,10.9],[357523200000,11],[360201600000,10.8],[362793600000,12.3],[365472000000,12],[368150400000,12.4],[370742400000,13],[373420800000,13.2],[376012800000,12.5],[378691200000,12.7],[381369600000,12.1],[383788800000,12.2],[386467200000,12.9],[389059200000,12.3],[391737600000,12.3],[394329600000,12.5],[397008000000,12.6],[399686400000,11.8],[402278400000,11.3],[404956800000,10.9],[407548800000,10.9],[410227200000,11.1],[412905600000,11.1],[415324800000,10.6],[418003200000,10.3],[420595200000,9.9],[423273600000,9.1],[425865600000,9.6],[428544000000,9.199999999999999],[431222400000,9.6],[433814400000,9.699999999999999],[436492800000,10.3],[439084800000,10.1],[441763200000,10],[444441600000,11.7],[446947200000,11.5],[449625600000,11.5],[452217600000,11.1],[454896000000,11.1],[457488000000,11.6],[460166400000,11.8],[462844800000,11.8],[465436800000,11.7],[468115200000,10.9],[470707200000,11.2],[473385600000,10.3],[476064000000,9.1],[478483200000,8.699999999999999],[481161600000,9.9],[483753600000,11.1],[486432000000,9.6],[489024000000,9.1],[491702400000,8.199999999999999],[494380800000,7.3],[496972800000,9.1],[499651200000,9],[502243200000,8.6],[504921600000,8.6],[507600000000,9.300000000000001],[510019200000,9.9],[512697600000,9.699999999999999],[515289600000,9.300000000000001],[517968000000,9.4],[520560000000,9.300000000000001],[523238400000,9],[525916800000,7.2],[528508800000,8.4],[531187200000,8.800000000000001],[533779200000,7],[536457600000,9.699999999999999],[539136000000,8.5],[541555200000,8.5],[544233600000,4.5],[546825600000,8.199999999999999],[549504000000,7.7],[552096000000,7.5],[554774400000,7.2],[557452800000,7.6],[560044800000,8.300000000000001],[562723200000,8.5],[565315200000,8.699999999999999],[567993600000,8.1],[570672000000,8.6],[573177600000,8.199999999999999],[575856000000,8.800000000000001],[578448000000,8.4],[581126400000,8.4],[583718400000,8.6],[586396800000,8.4],[589075200000,8.9],[591667200000,8.6],[594345600000,8.4],[596937600000,8.300000000000001],[599616000000,8.5],[602294400000,9],[604713600000,9.5],[607392000000,8.4],[609984000000,8.1],[612662400000,8.199999999999999],[615254400000,8.199999999999999],[617932800000,7.6],[620611200000,8.1],[623203200000,8.5],[625881600000,8.6],[628473600000,7.8],[631152000000,8],[633830400000,8.6],[636249600000,8.300000000000001],[638928000000,8.800000000000001],[641520000000,8.699999999999999],[644198400000,8.6],[646790400000,8.699999999999999],[649468800000,8.1],[652147200000,8.1],[654739200000,7.8],[657417600000,7.9],[660009600000,8.800000000000001],[662688000000,9.300000000000001],[665366400000,8.800000000000001],[667785600000,8],[670464000000,8.6],[673056000000,8.4],[675734400000,8.9],[678326400000,8.199999999999999],[681004800000,8.6],[683683200000,8.800000000000001],[686275200000,9.300000000000001],[688953600000,9],[691545600000,9.699999999999999],[694224000000,9.4],[696902400000,9.800000000000001],[699408000000,9.699999999999999],[702086400000,9.9],[704678400000,9.9],[707356800000,10.1],[709948800000,9.6],[712627200000,9.699999999999999],[715305600000,8.699999999999999],[717897600000,8],[720576000000,8],[723168000000,10.6],[725846400000,8.6],[728524800000,8.9],[730944000000,8.9],[733622400000,8.699999999999999],[736214400000,8.300000000000001],[738892800000,7.8],[741484800000,7.6],[744163200000,7.7],[746841600000,6.9],[749433600000,6.3],[752112000000,6.3],[754704000000,9.1],[757382400000,7.1],[760060800000,6.5],[762480000000,6.8],[765158400000,6.4],[767750400000,7.6],[770428800000,6.9],[773020800000,7],[775699200000,6.5],[778377600000,6.8],[780969600000,7.1],[783648000000,7],[786240000000,7.2],[788918400000,7.5],[791596800000,7.8],[794016000000,7.5],[796694400000,6.9],[799286400000,7.1],[801964800000,6.7],[804556800000,7.1],[807235200000,6.7],[809913600000,6.8],[812505600000,7.1],[815184000000,6.6],[817776000000,6.1],[820454400000,6.7],[823132800000,6.7],[825638400000,6.6],[828316800000,5.7],[830908800000,6.7],[833587200000,7.1],[836179200000,6.7],[838857600000,6.6],[841536000000,6.7],[844128000000,6.4],[846806400000,6.4],[849398400000,6.4],[852076800000,6.2],[854755200000,6.2],[857174400000,6.4],[859852800000,6.5],[862444800000,6.8],[865123200000,6.6],[867715200000,6.1],[870393600000,6],[873072000000,6.2],[875664000000,6.2],[878342400000,6.4],[880934400000,6.4],[883612800000,7.4],[886291200000,7.4],[888710400000,7.5],[891388800000,7.2],[893980800000,6.9],[896659200000,6.8],[899251200000,6.9],[901929600000,6.8],[904608000000,6.4],[907200000000,6.2],[909878400000,6.3],[912470400000,5.8],[915148800000,6.4],[917827200000,6.2],[920246400000,5.9],[922924800000,5.2],[925516800000,4.9],[928195200000,4.8],[930787200000,4.8],[933465600000,4.7],[936144000000,4.2],[938736000000,4.6],[941414400000,4.8],[944006400000,4.4],[946684800000,5.4],[949363200000,4.8],[951868800000,4.5],[954547200000,5],[957139200000,4.9],[959817600000,4.9],[962409600000,5.2],[965088000000,5.2],[967766400000,4.5],[970358400000,4.6],[973036800000,4.5],[975628800000,4.2],[978307200000,4.8],[980985600000,4.9],[983404800000,5.3],[986083200000,5],[988675200000,4.5],[991353600000,4.5],[993945600000,5.6],[996624000000,6.8],[999302400000,7],[1001894400000,3.4],[1004572800000,4.1],[1007164800000,4.5],[1009843200000,6.1],[1012521600000,5.8],[1014940800000,5.9],[1017619200000,5.8],[1020211200000,6.5],[1022889600000,6.4],[1025481600000,5.5],[1028160000000,5.4],[1030838400000,5.7],[1033430400000,5.7],[1036108800000,5.7],[1038700800000,5.5],[1041379200000,5.5],[1044057600000,5.6],[1046476800000,5.3],[1049155200000,5.3],[1051747200000,5.8],[1054425600000,5.6],[1057017600000,6.3],[1059696000000,6],[1062374400000,5.2],[1064966400000,5.3],[1067644800000,5.4],[1070236800000,5.4],[1072915200000,5],[1075593600000,5],[1078099200000,4.9],[1080777600000,5.3],[1083369600000,5.3],[1086048000000,5.8],[1088640000000,5.3],[1091318400000,5.2],[1093996800000,4.6],[1096588800000,4.5],[1099267200000,4.1],[1101859200000,6.9],[1104537600000,3.7],[1107216000000,3.4],[1109635200000,3.6],[1112313600000,3.1],[1114905600000,3.5],[1117584000000,2.9],[1120176000000,2.2],[1122854400000,2.7],[1125532800000,2.7],[1128124800000,3.1],[1130803200000,3.5],[1133395200000,3.7],[1136073600000,4.2],[1138752000000,4.2],[1141171200000,4.2],[1143849600000,4],[1146441600000,3.8],[1149120000000,4],[1151712000000,3.4],[1154390400000,3.6],[1157068800000,3.6],[1159660800000,3.6],[1162339200000,3.9],[1164931200000,3.7],[1167609600000,3.7],[1170288000000,4.1],[1172707200000,4.4],[1175385600000,4.2],[1177977600000,4],[1180656000000,3.8],[1183248000000,3.7],[1185926400000,3.4],[1188604800000,3.5],[1191196800000,3.4],[1193875200000,3.1],[1196467200000,3.6],[1199145600000,3.7],[1201824000000,4.1],[1204329600000,4],[1207008000000,3.4],[1209600000000,7.8],[1212278400000,5.5],[1214870400000,4.4],[1217548800000,3.8],[1220227200000,4.7],[1222819200000,5.5],[1225497600000,6.4],[1228089600000,6.4],[1230768000000,6.2],[1233446400000,5.5],[1235865600000,5.9],[1238544000000,6.8],[1241136000000,8.199999999999999],[1243814400000,6.7],[1246406400000,6],[1249084800000,4.9],[1251763200000,5.9],[1254355200000,5.4],[1257033600000,5.9],[1259625600000,5.9],[1262304000000,6.1],[1264982400000,5.8],[1267401600000,5.7],[1270080000000,6.4],[1272672000000,7],[1275350400000,6.9],[1277942400000,6.8],[1280620800000,6.9],[1283299200000,6.7],[1285891200000,6.6],[1288569600000,6.6],[1291161600000,7.1],[1293840000000,7.4],[1296518400000,7.6],[1298937600000,7],[1301616000000,6.9],[1304208000000,6.9],[1306886400000,7.2],[1309478400000,7.3],[1312156800000,7.2],[1314835200000,6.8],[1317427200000,6.8],[1320105600000,7],[1322697600000,7.8],[1325376000000,8],[1328054400000,8],[1330560000000,8.5],[1333238400000,8.699999999999999],[1335830400000,8.800000000000001],[1338508800000,9.1],[1341100800000,8.199999999999999],[1343779200000,8],[1346457600000,8.199999999999999],[1349049600000,8.800000000000001],[1351728000000,9.699999999999999],[1354320000000,12],[1356998400000,6.3],[1359676800000,5.8],[1362096000000,5.9],[1364774400000,6.4],[1367366400000,6.7],[1370044800000,6.8],[1372636800000,6.6],[1375315200000,6.7],[1377993600000,6.8],[1380585600000,6.3],[1383264000000,6.2],[1385856000000,6.4],[1388534400000,7.1],[1391212800000,7.3],[1393632000000,7.4],[1396310400000,7.4],[1398902400000,7.4],[1401580800000,7.4],[1404172800000,7.5],[1406851200000,7.2],[1409529600000,7.4],[1412121600000,7.2],[1414800000000,7.3],[1417392000000,7.6],[1420070400000,7.7],[1422748800000,7.9],[1425168000000,7.4],[1427846400000,7.6]]}],"dataLabels":{"enabled":false},"stroke":{"curve":"straight","width":2},"yaxis":{"decimalsInFloat":2,"labels":{"style":{"colors":"#848484"}}},"xaxis":{"type":"datetime","labels":{"style":{"colors":"#848484"}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":"1967-07-01","max":"2015-04-01"},"type":"line","shinyEvents":{"selection":{"inputId":"selection","type":"x"}}},"evals":["ax_opts.chart.selection.xaxis.min","ax_opts.chart.selection.xaxis.max"],"jsHooks":[]}</script><p>Above selection is only made possible on x-axis, but in case of
scatter chart for example, you can select a rectangle (both axis):</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/apex.html">apex</a></span><span class="op">(</span><span class="va">iris</span>, <span class="fu"><a href="../../reference/apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">Sepal.Length</span>, <span class="va">Sepal.Width</span><span class="op">)</span>, type <span class="op">=</span> <span class="st">"scatter"</span>, height <span class="op">=</span> <span class="st">"250px"</span><span class="op">)</span> <span class="op"><a href="../../reference/apexcharter-exports.html">%&gt;%</a></span> </span>
<span> <span class="fu"><a href="../../reference/set_input_selection.html">set_input_selection</a></span><span class="op">(</span><span class="st">"selection_scatter"</span>, type <span class="op">=</span> <span class="st">"xy"</span><span class="op">)</span></span></code></pre></div>
<div id="htmlwidget-7c9f3b7f6893a76cd6a3" style="width:100%;height:250px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-7c9f3b7f6893a76cd6a3">{"x":{"ax_opts":{"chart":{"type":"scatter","selection":{"enabled":true,"type":"xy","fill":{"color":"#24292e","opacity":0.1},"stroke":{"width":1,"dashArray":3,"color":"#24292e","opacity":0.4}},"toolbar":{"autoSelected":"selection"}},"series":[{"name":"Sepal.Width","type":"scatter","data":[{"x":5.1,"y":3.5},{"x":4.9,"y":3},{"x":4.7,"y":3.2},{"x":4.6,"y":3.1},{"x":5,"y":3.6},{"x":5.4,"y":3.9},{"x":4.6,"y":3.4},{"x":5,"y":3.4},{"x":4.4,"y":2.9},{"x":4.9,"y":3.1},{"x":5.4,"y":3.7},{"x":4.8,"y":3.4},{"x":4.8,"y":3},{"x":4.3,"y":3},{"x":5.8,"y":4},{"x":5.7,"y":4.4},{"x":5.4,"y":3.9},{"x":5.1,"y":3.5},{"x":5.7,"y":3.8},{"x":5.1,"y":3.8},{"x":5.4,"y":3.4},{"x":5.1,"y":3.7},{"x":4.6,"y":3.6},{"x":5.1,"y":3.3},{"x":4.8,"y":3.4},{"x":5,"y":3},{"x":5,"y":3.4},{"x":5.2,"y":3.5},{"x":5.2,"y":3.4},{"x":4.7,"y":3.2},{"x":4.8,"y":3.1},{"x":5.4,"y":3.4},{"x":5.2,"y":4.1},{"x":5.5,"y":4.2},{"x":4.9,"y":3.1},{"x":5,"y":3.2},{"x":5.5,"y":3.5},{"x":4.9,"y":3.6},{"x":4.4,"y":3},{"x":5.1,"y":3.4},{"x":5,"y":3.5},{"x":4.5,"y":2.3},{"x":4.4,"y":3.2},{"x":5,"y":3.5},{"x":5.1,"y":3.8},{"x":4.8,"y":3},{"x":5.1,"y":3.8},{"x":4.6,"y":3.2},{"x":5.3,"y":3.7},{"x":5,"y":3.3},{"x":7,"y":3.2},{"x":6.4,"y":3.2},{"x":6.9,"y":3.1},{"x":5.5,"y":2.3},{"x":6.5,"y":2.8},{"x":5.7,"y":2.8},{"x":6.3,"y":3.3},{"x":4.9,"y":2.4},{"x":6.6,"y":2.9},{"x":5.2,"y":2.7},{"x":5,"y":2},{"x":5.9,"y":3},{"x":6,"y":2.2},{"x":6.1,"y":2.9},{"x":5.6,"y":2.9},{"x":6.7,"y":3.1},{"x":5.6,"y":3},{"x":5.8,"y":2.7},{"x":6.2,"y":2.2},{"x":5.6,"y":2.5},{"x":5.9,"y":3.2},{"x":6.1,"y":2.8},{"x":6.3,"y":2.5},{"x":6.1,"y":2.8},{"x":6.4,"y":2.9},{"x":6.6,"y":3},{"x":6.8,"y":2.8},{"x":6.7,"y":3},{"x":6,"y":2.9},{"x":5.7,"y":2.6},{"x":5.5,"y":2.4},{"x":5.5,"y":2.4},{"x":5.8,"y":2.7},{"x":6,"y":2.7},{"x":5.4,"y":3},{"x":6,"y":3.4},{"x":6.7,"y":3.1},{"x":6.3,"y":2.3},{"x":5.6,"y":3},{"x":5.5,"y":2.5},{"x":5.5,"y":2.6},{"x":6.1,"y":3},{"x":5.8,"y":2.6},{"x":5,"y":2.3},{"x":5.6,"y":2.7},{"x":5.7,"y":3},{"x":5.7,"y":2.9},{"x":6.2,"y":2.9},{"x":5.1,"y":2.5},{"x":5.7,"y":2.8},{"x":6.3,"y":3.3},{"x":5.8,"y":2.7},{"x":7.1,"y":3},{"x":6.3,"y":2.9},{"x":6.5,"y":3},{"x":7.6,"y":3},{"x":4.9,"y":2.5},{"x":7.3,"y":2.9},{"x":6.7,"y":2.5},{"x":7.2,"y":3.6},{"x":6.5,"y":3.2},{"x":6.4,"y":2.7},{"x":6.8,"y":3},{"x":5.7,"y":2.5},{"x":5.8,"y":2.8},{"x":6.4,"y":3.2},{"x":6.5,"y":3},{"x":7.7,"y":3.8},{"x":7.7,"y":2.6},{"x":6,"y":2.2},{"x":6.9,"y":3.2},{"x":5.6,"y":2.8},{"x":7.7,"y":2.8},{"x":6.3,"y":2.7},{"x":6.7,"y":3.3},{"x":7.2,"y":3.2},{"x":6.2,"y":2.8},{"x":6.1,"y":3},{"x":6.4,"y":2.8},{"x":7.2,"y":3},{"x":7.4,"y":2.8},{"x":7.9,"y":3.8},{"x":6.4,"y":2.8},{"x":6.3,"y":2.8},{"x":6.1,"y":2.6},{"x":7.7,"y":3},{"x":6.3,"y":3.4},{"x":6.4,"y":3.1},{"x":6,"y":3},{"x":6.9,"y":3.1},{"x":6.7,"y":3.1},{"x":6.9,"y":3.1},{"x":5.8,"y":2.7},{"x":6.8,"y":3.2},{"x":6.7,"y":3.3},{"x":6.7,"y":3},{"x":6.3,"y":2.5},{"x":6.5,"y":3},{"x":6.2,"y":3.4},{"x":5.9,"y":3}]}],"dataLabels":{"enabled":false},"xaxis":{"type":"numeric","min":4,"max":8,"tickAmount":4,"crosshairs":{"show":true,"stroke":{"dashArray":0}},"labels":{"style":{"colors":"#848484"}}},"yaxis":{"min":2,"max":4.5,"tickAmount":5,"labels":{"formatter":"function(value) {var locale = formatLocale(JSON.parse('{ \"decimal\": \".\", \"thousands\": \",\", \"grouping\": [3], \"currency\": [\"$\", \"\"]}')); return '' + locale.format('~r')(value) + '';}","style":{"colors":"#848484"}},"tooltip":{"enabled":true}},"grid":{"xaxis":{"lines":{"show":true}}}},"auto_update":{"series_animate":true,"update_options":false,"options_animate":true,"options_redrawPaths":true,"update_synced_charts":false},"sparkbox":false,"xaxis":{"min":4.3,"max":7.9},"type":"scatter","shinyEvents":{"selection":{"inputId":"selection_scatter","type":"xy"}}},"evals":["ax_opts.yaxis.labels.formatter"],"jsHooks":[]}</script><p>In this case, input value will look like this:</p>
<pre><code><span><span class="co">#&gt; $x</span></span>
<span><span class="co">#&gt; $x$min</span></span>
<span><span class="co">#&gt; [1] 5.130187</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $x$max</span></span>
<span><span class="co">#&gt; [1] 5.541228</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $y</span></span>
<span><span class="co">#&gt; $y$min</span></span>
<span><span class="co">#&gt; [1] 2.959623</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; $y$max</span></span>
<span><span class="co">#&gt; [1] 3.860357</span></span></code></pre>
<p>More examples are available with:</p>
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../../reference/run_demo_input.html">run_demo_input</a></span><span class="op">(</span><span class="st">"selection"</span><span class="op">)</span></span></code></pre></div>
</div>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
</nav></aside>
</div>
<footer><div class="pkgdown-footer-left">
<p></p>
<p>Developed by <a href="https://twitter.com/_pvictorr" class="external-link"><img src="https://pbs.twimg.com/profile_images/844237339404722177/E1U61aM8_normal.jpg"> Victor Perrier</a>, <a href="https://twitter.com/_mfaan" class="external-link"><img src="https://pbs.twimg.com/profile_images/912313931326218240/o1-wvA18_normal.jpg"> Fanny Meyer</a>.</p>
</div>
<div class="pkgdown-footer-right">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>