File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ # Default ignored files
2+ /shelf /
3+ /workspace.xml
4+ # Editor-based HTTP Client requests
5+ /httpRequests /
6+ # Datasource local storage ignored files
7+ /dataSources /
8+ /dataSources.local.xml
9+ # Zeppelin ignored files
10+ /ZeppelinRemoteNotebooks /
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Plotly</ title >
6+ < script src ="https://cdn.plot.ly/plotly-2.32.0.min.js "> </ script >
7+ </ head >
8+ < body >
9+ < h1 > Plotly json visualizer</ h1 >
10+ < div id ="div-plotly "> </ div >
11+ < div >
12+ < label for ="json-input "> JSON Data:</ label > < br >
13+ < textarea id ="json-input " rows ="10 " cols ="50 "> </ textarea > < br >
14+ < label for ="json-path "> JSON Path (optional):</ label > < br >
15+ < input type ="text " id ="json-path " placeholder ="e.g., data.chart "> < br > < br >
16+ < button onclick ="reloadPlot() "> Reload Plot</ button >
17+ </ div >
18+ < script >
19+
20+ function reloadPlot ( ) {
21+ const jsonData = document . getElementById ( 'json-input' ) . value ;
22+ const jsonPath = document . getElementById ( 'json-path' ) . value ;
23+
24+ try {
25+ let plotData = JSON . parse ( jsonData ) ;
26+
27+ if ( jsonPath ) {
28+ const pathParts = jsonPath . split ( '.' ) ;
29+ for ( const part of pathParts ) {
30+ plotData = plotData [ part ] ;
31+ }
32+ }
33+
34+ Plotly . newPlot ( document . getElementById ( 'div-plotly' ) , plotData ) ;
35+ } catch ( error ) {
36+ console . error ( 'Error:' , error ) ;
37+ alert ( 'Invalid JSON data or JSON path' ) ;
38+ }
39+ }
40+
41+ </ script >
42+ </ body >
43+ </ html >
You can’t perform that action at this time.
0 commit comments