1

I was under the assumption the "Play with this data!" link was supposed the show up by default. Any ideas on why it may not appear? I am just working with a basic scatter plot.

Note that this code below is not standalone as is, it is just the excerpt that does the plotly work.

var xData = [];
var yData = [];
var h = results;
for(var k in h) {
    var localdate = k;
    var plotdate = moment(localdate).format('YYYY-MM-DD HH:mm:ss');
    xData.push(plotdate);
    if (currentPort === "t") {
        yData.push(CtoF(h[k]));
    } else {
        yData.push(h[k]);
    };
}
var plotdata = [
    {
        x: xData,
        y: yData,
        type: 'scatter',
        mode: 'markers+lines',
        line: {
            'color': HELIUM_BLUE
        },
        marker: {
            'symbol': 'circle',
            'color': HELIUM_PINK,
            'maxdisplayed': 50
        }
    }
];
var layout = {
    title: currentData,
    xaxis: {
        'title': 'Date / Time'
    },
    yaxis: {
        'title': title
    }
};
Plotly.newPlot(plotHolder, plotdata, layout);

1 Answer 1

1

You would need to add {showLink: true} as the fourth argument (after layout). I guess the default value changed from true to false. If you want to change the caption of the button, use {showLink: true, "linkText": "Play with this data"}

var xData = [1, 2, 3, 4, 5];
var yData = [10, 1, 25, 12, 9];

var plotdata = [
    {
        x: xData,
        y: yData,
        type: 'scatter',
        mode: 'markers+lines',
    }
];
var layout = {
    title: 'Edit me',
    xaxis: {
        'title': 'x'
    },
    yaxis: {
        'title': 'y'
    }
};
Plotly.newPlot(plotHolder, plotdata, layout, {showLink: true, "linkText": "Play with this data"});
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id='plotHolder'>

</div>

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much, this has worked for me. Do you by chance know how I would change the text of the link? It defaults to "Edit data"
Thank you for the assistance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.