Regarding the JavaScript code that we use in bolt project development

Hello , first of all,
I’m enjoying the course and I’m understanding everything clearly , thanks to the mentor for using the best suited vocabulary !!

Actually , my doubt was ,
That the JS codes that we use to make our projects on bolt module ( I have till yet done the light intensity monitoring project only) , are the customised JS codes specially made for only the bolt module to understand or we can use these codes and it’s syntax , universally , I mean with other types of wifi modules(may not be bolt module) which supports JS codes…?

For example ,
The setChartType(), setChartLibrary (),setAxisName()…etc functions that we used in our project 1 JS coding are specially JS code functions made for Bolt module only or these code,functions and syntax are universally true with other types of WiFi modules also which supports JS…?

Please help me clearing this doubt …

Hii @virajsheth0810
You can make user defined functions in JavaScript by the function keyword . The function definition can be your statements or procedures. You can also pass arguments to these functions. You have to include your javascript functions in your html code by the < script > tag. You can write any functions according to your choice of statements in javascript. You will learn about javascript in the training also .
I hope this will help you
Thank you!!

1 Like

yes you can use these functions outside bolt console.
you may have to declare some functions first to call the functions mentioned above .
example:
var chartBuilder = sheet.newChart();
.setChartType(Charts.ChartType.BAR)
hope this helps you.

1 Like

Hii @madhu8dec
Thank you so much for your response …I get it now

Hii @pratheekreddy.t,
Thank you so much , I got that , but as you said inorder to use these functions outside bolt console I must declare them first
But from where should I learn the syntax required to declare these functions other than bolt console?

Because as I have only the knowledge to declare them on bolt console only , which I’ll be learning from the course , but what if it may happen that I m working on a project 1(plant light intensity monitor) other than bolt module , so for writing the JS code for that module I must write this same code that I used for Bolt or the code will differ ,
Also as u said I must define it first , but to define it in another module , from where can I learn that defining process as u said
example:
var chartBuilder = sheet.newChart();
.setChartType(Charts.ChartType.BAR)

Pls someone help me out

Hi @virajsheth0810,

Those functions are written on top of the Gráfico de líneas  |  Charts  |  Google for Developers to start the quick development.

So you already have access to Bolt Cloud api, you can write your own ajax function to fetch the data from Bolt Cloud API inside your html file.

And after fetching the data, just pass this data to data section of google chart.

So you have to do all this code inside the html file but you have to write the javascript code inside the javascript tag.

Check this file for bulb control ui-templates/bulb/bulb.html at master · Inventrom/ui-templates · GitHub

You start write some code and share it here. I will be happy to help.

Do let me know in case you need any other information.