1
votes

I'm creating a bubble chart using AMCHARTS and would like each bubble to be labeled, but it's seeming like a bit of trouble!

The label's reference point is lost on me (seems to be the top left?) and I can't seem to get it to move to where I want it to.

My javascript is as below, and a wee fiddle is attached.

var chart = AmCharts.makeChart("chartdiv", {
    "type": "xy",
    "theme": "light",
    "dataProvider": [{
        "y": 10,
        "x": 14,
        "value": 59
    }],
    "allLabels": [{
        "text": "Label",
        "bold": true,
        "y": 10,
        "x": 14
    }],
    "graphs": [{
        "balloonText": "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>",
        "bullet": "circle",
        "bulletBorderAlpha": 0.2,
        "bulletAlpha": 0.8,
        "lineAlpha": 0,
        "fillAlphas": 0,
        "valueField": "value",
        "xField": "x",
        "yField": "y",
        "maxBulletSize": 100
    }],
    "marginLeft": 46,
    "marginBottom": 35
});

JSFiddle

1

1 Answers

3
votes

You are using the global labels. I guess you want to label each bubble. You have to do this in the "graphs" segment, like this:

"graphs": [{
    "labelText": "[[value]]",
    "labelPosition": "middle"
}],

See docs here

Reworked JSFiddle