Andy
Andy

Reputation: 1231

Multiple values per day for Serial Chart? (AmChart)

I have a set of data including possible multiple values for a day.

I would like to plot each single record on the chart to see their distribution.

I tried using serial charts but the problems are 1) many records are missing from the chart (not sure why), and 2) the cursor only hovers the first entry (see the very first Y value only first entry can be hovered.)

var chart = AmCharts.makeChart("chartdiv", {
    "type": "serial",
    "graphs": [{
        "bullet": "round",
        "valueField": "value",
        "lineAlpha": 0
    }],
    "chartCursor": {
        "zoomable": false,
    },
    "categoryField": "date",
    "categoryAxis": {
        "parseDates": true,
    },

    "dataProvider": [{
        "date": "2012-07-27",
        "value": 13
    }, {
        "date": "2012-07-27",
        "value": 11
    }, {
        "date": "2012-07-27",
        "value": 15
    }, {
        "date": "2012-07-27",
        "value": 16
    }, {
        "date": "2012-07-27",
        "value": 18
    }, {
        "date": "2012-08-27",
        "value": 13
    }, {
        "date": "2012-08-02",
        "value": 22
    }, {
        "date": "2012-08-03",
        "value": 23
    }, {
        "date": "2012-08-04",
        "value": 20
    }, {
        "date": "2012-08-05",
        "value": 17
    }, {
        "date": "2012-08-06",
        "value": 16
    }, {
        "date": "2012-08-07",
        "value": 18
    }, {
        "date": "2012-08-08",
        "value": 21
    }, {
        "date": "2012-08-09",
        "value": 26
    }, {
        "date": "2012-08-10",
        "value": 24
    }, {
        "date": "2012-08-11",
        "value": 29
    }, {
        "date": "2012-08-12",
        "value": 32
    }, {
        "date": "2012-08-13",
        "value": 18
    }, {
        "date": "2012-08-14",
        "value": 24
    }, {
        "date": "2012-08-15",
        "value": 22
    }, {
        "date": "2012-08-16",
        "value": 18
    }, {
        "date": "2012-08-17",
        "value": 19
    }, {
        "date": "2012-08-18",
        "value": 14
    }, {
        "date": "2012-08-19",
        "value": 15
    }, {
        "date": "2012-08-20",
        "value": 12
    }]
}

);

Is there any workaround? I also tried XY Chart, but it doesn't have the date support. Thanks

Upvotes: 4

Views: 2278

Answers (2)

zeroin
zeroin

Reputation: 6025

There can be only one data item per unique date in amCharts.

You should combine data points into one, like:

{"date":"2012-08-27","value1":10,"value2":12,"value3":14}

and create a separate graph for each value field.

Upvotes: 1

zabutok
zabutok

Reputation: 26

Here is the solution.Suddenly, someone will need

AmCharts.makeChart("chartdiv", {
    categoryAxesSettings: {
      minPeriod: "hh",//(at least that is not grouped)
      groupToPeriods : ["DD", "WW","MM"]//(Data will be grouped by day,week and month)
    }
  });

more

Upvotes: 0

Related Questions