Skip to content

Commit 43a34ee

Browse files
author
Joseph Damiba
authored
Merge pull request #1618 from plotly/optional-codepen
basic examples without codepens
2 parents 02a3f2d + 6f5fac5 commit 43a34ee

File tree

77 files changed

+60
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+60
-113
lines changed

_includes/layouts/head.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script>
1111
<script>hljs.initHighlightingOnLoad();</script>
1212
{% endif %}
13+
14+
{% if page.language == "plotly_js" %}
15+
<!-- Plotly.js -->
16+
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
17+
{% endif %}
1318

1419
<!--
1520
//// Stylesheets

_includes/posts/auto_examples.html

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,54 @@
1-
1+
{% assign counter = 0 %}
22
{% for example in examples %}
3+
{% assign counter=counter | plus:1 %}
34
<div class="section">
4-
<div class="row auto-eg-padding">
5-
<div class=" row twelve columns">
6-
<h4 id="{{ example.name | replace:' ','-' | remove:',' | downcase | strip_html }}"><a class="no_underline plot-blue" href="#{{ example.name | replace:' ','-' | remove:',' | downcase | strip_html }}">{{ example.name }}</a></h4>
7-
</div>
8-
<div class="row">
9-
<div class="{% if example.arrangement contains 'horizontal' %}twelve{% else %}six{% endif %} columns">
10-
{% if example.markdown_content %}
11-
{{ example.markdown_content | markdownify }}
12-
{% endif %}
13-
{% if example.content != "" %}
14-
<div class="z-depth-1">
15-
<pre><code class="{{page.language}}">{{ example.content | xml_escape }}</code></pre>
16-
</div>
17-
{% endif %}
18-
{% if example.description %}
19-
<blockquote>
20-
{{ example.description }}
21-
</blockquote>
22-
{% endif %}
5+
<div class="row auto-eg-padding">
6+
<div class=" row twelve columns">
7+
<h4 id="{{ example.name | replace:' ','-' | remove:',' | downcase | strip_html }}">
8+
<a class="no_underline plot-blue" href="#{{ example.name | replace:' ','-' | remove:',' | downcase | strip_html }}">{{ example.name }}</a>
9+
</h4>
2310
</div>
24-
{% if example.plot_url %}
11+
12+
<div class="row">
2513
<div class="{% if example.arrangement contains 'horizontal' %}twelve{% else %}six{% endif %} columns">
26-
<div class="border" style="text-align:center;">
14+
{% if example.markdown_content %}
15+
{{ example.markdown_content | markdownify }}
16+
{% endif %}
17+
{% if example.content != "" %}
18+
<div class="z-depth-1">
19+
<pre><code class="{{page.language}}">{{ example.content | xml_escape }}</code></pre>
20+
</div>
21+
{% endif %}
22+
{% if example.description %}
23+
<blockquote>
24+
{{ example.description }}
25+
</blockquote>
26+
{% endif %}
27+
</div>
28+
{% if example.plot_url %}
29+
<div class="{% if example.arrangement contains 'horizontal' %}twelve{% else %}six{% endif %} columns">
2730
{% if example.plot_url contains '.gif' or example.plot_url contains '.png' %}
28-
<img src="{{ example.plot_url }}" />
31+
<img src="{{ example.plot_url }}" />
2932
{% else %}
30-
<iframe id="auto-examples" src="{{ example.plot_url }}{% if example.plot_url contains 'plot.ly' %}.embed{% endif %}"
33+
<iframe id="auto-examples" src="{{ example.plot_url }}{% if example.plot_url contains 'plot.ly' %}.embed{% endif %}"
3134
style="width: {% if example.width %}{{example.width}}px;{% else %}100%;{% endif %} height: {% if example.height %}{{example.height}}px;{% else %}550px;{% endif %} border: none;"></iframe>
3235
{% endif %}
3336
</div>
34-
</div>
35-
{% endif %}
36-
</div>
37+
{% elsif page.language == "plotly_js" and (example.content contains "'myDiv'" or example.content contains '"myDiv"') %}
38+
<div class="{% if example.arrangement contains 'horizontal' %}twelve{% else %}six{% endif %} columns">
39+
<form style="margin-bottom: 35px; font-weight: 'Open Sans', sans-serif;" action="https://codepen.io/pen/define" method="POST" target="_blank">
40+
<input type="hidden" name="data"
41+
value="{&quot;title&quot;:&quot;Plotly.js {{example.name}}&quot;,&quot;html&quot;:&quot;&lt;head&gt;\n\t&lt;!-- Load plotly.js into the DOM --&gt;\n\t&lt;script src='https://cdn.plot.ly/plotly-latest.min.js'>&lt;/script&gt;\n&lt;/head>\n\n&lt;body&gt;\n\t&lt;div id='myDiv'&gt;&lt;!-- Plotly chart will be drawn inside this DIV --&gt;&lt;/div&gt;\n&lt;/body&gt;&quot;,&quot;js&quot;:{{example.content | jsonify | escape | replace: "your access token", "pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ"}}}">
42+
<input style=" float: right; background-color:#119dff; border-radius: 4px; color: white;" class="codepen-submit" type="submit" value="Try It On CodePen!">
43+
</form>
44+
{% capture unique_myDiv %}myDiv_{{counter}}{% endcapture %}
45+
<div style="max-width: 100%; margin: auto" id="{{unique_myDiv}}"></div>
46+
<script>
47+
{{ example.content | replace: 'myDiv', unique_myDiv | replace: "your access token", "pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ"}}
48+
</script>
49+
</div>
50+
{% endif %}
3751
</div>
38-
3952
</div>
40-
{% endfor %}
53+
{% endfor %}
54+

_posts/plotly_js/basic/WebGL/2018-08-07-webgl_100000-points.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: WebGL with 100,000 points
3-
plot_url: https://codepen.io/plotly/embed/wxEeGx/?height=500&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: webgl-vs-svg
65
order: 1

_posts/plotly_js/basic/WebGL/2018-08-07-webgl_1mill-points.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: WebGL with 1 Million points
3-
plot_url: https://codepen.io/plotly/embed/OwBPaP/?height=500&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: webgl-vs-svg
65
order: 2

_posts/plotly_js/basic/WebGL/2018-08-07-webgl_many-traces.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: WebGL with many traces
3-
plot_url: https://codepen.io/plotly/embed/VBELPZ/?height=300&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: webgl-vs-svg
65
order: 3

_posts/plotly_js/basic/area/2015-04-09-basic-area.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Basic Overlaid Area Chart
3-
plot_url: https://codepen.io/plotly/embed/d7cac856a2a4f35bbec4b08e7845c14f/?height=500&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: area
65
order: 1

_posts/plotly_js/basic/area/2015-04-09-hoveron.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Select Hover Points
3-
plot_url: https://codepen.io/plotly/embed/zpgvpz/?height=463&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: area
65
order: 3

_posts/plotly_js/basic/area/2015-04-09-stacked-area.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Stacked Area Chart
3-
plot_url: https://codepen.io/plotly/embed/PqLGjK/?height=463&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: area
65
order: 2
@@ -14,4 +13,4 @@
1413
{x: [1,2,3], y: [3,0,2], stackgroup: 'one'}
1514
];
1615

17-
Plotly.newPlot(plotDiv, traces, {title: 'stacked and filled line chart'});
16+
Plotly.newPlot('myDiv', traces, {title: 'stacked and filled line chart'});

_posts/plotly_js/basic/area/2015-08-10-overlaid-area-char-without-boundary-lines.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Overlaid Area Chart Without Boundary Lines
3-
plot_url: https://codepen.io/plotly/embed/19c27282161f7a3b3287ee44896932c5/?height=500&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: area
65
order: 2

_posts/plotly_js/basic/area/2018-09-18-normalized-stacked-area.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
name: Normalized Stacked Area Chart
3-
plot_url: https://codepen.io/plotly/embed/MqzvoO/?height=463&theme-id=15263&default-tab=result
43
language: plotly_js
54
suite: area
65
order: 2.1
@@ -14,5 +13,5 @@
1413
{x: [1,2,3], y: [3,0,2], stackgroup: 'one'}
1514
];
1615

17-
Plotly.newPlot(plotDiv, traces, {title: 'Normalized stacked and filled line chart'});
16+
Plotly.newPlot('myDiv', traces, {title: 'Normalized stacked and filled line chart'});
1817

0 commit comments

Comments
 (0)