Thanks for the response.
The graph reads CSV values from a server and passes the values to a function to plot.
I’m still a beginner with JS however the x,y,error_x ,error_y and legend text are passed to a function for plotting.
this is the function
function makeScatterPlotly( x, y ,dy,dx,legend ){
var plotDiv = document.getElementById(“plot”);
var traces2 = [{
x: x,
y: y,
mode: ‘markers’,
error_y: {
type: ‘data’,
array: dy,
visible: true
},
error_x: {
type: ‘data’,
array: dx,
visible: true
},
type: ‘scatter’,
name: legend,
marker: {
size: 8
},
}];
var layout = {
showlegend: true,
autosize: true,
width: w,
height: h/1.5,
margin: {
t: 20
},
xaxis: {
type: log_x,
title: xaxis_title,
borderwidth: ‘50’,
exponentformat: ‘e’,
showline: true,
rangemode: ‘tozero’,
linecolor: ‘#969696’,
linewidth: 4,
autorange: true,
mirror: true,
zeroline: false
},
yaxis: {
type: log_y,
title: ‘Cross section (barns)’,
exponentformat: ‘e’,
showexponent: ‘All’,
borderwidth: ‘50’,
showline: true,
rangemode: ‘nonnegative’,
linecolor: ‘#969696’,
linewidth: 4,
autorange: true,
mirror: true,
zeroline: false
}
};
Plotly.plot('myDiv', traces2,layout,{displayModeBar: true},{showLink: false});
};