Adding multiple rows to AmCharts database

I just started working with AmCharts Javascript Graphics Card Library. My requirement is to draw one chart with one value axis and one date axis. And I have datasets showing results for different team members.

Plus I have one array that stores the consolidated performance of team members, which basically shows the performance of companies.

I came across this date based chart on the am charts I want to use for my application. The problem is that I want to add multiple lines to this diagram that I don't know how to add. I've tried doing this with the given sample code, but there is no way to feed more than one dataset.

I also tried to create separate charts using the new AmCharts.AmGraph () method, but amCharts asks for the data provider at the chart level. Not at the graph level.

Please, help

+3


source to share


1 answer


Just add a second graph to the "Graphs" section ...

    {
        "id": "g2",
        "bullet": "round",
        "bulletBorderAlpha": 1,
        "bulletColor": "#00FF00",
        "bulletSize": 5,
        "hideBulletsCount": 50,
        "lineThickness": 2,
        "title": "green line",
        "useLineColorForBulletBorder": true,
        "valueField": "value2"
    }

      

and also add a second stream to your data ...



    {
        "date": "2012-07-27",
        "value": 13,
        "value2": 10
    }, {
        "date": "2012-07-28",
        "value": 11,
        "value2": 12
    }

      

As you can see, I've added "value2", which will be used as rough data for the second graph. Just make sure you reference this value in the graph section (as you will see in the "valueField" at the top of the code above.

You can see a working example at http://jsfiddle.net/srp8313j/ . I only added a few points for the second graph so you can know what to do.

+8


source







All Articles