Adding JS code to an HTML page

how can I insert the gauge graph created using js on bolt cloud into an Html webpage and deploy it to the product using the same Html webpage??

JS Code:
setChartLibrary(‘google-chart’);
setChartTitle(‘Gauge Chart’);
setChartType(‘gauge’);
setAxisName(‘ldr1’);
setDimensions(400,400);
setMaxValue(1023);
setGreen(500,1023);
plotChart(‘ldr1’);

*written in the code part of product configuration using .js extension

want to embed the above gauge graph into the html code and deploy it by copying the html code to the code part of product configuration using .html extension.

@francis.ashwin7 , I know it feels great in thinking of an idea where you can integrate the Bolt Cloud’s functionalities along with your own designed UI.

But as the graphs’ internal working and evaluation is processed at the backend of Bolt’s server. This means that only the Bolt’s IDE knows what plotChartLibrary,setAxisName and other functionsare. So you can’t use these functions in the form of JS alongwith HTML becuase of these 02 facts:

  1. In the Bolt IDE you cant deploy one html and one js file for a single product.
  2. In the external IDE, you can’t use the plotGraph and all other graph related functions because those IDEs will not be able to recognize these functions

So it concludes that you can’t access the Bolt’s selfmade js functions for the graphs other than the Bolt Cloud IDE.

Apart from these you can create a project in the Bolt IDE or an external IDE (say VS Code, Atom, Sublime Text or any other). In there create a html file in which you can import a JS file through which you can use the functions like GPIO functions, SERIAL functions, UTILITY functions. The link of JS file is as follows: https://cloud.boltiot.com/static/js/boltCommands.js . By including this js in the html file you can use the GPIO, UART and utility commands along with your defined UI

2 Likes

@francis.ashwin7 thanks for the like. Do click on solution button present on the previous post to close the query:)

which function from the https://cloud.boltiot.com/static/js/boltCommands.js I can use to read data from A0 pin and display it in the HTML webpage.

Use the syntax like:
Take Input

Because analogRead function gives the value which is sensed by the device. I hope it clears your doubt

2 Likes