【问题标题】:Amcharts XY charts not displaying balloonAmcharts XY 图表不显示气球
【发布时间】:2014-11-22 23:08:23
【问题描述】:

我的图表没有显示气球,我不明白为什么。我在 y 光标上显示了一个气球,我可以将其更改为显示 x 轴的值,但我无法显示一个气球,该气球将在 x 光标上或沿着值线的气球中显示 x 轴值。

http://jsfiddle.net/47qdtboa/

AmCharts.makeChart("chartdiv",
            {
"type": "xy",
"pathToImages": "http://cdn.amcharts.com/lib/3/images/",
"startDuration": 1.5,
"handDrawn": true,
"theme": "light",
"thousandsSeparator": "'",
"chartCursor": {
            "categoryBalloonEnabled": true,
            "valueLineAxis": "ValueAxis-1",
    "valueLineBalloonEnabled": true,
    "valueLineEnabled": true,
        "balloonText": "[[Distance (m)]]",
                    "showBalloon": true,
    "zoomable": false
    },
//"trendLines": [],
    "color":"#777777",
    "fontFamily":"Londrina Outline",
    "fontSize":23, 
    "categoryField": "Distance (km)",
"graphs": [
    {

        "id": "AmGraph-4",
        "balloonText": "[[Distance (m)]]",
        "title": "graph 4",
        "valueAxis": "Not set",
                    "lineColor": "#59C45C",
        "lineThickness": 3,
                    "fillAlphas": 0.13,
        "fillColors": "#59C45C",
        "fillToAxis": "ValueAxis-2",
        "valueField": "Distance (km)",
        "xAxis": "Distance (km)",
        "xField": "Distance (km)",
        "yField": "Elevation (m)"
    }
],
"valueAxes": [
    {
        "id": "ValueAxis-1",
        "axisAlpha": 0,
        "unit": "m"

    },
    {
        "id": "ValueAxis-2",
        "position": "bottom",
        "axisAlpha": 0,
        "unit": "km",
        "showLastLabel": false
    }
],
"allLabels": [],
"amExport": {},
"balloon": {},
"titles": [],
"dataProvider": [
    {
        "Distance (m)": "0",
        "Distance (km)": "0",
        "Elevation (m)": "749"
    },
    {
        "Distance (m)": "101.543639516933",
        "Distance (km)": "0.11",
        "Elevation (m)": "749"
    },

    { and many more like that ...},

【问题讨论】:

    标签: javascript amcharts balloon


    【解决方案1】:

    我在这里更新了你的小提琴......

    http://jsfiddle.net/47qdtboa/1/

    您需要做的基本上是参考 x 或 y 轴而不是字段名称。您还需要在图表中添加项目符号以使气球出现。

    "graphs": [
        {
    
            "id": "AmGraph-4",
            "balloonText": "[[x]] (km)",  /*CHANGED THIS LINE*/
            "bullet": "round",            /*ADDED THIS LINE*/
            "bulletSize": 1,              /*ADDED THIS LINE*/
            "title": "graph 4",
            "valueAxis": "Not set",
            "lineColor": "#59C45C",
            "lineThickness": 3,
            "fillAlphas": 0.13,
            "fillColors": "#59C45C",
            "fillToAxis": "ValueAxis-2",
            "xAxis": "Distance (km)",
            "xField": "Distance (km)",
            "yField": "Elevation (m)"
        }
    ],
    

    不确定您是否可以参考实际的字段名称,但在快速测试中我至少不能。

    【讨论】:

    • 谢谢。这真的让我很痛苦。在这些 confs 中我再也看不到任何东西了……
    • 请记住,激活 XY 图表中的项目符号会减慢整个图表的速度,例如在放大时。我正在尝试找到一种方法来选择性地或放大显示项目符号级别以避免性能下降。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多