File tree Expand file tree Collapse file tree 7 files changed +237
-0
lines changed Expand file tree Collapse file tree 7 files changed +237
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,12 @@ third_party_libraries:
548
548
url :
549
549
js : " https://cdn.jsdelivr.net/npm/photoswipe@{{version}}/dist/photoswipe-lightbox.esm.min.js"
550
550
version : " 5.4.4"
551
+ plotly :
552
+ integrity :
553
+ js : " sha256-oy6Be7Eh6eiQFs5M7oXuPxxm9qbJXEtTpfSI93dW16Q="
554
+ url :
555
+ js : " https://cdn.jsdelivr.net/npm/plotly.js@{{version}}/dist/plotly.min.js"
556
+ version : " 3.0.1"
551
557
polyfill :
552
558
url :
553
559
js : " https://cdnjs.cloudflare.com/polyfill/v{{version}}/polyfill.min.js?features=es6"
Original file line number Diff line number Diff line change 81
81
<script defer src =" {{ '/assets/js/echarts-setup.js' | relative_url | bust_file_cache }}" type =" text/javascript" ></script >
82
82
{% endif %}
83
83
84
+ {% if page .chart and page .chart .plotly %}
85
+ <!-- Plotly -->
86
+ <script
87
+ defer
88
+ src =" {{ site .third_party_libraries .plotly .url .js }}"
89
+ integrity =" {{ site .third_party_libraries .plotly .integrity .js }}"
90
+ crossorigin =" anonymous"
91
+ ></script >
92
+ <script defer src =" {{ '/assets/js/plotly-setup.js' | relative_url | bust_file_cache }}" type =" text/javascript" ></script >
93
+ {% endif %}
94
+
84
95
{% if page .chart and page .chart .vega_lite %}
85
96
<!-- Vega -->
86
97
<script
Original file line number Diff line number Diff line change 98
98
<script defer src =" {{ '/assets/js/echarts-setup.js' | relative_url | bust_file_cache }}" type =" text/javascript" ></script >
99
99
{% endif %}
100
100
101
+ {% if page .chart and page .chart .plotly %}
102
+ <!-- Plotly -->
103
+ <script
104
+ defer
105
+ src =" {{ site .third_party_libraries .plotly .url .js }}"
106
+ integrity =" {{ site .third_party_libraries .plotly .integrity .js }}"
107
+ crossorigin =" anonymous"
108
+ ></script >
109
+ <script defer src =" {{ '/assets/js/plotly-setup.js' | relative_url | bust_file_cache }}" type =" text/javascript" ></script >
110
+ {% endif %}
111
+
101
112
{% if page .chart and page .chart .vega_lite %}
102
113
<!-- Vega -->
103
114
<script
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : post
3
+ title : a post with plotly.js
4
+ date : 2025-03-26 14:24:00
5
+ description : this is what included plotly.js code could look like
6
+ tags : formatting charts
7
+ categories : sample-posts
8
+ chart :
9
+ plotly : true
10
+ ---
11
+
12
+ This is an example post with some [ plotly] ( https://plotly.com/javascript/ ) code.
13
+
14
+ ```` markdown
15
+ ```plotly
16
+ {
17
+ "data": [
18
+ {
19
+ "x": [1, 2, 3, 4],
20
+ "y": [10, 15, 13, 17],
21
+ "type": "scatter"
22
+ },
23
+ {
24
+ "x": [1, 2, 3, 4],
25
+ "y": [16, 5, 11, 9],
26
+ "type": "scatter"
27
+ }
28
+ ]
29
+ }
30
+ ```
31
+ ````
32
+
33
+ Which generates:
34
+
35
+ ``` plotly
36
+ {
37
+ "data": [
38
+ {
39
+ "x": [1, 2, 3, 4],
40
+ "y": [10, 15, 13, 17],
41
+ "type": "scatter"
42
+ },
43
+ {
44
+ "x": [1, 2, 3, 4],
45
+ "y": [16, 5, 11, 9],
46
+ "type": "scatter"
47
+ }
48
+ ]
49
+ }
50
+ ```
51
+
52
+ Also another example chart.
53
+
54
+ ```` markdown
55
+ ```plotly
56
+ {
57
+ "data": [
58
+ {
59
+ "x": [1, 2, 3, 4],
60
+ "y": [10, 15, 13, 17],
61
+ "mode": "markers"
62
+ },
63
+ {
64
+ "x": [2, 3, 4, 5],
65
+ "y": [16, 5, 11, 9],
66
+ "mode": "lines"
67
+ },
68
+ {
69
+ "x": [1, 2, 3, 4],
70
+ "y": [12, 9, 15, 12],
71
+ "mode": "lines+markers"
72
+ }
73
+ ],
74
+ "layout": {
75
+ "title": {
76
+ "text": "Line and Scatter Plot"
77
+ }
78
+ }
79
+ }
80
+ ```
81
+ ````
82
+
83
+ This is how it looks like:
84
+
85
+ ``` plotly
86
+ {
87
+ "data": [
88
+ {
89
+ "x": [1, 2, 3, 4],
90
+ "y": [10, 15, 13, 17],
91
+ "mode": "markers"
92
+ },
93
+ {
94
+ "x": [2, 3, 4, 5],
95
+ "y": [16, 5, 11, 9],
96
+ "mode": "lines"
97
+ },
98
+ {
99
+ "x": [1, 2, 3, 4],
100
+ "y": [12, 9, 15, 12],
101
+ "mode": "lines+markers"
102
+ }
103
+ ],
104
+ "layout": {
105
+ "title": {
106
+ "text": "Line and Scatter Plot"
107
+ }
108
+ }
109
+ }
110
+ ```
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ codeBlocks.forEach(function (codeBlock) {
8
8
codeBlock . querySelector ( "code:not(.language-echarts)" ) &&
9
9
codeBlock . querySelector ( "code:not(.language-geojson)" ) &&
10
10
codeBlock . querySelector ( "code:not(.language-mermaid)" ) &&
11
+ codeBlock . querySelector ( "code:not(.language-plotly)" ) &&
11
12
codeBlock . querySelector ( "code:not(.language-vega_lite)" )
12
13
) {
13
14
// create copy button
You can’t perform that action at this time.
0 commit comments