def js_callback(self, code_string):
    '''
    return a string that will be used together with the plot creation

    WARNING! The string ReplaceTheDiv is a default string that will be
    replaced in a second moment
    '''

    js_str = '''
    <script>
    // additional js function to select and click on the data
    // returns the ids of the selected/clicked feature

    var plotly_div = document.getElementById('ReplaceTheDiv')
    var plotly_data = plotly_div.data

    // selecting function
    plotly_div.on('plotly_selected', function(data){
    var dds = {};
    dds["mode"] = 'selection'

    featureIds = []
    data.points.forEach(function(pt){
    featureIds.push(parseInt(pt.id))
    dds["id"] = featureIds
        })
    //console.log(dds)
    window.status = JSON.stringify(dds)
    })

    // clicking function
    plotly_div.on('plotly_click', function(data){
    var featureIds = [];
    var dd = {};

    //data.points.forEach(function(pt){
    //featureIds.push(parseInt(pt.id))
    //dd["fid"] = pt.id
    //console.log(pt)
    //   })
    //console.log(featureIds)


    dd["mode"] = 'clicking'

    for(var i=0; i < data.points.length; i++){

    if(data.points[i].data.type == 'scatter'){
    dd["uid"] = data.points[i].data.uid
    //dd["id"] = data.points[i].pointNumber
    dd["type"] = data.points[i].data.type
    console.log(data.points[i].id)

    data.points.forEach(function(pt){
    dd["fid"] = pt.id
    // qui ci sono diretamente gli id dei vari numeri!
    //console.log(data.points[i].id)
        })

    //console.log(dd["fid"])
    }

    else {
    dd["uid"] = data.points[i].data.uid
    dd["id"] = data.points[i].x
    dd["type"] = data.points[i].data.type
    dd["field"] = data.points[i].data.customdata
    }
        }

    console.log(dd)
    window.status = JSON.stringify(dd)
    });
    </script>'''

    return js_str
