Red Heifer





Line Chart: JSON

This line chart is created with C3.js, which unfortunately wants the data formatted somewhat peculiarly.

We have data in the following key-value format:
{
    "Country 1" : [ 6, 5.95, 6.69, 7.47, 3.53, 0.92, 7.21, 4.02, 3.97, 4.18, 4.27],
    "Country 2" : [ 7.45, 7.31, 8.69, 8.74, 5.7, -6.15, 4.4, 4.67, 3.8, 2.02, 3.04],
    "Country 3" : [ 3.82, 3.06, 2.56, 4.43, 2.2, 1.23, 2.53, 2.4, 3.53, 2.62, 2.58],
    "Country 4" : [ 7.58, 8.57, 8.24, 7.54, 4.69, 3.68, 7.62, 6.55, 3.64, 4.02, 4.63],
    "Country 5" : [ 6.48, 5.78, 6.1, 6.51, 4.27, 1.15, 8.04, 4.57, 5.51, 4.99, 5.1]
}
This visualization/Javascript program parses out the keys of this JSON object, and appends them to the beginning of the array. It then feeds those arrays to the C3 visualization. The final data is in the following format:
data : {
    columns: [
                [ "Country 1", 6, 5.95, 6.69, 7.47, 3.53, 0.92, 7.21, 4.02, 3.97, 4.18, 4.27],
                [ "Country 2", 7.45, 7.31, 8.69, 8.74, 5.7, -6.15, 4.4, 4.67, 3.8, 2.02, 3.04],
                [ "Country 3", 3.82, 3.06, 2.56, 4.43, 2.2, 1.23, 2.53, 2.4, 3.53, 2.62, 2.58],
                [ "Country 4", 7.58, 8.57, 8.24, 7.54, 4.69, 3.68, 7.62, 6.55, 3.64, 4.02, 4.63],
                [ "Country 5", 6.48, 5.78, 6.1, 6.51, 4.27, 1.15, 8.04, 4.57, 5.51, 4.99, 5.1]
    ]
}