0
votes

Labels are not visible in amCharts

My code for creating the chart :

var chart = AmCharts.makeChart("chartdiv", {
    "type": "xy",
    "graphs": [
        {
            "title": "Si (100) Si2p",
            "type": "line",
            "lineAlpha": 1,
            "xField": "eV",
            "yField": "intensity2",
            "lineColor": '#FF0811'            
        }
    ],
    "dataProvider": chartData,
    "allLabels": peakInfo2
});

Please refer fiddle for full code

https://jsfiddle.net/gotquery/9rtx1qot/

I am unable to see the labels in the same. Inspect reveals that the labels are indeed placed but positioned way below the graph (I believe the transform property is setting the position wrongly.) Also there will be multiple graphs .. all of which are displayed properly but no labels.

1

1 Answers

0
votes

The allLabels property is for placing arbitrary text labels in chart area. It's x and y properties are screen coordinates, that are in no way related to axis scale/values.

If you want to place labels at specific x/y value, you can use regular graphs for that. Just add those x/y + label to your chart data and create an additional graph that would display just the labels using labelText:

https://jsfiddle.net/9rtx1qot/2/