apexcharter/reference/ax_yaxis.html

171 lines
108 KiB
HTML
Raw Normal View History

<!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="Y-axis options"><title>Y-axis options — ax_yaxis • 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.1.0/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.1.0/bootstrap.bundle.min.js"></script><link href="../deps/_Poppins-0.4.0/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.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.js"></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="Y-axis options — ax_yaxis"><meta property="og:description" content="Y-axis options"><!-- 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]--><!-- dependencies from examples --><script src="libs/htmlwidgets-1.5.4/htmlwidgets.js"></script><script src="libs/apexcharter-binding-0.3.0.9100/apexcharter.js"></script></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.3.0.9100</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-2">
<ul class="navbar-nav me-auto"><li class="nav-item">
<a class="nav-link" href="../articles/apexcharter.html">Get started</a>
</li>
<li class="active nav-item">
<a class="nav-link" href="../reference/index.html">Reference</a>
</li>
<li class="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-reference-topic">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>Y-axis options</h1>
<small class="dont-index">Source: <a href="https://github.com/dreamRs/apexcharter/blob/HEAD/R/apex-utils.R" class="external-link"><code>R/apex-utils.R</code></a></small>
<div class="d-none name"><code>ax_yaxis.Rd</code></div>
</div>
<div class="ref-description section level2">
<p>Y-axis options</p>
</div>
<div class="section level2">
<h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="fu">ax_yaxis</span><span class="op">(</span>
<span class="va">ax</span>,
opposite <span class="op">=</span> <span class="cn">NULL</span>,
tickAmount <span class="op">=</span> <span class="cn">NULL</span>,
max <span class="op">=</span> <span class="cn">NULL</span>,
min <span class="op">=</span> <span class="cn">NULL</span>,
floating <span class="op">=</span> <span class="cn">NULL</span>,
labels <span class="op">=</span> <span class="cn">NULL</span>,
axisBorder <span class="op">=</span> <span class="cn">NULL</span>,
axisTicks <span class="op">=</span> <span class="cn">NULL</span>,
title <span class="op">=</span> <span class="cn">NULL</span>,
tooltip <span class="op">=</span> <span class="cn">NULL</span>,
crosshairs <span class="op">=</span> <span class="cn">NULL</span>,
<span class="va">...</span>
<span class="op">)</span></code></pre></div>
</div>
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>
<dl><dt>ax</dt>
<dd><p>An <code><a href="apexchart.html">apexchart()</a></code> <code>htmlwidget</code> object.</p></dd>
<dt>opposite</dt>
<dd><p>Logical. When enabled, will draw the yaxis on the right side of the chart.</p></dd>
<dt>tickAmount</dt>
<dd><p>Number of Tick Intervals to show.</p></dd>
<dt>max</dt>
<dd><p>Lowest number to be set for the y-axis. The graph drawing beyond this number will be clipped off.</p></dd>
<dt>min</dt>
<dd><p>Highest number to be set for the y-axis. The graph drawing beyond this number will be clipped off.</p></dd>
<dt>floating</dt>
<dd><p>Logical. Floating takes y-axis is taken out of normal flow and places y-axis on svg element directly,
similar to an absolutely positioned element. Set the offsetX and offsetY then to adjust the position manually</p></dd>
<dt>labels</dt>
<dd><p>A list of parameters.</p></dd>
<dt>axisBorder</dt>
<dd><p>A list of parameters.</p></dd>
<dt>axisTicks</dt>
<dd><p>A list of parameters.</p></dd>
<dt>title</dt>
<dd><p>A list of parameters.</p></dd>
<dt>tooltip</dt>
<dd><p>A list of parameters.</p></dd>
<dt>crosshairs</dt>
<dd><p>A list of parameters.</p></dd>
<dt>...</dt>
<dd><p>Additional parameters.</p></dd>
</dl></div>
<div class="section level2">
<h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
<p>An <code><a href="apexchart.html">apexchart()</a></code><code>htmlwidget</code> object.</p>
</div>
<div class="section level2">
<h2 id="note">Note<a class="anchor" aria-label="anchor" href="#note"></a></h2>
<p>See <a href="https://apexcharts.com/docs/options/yaxis/" class="external-link">https://apexcharts.com/docs/options/yaxis/</a></p>
</div>
<div class="section level2">
<h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><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_long"</span>, package <span class="op">=</span> <span class="st">"ggplot2"</span><span class="op">)</span></span>
<span class="r-in"><span class="fu"><a href="apex.html">apex</a></span><span class="op">(</span></span>
<span class="r-in"> data <span class="op">=</span> <span class="va">economics_long</span>,</span>
<span class="r-in"> mapping <span class="op">=</span> <span class="fu"><a href="apexcharter-exports.html">aes</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">date</span>, y <span class="op">=</span> <span class="va">value01</span>, group <span class="op">=</span> <span class="va">variable</span><span class="op">)</span>,</span>
<span class="r-in"> type <span class="op">=</span> <span class="st">"line"</span></span>
<span class="r-in"><span class="op">)</span> <span class="op"><a href="apexcharter-exports.html">%&gt;%</a></span></span>
<span class="r-in"> <span class="fu">ax_yaxis</span><span class="op">(</span></span>
<span class="r-in"> decimalsInFloat <span class="op">=</span> <span class="fl">2</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>text <span class="op">=</span> <span class="st">"Rescaled to [0,1]"</span><span class="op">)</span></span>
<span class="r-in"> <span class="op">)</span></span>
<div id="htmlwidget-68489f32e813a352bd1e" style="width:700px;height:432.632880098888px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-68489f32e813a352bd1e">{"x":{"ax_opts":{"chart":{"type":"line"},"series":[{"name":"pce","type":"line","data":[[-79056000000,0],[-76377600000,0.000265249719776508],[-73699200000,0.000761523389035778],[-71107200000,0.000470604341538967],[-68428800000,0.000915539355357616],[-65836800000,0.00157438543351217],[-63158400000,0.00207065910277143],[-60480000000,0.0023016830522542],[-57974400000,0.00321722240761181],[-55296000000,0.00319155307989151],[-52704000000,0.00368782674915077],[-50025600000,0.00424399551642409],[-47433600000,0.00483439005399116],[-44755200000,0.00515953487178171],[-42076800000,0.00526221218266294],[-39484800000,0.00555313123015975],[-36806400000,0.00598950980140497],[-34214400000,0.0059723969162581],[-31536000000,0.0065713478963986],[-28857600000,0.00701628291021725],[-26438400000,0.00703339579536412],[-23760000000,0.0074612179240359],[-21168000000,0.00800883024873578],[-18489600000,0.0080601689041764],[-15897600000,0.00821418487049825],[-13219200000,0.00883024873578561],[-10540800000,0.00911261134070899],[-7948800000,0.00956610279710108],[-5270400000,0.00973723164856979],[-2678400000,0.00993402982775881],[0,0.0104388599395915],[2678400000,0.0108923513959836],[5097600000,0.0107468918722352],[7776000000,0.0110634802474523],[10368000000,0.0116110925721522],[13046400000,0.0119447938325162],[15638400000,0.0121330355691318],[18316800000,0.0125095190423629],[20995200000,0.013040018481916],[23587200000,0.0129715669413285],[26265600000,0.0128261074175801],[28857600000,0.0135961872491893],[31536000000,0.0144946137194],[34214400000,0.0147769763243234],[36633600000,0.0149994438312327],[39312000000,0.0155812819262264],[41904000000,0.0157780801054154],[44582400000,0.0165224906093043],[47174400000,0.0164454826261434],[49852800000,0.0169588691805495],[52531200000,0.0176519410289978],[55123200000,0.017891521421054],[57801600000,0.0183278999922992],[60393600000,0.0189696331853069],[63072000000,0.0192348829050834],[65750400000,0.0196370357060349],[68256000000,0.0207493732405815],[70934400000,0.0210317358455049],[73526400000,0.0215023401870438],[76204800000,0.0218103721196875],[78796800000,0.0225205568532827],[81475200000,0.0230681691779826],[84153600000,0.0234788784215075],[86745600000,0.0246596674966416],[89424000000,0.025138828280754],[92016000000,0.0256179890648664],[94694400000,0.0265078590925037],[97372800000,0.0273036082518332],[99792000000,0.0279025592319737],[102470400000,0.0281506960666034],[105062400000,0.0286555261784361],[107740800000,0.0288865501279188],[110332800000,0.0297250815001155],[113011200000,0.029656629959528],[115689600000,0.0310171043287043],[118281600000,0.0309315399029699],[120960000000,0.0316759504068588],[123552000000,0.0316502810791385],[126230400000,0.03232624004244],[128908800000,0.0327711750562586],[131328000000,0.0337722788373506],[134006400000,0.0345765844392535],[136598400000,0.0355691317777721],[139276800000,0.0360482925618845],[141868800000,0.0368953803766546],[144547200000,0.0383414191715652],[147225600000,0.0383670884992855],[149817600000,0.0387179026447964],[152496000000,0.0384612093675933],[155088000000,0.0389403701517057],[157766400000,0.0401211592268399],[160444800000,0.041301948301974],[162864000000,0.0414046256128552],[165542400000,0.0417811090860864],[168134400000,0.0438260988611375],[170812800000,0.0445020578244389],[173404800000,0.0456143953589855],[176083200000,0.0462304592242729],[178761600000,0.0468978617450009],[181353600000,0.0474198047419805],[184032000000,0.0486947146854224],[186624000000,0.0500894148248924],[189302400000,0.0513728812109077],[191980800000,0.0514242198663484],[194486400000,0.0520402837316357],[197164800000,0.0529387102018465],[199756800000,0.0527076862523637],[202435200000,0.0542307330304353],[205027200000,0.0550093693046179],[207705600000,0.0557281104807865],[210384000000,0.0566522062787176],[212976000000,0.0573367216845924],[215654400000,0.0583806076785516],[218246400000,0.0603058072575746],[220924800000,0.0606052827476448],[223603200000,0.0619999828871149],[226022400000,0.0625989338672553],[22870080
<span class="r-in"><span class="co"># Format tick labels</span></span>
<span class="r-in"><span class="va">temperature</span> <span class="op">&lt;-</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 class="r-in"> month <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">month.name</span><span class="op">)</span>,</span>
<span class="r-in"> tp <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">4</span>, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>, <span class="fl">7</span>, <span class="fl">11</span>, <span class="fl">14</span><span class="op">)</span></span>
<span class="r-in"><span class="op">)</span></span>
<span class="r-in"><span class="fu"><a href="apex.html">apex</a></span><span class="op">(</span><span class="va">temperature</span>, <span class="fu"><a href="apexcharter-exports.html">aes</a></span><span class="op">(</span><span class="va">month</span>, <span class="va">tp</span><span class="op">)</span>, <span class="st">"line"</span><span class="op">)</span> <span class="op"><a href="apexcharter-exports.html">%&gt;%</a></span> </span>
<span class="r-in"> <span class="fu">ax_yaxis</span><span class="op">(</span></span>
<span class="r-in"> labels <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 class="r-in"> formatter <span class="op">=</span> <span class="fu">htmlwidgets</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/htmlwidgets/man/JS.html" class="external-link">JS</a></span><span class="op">(</span><span class="st">"function(value) {return value + '\u00b0C';}"</span><span class="op">)</span></span>
<span class="r-in"> <span class="op">)</span></span>
<span class="r-in"> <span class="op">)</span></span>
<div id="htmlwidget-fb7cbea0904b8434fe1e" style="width:700px;height:432.632880098888px;" class="apexcharter html-widget"></div>
<script type="application/json" data-for="htmlwidget-fb7cbea0904b8434fe1e">{"x":{"ax_opts":{"chart":{"type":"line"},"series":[{"name":"tp","type":"line","data":[{"x":"January","y":4},{"x":"February","y":-2},{"x":"March","y":2},{"x":"April","y":7},{"x":"May","y":11},{"x":"June","y":14}]}],"dataLabels":{"enabled":false},"stroke":{"curve":"straight","width":2},"yaxis":{"decimalsInFloat":2,"labels":{"style":{"colors":"#848484"},"formatter":"function(value) {return value + '°C';}"}},"xaxis":{"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":"April","max":"May"},"type":"line"},"evals":["ax_opts.yaxis.labels.formatter"],"jsHooks":[]}</script></code></pre></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.1.</p>
</div>
</footer></div>
</body></html>