问题描述
请检入Codepen(根据官方示例进行一些修改)。
我的问题是:当鼠标无间隔移动时,我是否可以将气球设置为始终指向上一个点。
例如:在codepen中,如果鼠标在2000到2001之间移动,我希望气球指向2000。
/**
* amCharts plugin
* Before the chart is initialized,this plugin will sort the `graphs` array
* by their `index` value
*/
AmCharts.addInitHandler(function(chart) {
// Reorder chart graph's based on their "index" value
chart.graphs.sort(function(a,b) {
if (a.index == b.index) {
return 0;
}
return a.index < b.index ? -1 : 1;
});
},["serial"]);
/**
* Make the chart
*/
var chart = AmCharts.makeChart("chartdiv",{
"type": "serial","legend": {
"align": "center","equalWidths": false,"periodValueText": "total: [[value.sum]]","valueAlign": "left","valueText": "[[value]] ([[percents]]%)","valueWidth": 100
},"dataProvider": [
{
"year": "1994","cars": 1587,"motorcycles": 650,},{
"year": "1995","cars": 1567,{
"year": "1996","cars": 1617,"motorcycles": 691,{
"year": "1997","cars": 1630,{
"year": "1998","cars": 1660,"motorcycles": 699,{
"year": "1999","cars": 1683,{
"year": "2000","cars": 1691,"motorcycles": 737,{
"year": "2001","cars": 1298,{
"year": "2002","cars": 1275,"motorcycles": 664,{
"year": "2003","cars": 1246,{
"year": "2004","cars": 1218,"motorcycles": 637,{
"year": "2005","cars": 1213,{
"year": "2006","cars": 1199,"motorcycles": 621,{
"year": "2007","cars": 1110,{
"year": "2008","cars": 1165,"motorcycles": 232,{
"year": "2009","cars": 1145,{
"year": "2010","cars": 1163,"motorcycles": 201,{
"year": "2011","cars": 1180,{
"year": "2012","cars": 1159,"motorcycles": 277,}
],"valueAxes": [{
"stackType": "regular","position": "left","title": "percent"
}],"graphs": [{
"title": "Cars","valueField": "cars","index": 2
},{
"title": "Motorcycles","valueField": "motorcycles","index": 3
}],"plotAreaBorderAlpha": 0,"marginLeft": 0,"marginBottom": 0,"chartCursor": {
"cursorAlpha": 0,"zoomable": false
},"categoryField": "year","categoryAxis": {
"startOnAxis": true,"axisColor": "#DADADA","gridAlpha": 0.07
},chartCursor: {
cursorPosition: 'mouse',});
#chartdiv {
width: 100%;
height: 500px;
}
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv"></div>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)