Creating a chart with the everviz API

Generating a chart through the everviz API can be a great way of automating your workflow. Here, we will explain how you can utilise the power of our API to create a project.

To use the everviz API, you will need to generate an API key. You can also find more information about the everviz routes from the API section.

You will need to plug in your API key and the team id found from the same page above. The following script will create a column chart and will be viewable within your everviz projects page. If you need to make adjustments, this can also be done inside the interface.

To get more information about the options available to build up the chart, you can view the <a href="https://api.highcharts.com/">Highcharts API</a>.

We have written a NodeJS script, but this can be adapted for any technology you are planning to use.

const fetch = require('node-fetch');

var apiKey = 'ENTER YOUR API KEY HERE',
	TEAM_ID = 'ENTER YOUR TEAM ID HERE',
	url = 'https://api.everviz.com/team/#{TEAM_ID}/chart';

var body = {
  'dataId': undefined,
  'name': 'Chart',
  'referenced': 0,
  'data': {
    'template': [{
      'chart': {
        'type': 'column',
        'polar': false,
        'inverted': false
      }
    }],
    'options': {
      'title': {
        'text': 'Lorem ipsum'
      },
      'subtitle': {
        'text': 'Lorem ipsum'
      },
      'credits': {
        'text': 'Created using Everviz',
        'href': 'https://everviz.com'
      },
      'chart': {
        'type': 'column'
      },
      'series': [{}],
      'plotOptions': {
        'series': {
          'label': {
            'enabled': false
          },
          'groupPadding': 0
        }
      },
      'colors': ['#FE495E']
    },
    'customCode': '',
    'theme': {},
    'settings': {
      'constructor': [
        'Chart'
      ],
      'template': {},
      'plugins': {
        'annotations': 1
      },
      'dataProvider': {
        'csv': 'Label,Value\nA,10\nB,30\nC,20',
        'googleSpreadsheet': false,
        'liveData': false,
        'assignDataFields': [{
          'labels': 'A',
          'values': 'B'
        }],
        'seriesMapping': [{
          'x': 0,
          'y': 1
        }]
      }
    }
  }
};

fetch(url.replace('#{TEAM_ID}', TEAM_ID), {
    method: 'POST',
    body: JSON.stringify(body),
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': apiKey
    }
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch((e) => {
    console.log(e);
});
Did you find what you were looking for? Thank you! There was a problem submitting your feedback. Please try again later.