We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a dashboard
point to Dynamic Text
no need for data source as we will use dynamic fake data
Enable Javascript for Dynamic Text here
add the following Script as external resource https://cdn.plot.ly/plotly-2.24.1.min.js
add following html
<body> <div id="addisAbeba"> <!-- Plotly chart will be drawn inside this DIV --> </div> </body>
add following javascript
(async () => { let url = 'https://raw.githubusercontent.com/plotly/datasets/master/3d-scatter.csv'; let fetchData = await fetch(url); let csvData = await fetchData.text(); let rows = csvToJson(csvData); var trace1 = { x: unpack(rows, 'x1'), y: unpack(rows, 'y1'), z: unpack(rows, 'z1'), mode: 'markers', marker: { size: 12, line: { color: 'rgba(217, 217, 217, 0.14)', width: 0.5 }, opacity: 0.8 }, type: 'scatter3d' }; var trace2 = { x: unpack(rows, 'x2'), y: unpack(rows, 'y2'), z: unpack(rows, 'z2'), mode: 'markers', marker: { color: 'rgb(127, 127, 127)', size: 12, symbol: 'circle', line: { color: 'rgb(204, 204, 204)', width: 1 }, opacity: 0.8 }, type: 'scatter3d' }; var data = [trace1, trace2]; var layout = { margin: { l: 0, r: 0, b: 0, t: 0 } }; Plotly.newPlot('addisAbeba', data, layout); })(); const unpack = (rows, key) => { return rows.map(function (row) { return row[key]; }); } const csvToJson = (data, delimiter = ',') => { const titles = data.slice(0, data.indexOf('\r\n')).split(delimiter); return data .slice(data.indexOf('\n') + 1) .split('\r\n') .map(v => { const values = v.split(delimiter); return titles.reduce( (obj, title, index) => ((obj[title] = values[index]), obj), {} ); }); };
Results in
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
Thank you @yosiasz, I updated the previous solution with 3d Scatter, which load external data and is more interesting.
mikhail-vl
Successfully merging a pull request may close this issue.
create a dashboard
point to Dynamic Text
no need for data source as we will use dynamic fake data
Enable Javascript for Dynamic Text here
add the following Script as external resource
https://cdn.plot.ly/plotly-2.24.1.min.js
add following html
add following javascript
Results in
The text was updated successfully, but these errors were encountered: