Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

AMCharts is a Javascript chart library that provides a variety of different charts and graphs that are pleasing to the eye and easy to use. We seek to make using their products more convenient for developers who are accessing data made available through RDS.

Step By Step

  • In this example we will create a dataProvider object that can be used with amCharts. We will assume that we have a collection named "test" and a view named "view" with a variable named "var" that has the values 1, 2, and 3. In this example we will run a tabulation that will count the frequencies of each of these values that could be used to create a chart.
  • Running the tabulation would normally look something like this:

    Code Block
    titleTabulation
    http://{host}/rds/test/view/tabulate?dims=var
    Code Block
    titleTabulation Output
     {
        "records": [
            [
                1,
                182
            ],
            [
                2,
                354
            ],
            [
                3,
                126
            ]
        ],
        "info": {
            "colCount": 2,
            "format": "MTNA",
            "includeMetadata": false,
            "limit": 20,
            "offset": 0,
            "moreRows": false
        }
    }
  • We can add the format parameter to specify we want this to be output in a way that amCharts expects us to see it. 

    Code Block
    titleTabulation amCharts
     http://{host}/rds/test/view/tabulate?dims=var&format=amcharts
    Code Block
    titleTabulation amCharts Output
    {
        "dataProvider": [
            {
                "V480003": 1,
                "count": 182
            },
            {
                "V480003": 2,
                "count": 354
            },
            {
                "V480003": 3,
                "count": 126
            }
        ]
    }