Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions _posts/reference_pages/2016-06-03-plotly_js_function_ref.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Plotly.js Function Reference
title: Plhttps://github.com/plotly/documentation/pull/1026/conflict?name=_posts%252Freference_pages%252F2016-06-03-plotly_js_function_ref.html&ancestor_oid=282bd0154f44805297242fb8f17c03ca684cbcfc&base_oid=623d9be4dc0e84be31b1e3b62c38eb03d581a108&head_oid=32990ade57a0c78499774dbe85f68220fc293986otly.js Function Reference
name: Plotly.js Function Reference
permalink: /javascript/plotlyjs-function-reference/
description: Plotly.js function reference. How to create, update, and modify graphs drawn with Plotly's Javascript Graphing Library.
Expand Down Expand Up @@ -272,7 +272,7 @@ <h4 id="plotly-update"><a href="{{ BASE_URL }}/javascript/plotlyjs-function-refe
An efficient means of updating both the <code>data</code> array and <code>layout</code> object in an existing plot, basically a combination of <code>Plotly.restyle</code> and <code>Plotly.relayout</code>.
<br /><br />
<fieldset class="signatures">
<legend>Signatures</legend>
<legend>Signature</legend>
<dl>
<dt><code>Plotly.update(graphDiv, data_update, layout_update, [, traceIndices])</code></dt>
<dd>
Expand All @@ -292,15 +292,39 @@ <h4 id="plotly-update"><a href="{{ BASE_URL }}/javascript/plotlyjs-function-refe
<br /><br />

<pre><code class="language-javascript hljs" data-lang="javascript">
//update the layout and all the traces
var layout_update = {
title: 'some new title', // updates the title
};
var data_update = {
marker: {color: 'red'}
'marker.color': 'red'
};
Plotly.update(graphDiv, data_update, layout_update)

//update the layout and a single trace
var layout_update = {
title: 'some new title', // updates the title
};
Plotly.update(graphDiv, data_update, layout_update)
var data_update = {
'marker.color': 'red'
};
Plotly.update(graphDiv, data_update, layout_update,0)

//update the layout and two specific traces
var layout_update = {
title: 'some new title', // updates the title
};
var data_update = {
'marker.color': 'red'
};
Plotly.update(graphDiv, data_update, layout_update, [0,2])

</code></pre>


<p data-height="510" data-theme-id="15263" data-slug-hash="PKGrem" data-default-tab="result" data-user="plotly" class='codepen' data-preview="true">See the Pen <a href='http://codepen.io/plotly/pen/PKGrem/'>Plotly.update</a> by plotly (<a href='http://codepen.io/plotly'>@plotly</a>) on <a href='http://codepen.io'>CodePen</a>.</p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>

<h4 id="plotly-validate"><a href="{{ BASE_URL }}/javascript/plotlyjs-function-reference/#plotlyvalidate">Plotly.validate</a></h4>

<code>Plotly.validate</code> allows users to validate their input <code>data</code> array and <code>layout</code> object. This can be done on the <code>data</code> array and <code>layout</code> object passed into <code>Plotly.newPlot</code> or on an updated <code>graphDiv</code> with <code>Plotly.validate(graphDiv.data, graphDiv.layout)</code>.
Expand Down Expand Up @@ -333,6 +357,7 @@ <h4 id="plotly-validate"><a href="{{ BASE_URL }}/javascript/plotlyjs-function-re
// "In data trace 0, key orientation is set to an invalid value (horizontal)"
</code></pre>


<h4 id="plotly-addtraces"><a href="{{ BASE_URL }}/javascript/plotlyjs-function-reference/#plotlyaddtraces">Plotly.addTraces</a></h4>
<em>This function has comparable performance to <a href="#plotlyreact"><code>Plotly.react</code></a> and is faster than redrawing the whole plot with <a href="#plotlynewplot"><code>Plotly.newPlot</code></a>.</em><br /><br />

Expand Down