I’m still a newb with meteor and I’m trying to get a simple plotly example to work using the following as a resource: https://plot.ly/javascript/getting-started/
I’ve added the plotly npm package, but not sure how to pass the username and key that they require before the package is available to me.
I have tried the following (created a server-side method):
Meteor.startup(function () {
Meteor.methods({
getPlotly: function () {
console.log(‘called plotly’);
const plotly = require(‘plotly’)("##my user##", “##my key##”);
return plotly;
}
});
});
Then I call it from the client:
‘click button.myButton’ ( event, instance ) {
Meteor.call(‘getPlotly’, function( err, res ){
console.log(‘err’,err);
console.log(‘res’, res);
TESTER = instance.find(’#tester’);
//i’ve tried a variety of things here in order to plot…
res.plot( TESTER, [{
x: [1, 2, 3, 4, 5],
y: [1, 2, 4, 8, 16] }], {
margin: { t: 0 } } );
});
}
And I have a div with an id of “tester”.
I’m successfully calling everything and everything seems to log correctly, but not sure how to successfully “plot” items since I need to be authenticated first. When I try this all client side, I get a CORS error. I know this should be super-simple, but can’t wrap my head around it.