Analytics

A component to show analytics for providers

In this component we used a data driven elements library react-vis to help us showing the providers the statistics of there newspaper in our application. we need to install the library first.

npm install react-vis

The react-vis library has many options to visualize the data coming from the back-end server.

In this component we used the window.obj to pass the information to the front-end.

in the following code you can find an example of test object containing the names used in the back-end object to enable any future changes

 const TestObj = {
  "name": "Hesari",
  "revenue": 0.5,
  "payment_percent": {
    "monthly": 0.6,
    "package": 0.3,
    "single": 0.1
  },
	"articles": [
	    {
	      "name": "article_name_1",
	      "hits" : 270
	    },
	    {
	      "name": "article_name_2",
	      "hits" : 210
	    },
	    {
	      "name": "article_name_3",
	      "hits" : 150
	    },
	    {
	      "name": "article_name_4",
	      "hits" : 80
	    }
	 ]
};

Last updated

Was this helpful?