简体   繁体   English

如何使点可点击

[英]How to make point clickable

I use flot to create a 1 line graph, works perfect, but i just can't get my points clickable 我使用flot创建1折线图,效果很好,但是我无法点击要点

<script type="text/javascript">

var options = {
    series: {
        lines: { show: true },
        points: { show: true }

    },
    grid:{hoverable: true, clickable:true}
};

$(function() {
    var rvline = ['.$js_rv_values.']; // data generated by php
    $.plot("#rvgraph", [  { data: rvline}], options);

    $("#rvgraph").on("plotclick",function(event,pos,item){
        if(item){ alert(item.series.data[item.dataIndex]);}
    });
});



</script>

I have read the info on plots'website, but copuld not find the solution. 我已经阅读了地块网站上的信息,但是找不到解决方案。 Also not on Google flot group. 也不在Google Flot组上。 added grid option, which do work, because on hover it get a little bit highligthed circle around it. 添加了网格选项,该选项可以正常工作,因为在悬停时,它周围有一些高亮的圆圈。

I wanted to test the clickevent, but eventually, i want to show a link, based on the array index or gameID (third value of a point) 我想测试clickevent,但是最终我想根据数组索引或gameID(一个点的第三个值)显示一个链接

Generated values look like: var rvline = [[1,1487,"1241417"],[2,1474,"1241418"], etcetera... 生成的值看起来像:var rvline = [[1,1487,“ 1241417”],[2,1474,“ 1241418”],等等。

如文档的“ 自定义网格”部分所述,将网格的“ clickable”选项设置为true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM