I was given a task by sir to simplifying the work of construction of graphs using amcharts. My sir had already constructed a graph by making use of an equation.

For making graphs, we have to look into the way using which the graphs are created.

For a simple 2-D graph we have an equation y = f(x). This equation is followed at every point on the graph. The simplest way to create a path is by interpolation i.e. for each point of x we try to find out the corresponding value of y using the equation and finally put the point on the graph. This the most basic and most useful method for creating the graph.

The equation can further be extended into y = f(x) + c1 + c2…. where c1, c2…. are the constants. So what we have to do now is that we have to pass a set of constants too to complete the calculations.

So, my college senior Manpreet Kaur, who created the original version of this made use of this logic and created a function that calculated the value of the equation when all the constants and each value of x was passed into the function.

Now my task was to simplify the work of the construction by making use of some other equation. I decided to make a .json file and define everything in that file and try to take the variables from the JSON file. So that all the initialization must be on one occasion. I was able to make the same graph by making the JSON file and importing the variables from the JSON file.

I was able to make the graph but code is not full proof i.e. the support of some technical person is required to make the graph completely. I decided to use three or four more equations.

### Like this:

Like Loading...

*Related*