gpt4 book ai didi

javascript - 在 amCharts 中隐藏我的 balloonText 旁边显示的值

转载 作者:行者123 更新时间:2023-11-28 03:07:49 29 4
gpt4 key购买 nike

我将首先向您展示我的问题的图片:

当我将鼠标放在我的实时 amChart 的任何一点上时,如图片右侧所示,不仅会显示气球文本,还会显示其标签旁边的 x 轴值!但我不希望数字显示在那里。我该如何解决?

这是我的代码:

                    "graphs": [{
"id": "g1",
"balloonText": "<img src='javascripts/images/info.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[value]]</b></span><img src='javascripts/images/time.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[category]]</b></span>",
"lineColor": colors[c++],
"lineThickness": 1.5,
"negativeLineColor": "#637bb6",
"type": "smoothedLine",
"valueField": "value",
"title": Ctitle[num] + "_a"
}, {
"id": "g2",
"balloonText": "<img src='javascripts/images/info.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[value]]</b></span><img src='javascripts/images/time.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[category]]</b></span>",
"lineColor": colors[c++],
"lineThickness": 1.5,
"negativeLineColor": "#637bb6",
"type": "smoothedLine",
"valueField": "value2",
"title": Ctitle[num] + "_b"
}, {
"id": "g3",
"balloonText": "<img src='javascripts/images/info.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[value]]</b></span><img src='javascripts/images/time.png' style='vertical-align:bottom; margin-right: 5px; width:28px; height:21px;'><span style='font-size:10px; color:#000000;'><b>[[category]]" + new Date().toJSON().slice(0, 10).replace(/-/g, '/') + "</b></span>",
"lineColor": colors[c++],
"lineThickness": 1.5,
"negativeLineColor": "#637bb6",
"type": "smoothedLine",
"valueField": "value3",
"title": Ctitle[num] + "_c"
}],

"legend": {
"position": "right",
"marginLeft": 20,
"autoMargins": false,
"marginBottom": 40,
},

})

提前谢谢你。

最佳答案

要在鼠标悬停时隐藏图例中的值,请设置图例的 valueText属性为空字符串:

legend: {
// ...
valueText: ""
}

下面的演示:

var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"legend": {
"valueText": ""
},
"dataProvider": [{
"date": "2017-06-23",
"value": 4
}, {
"date": "2017-06-24",
"value": 12
}, {
"date": "2017-06-25",
"value": 7
}, {
"date": "2017-06-26",
"value": 13
}, {
"date": "2017-06-27",
"value": 2
}, {
"date": "2017-06-28",
"value": 14
}, {
"date": "2017-06-29",
"value": 12
}, {
"date": "2017-06-30",
"value": 9
}, {
"date": "2017-07-01",
"value": 16
}, {
"date": "2017-07-02",
"value": 1
}, {
"date": "2017-07-03",
"value": 9
}, {
"date": "2017-07-04",
"value": 10
}, {
"date": "2017-07-05",
"value": 16
}, {
"date": "2017-07-06",
"value": 10
}, {
"date": "2017-07-07",
"value": 8
}, {
"date": "2017-07-08",
"value": 17
}, {
"date": "2017-07-09",
"value": 15
}, {
"date": "2017-07-10",
"value": 9
}, {
"date": "2017-07-11",
"value": 16
}, {
"date": "2017-07-12",
"value": 4
}],
"graphs": [{
"valueField": "value",
"title": "graph",
"bullet": "round"
}],
"chartCursor": {},
"categoryField": "date",
"dataDateFormat": "YYYY-MM-DD",
"categoryAxis": {
"parseDates": true
}
})
<script type="text/javascript" src="//www.amcharts.com/lib/3/amcharts.js"></script>
<script type="text/javascript" src="//www.amcharts.com/lib/3/serial.js"></script>
<div id="chartdiv" style="width: 100%; height: 200px"></div>

关于javascript - 在 amCharts 中隐藏我的 balloonText 旁边显示的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45862247/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com