显示有关amcharts的文本数据

时间:2018-01-30 09:39:18

标签: amcharts

我使用amcharts绘制了一个图表。生成图表后,我将其另存为PNG图像。

以下是图表的外观: enter image description here

我想添加文本数据,我没有找到任何方法来添加一些文本内容,如下面提到的生成图表(手动在xls上):

enter image description here

以下是我生成图表的方法:

var chart = AmCharts.makeChart("chartdiv", {
"theme": "light",
"type": "serial",
"dataProvider": [
{
    "year": "-----Oxytocin creating behaviours----------",
    "income":0
},
{
    "year": "Curious",
    "income": <?=$q1?>
}, {
    "year":  "Compassionate",
    "income": <?=$q2?>
}, {
    "year": "Trusting",
    "income": <?=$q3?>
}, {
    "year": "Courageus",
    "income": <?=$q4?>
}, 
{
    "year": "Collaborative",
    "income": <?=$q5?>
}, 
{
    "year": "",
    "income": 0
}, 
{
    "year": "-----Oxytocin creating behaviours--------",
    "income":0
},

        {
    "year": "Convinced/Closed",
    "income":<?=$q6?>,
   "color": "#6FE771"
},
 {
    "year": "Isolated",
    "income": <?=$q7?>,
 "color": "#6FE771"
},
 {
    "year": "Suspicious",
    "income":<?=$q8?>,
    "color": "#6FE771"
},
 {
    "year": "Threatened",
    "income": <?=$q9?>,
    "color": "#6FE771"
},
{
    "year": "Disconnected",
    "income": <?=$q10?>,
    "color": "#6FE771"
},
{
    "year": "",
    "income": 0
}, 

    ],

    "valueAxes": [{
    "title": "Conversational Intelligence - Self assessment",
                              "minimum": 0,
"maximum": 5

}],
"graphs": [{
    "balloonText": "Income in [[category]]:[[value]]",
    "fillAlphas": 1,
    "lineAlpha": 0.2,
    "title": "Income",
    "type": "column",
    "valueField": "income",
    "colorField": "color"
}],
"depth3D": 0,
"angle": 30,
"rotate": true,
"categoryField": "year",
"categoryAxis": {
    "gridPosition": "start",
    "fillAlpha": 0.05,
    "position": "left"
},
"export": {
    "enabled": true
 }
});

1 个答案:

答案 0 :(得分:2)

您可以使用url = "https://api.sandbox.ebay.com/sell/inventory/v1/bulk_update_price_quantity"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; //request.ContentType = "application/json; charset=utf-8"; request.Headers.Add("Authorization", "Bearer **OAUTH TOKEN GOES HERE WITHOUT ASTERIKS**"); // Send the request using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write(jsonInventoryRequest); streamWriter.Flush(); streamWriter.Close(); } // Get the response HttpWebResponse response = (HttpWebResponse) request.GetResponse(); if (response != null) { using (var streamReader = new StreamReader(response.GetResponseStream())) { // Parse the JSON response var result = streamReader.ReadToEnd(); } } 上的guides添加模型图片中标记为黄色的文字。

确保同时增加categoryAxis,为这些文字标签腾出空间。

marginRight

这是一个Codepen演示,可以看到(部分)实际操作:https://codepen.io/team/amcharts/pen/5668edd799ed57caa2227fe25efd893c?editors=1010