RGraph(javascript)工具提示不在条形图上工作

时间:2016-04-30 05:51:53

标签: javascript tooltip rgraph

我创建了这个函数,它传递频率的数字数组和字母表的数组作为字母。

function buildGraph(frequencies, alphabet) {
    RGraph.Reset(document.getElementById('myCanvas'))
    //Bar Graph Creation
    var data = frequencies;
    tips = [];

    data.forEach(makeString);

    var bar = new RGraph.Bar({
        id: 'myCanvas',
        data: data,
        options: {
            backgroundGridAutofitNumvlines: 0,
            textAccessible: true,
            strokestyle: 'black',
            linewidth: 1,
            shadow: false,
            hmargin: 0,
            colors: ['Gradient(#aaf:blue)'],
            labels: alphabet,
            clearto: 'white',
            gutterBottom: 90,
            noaxes: false,
            crosshairs: true,
            tooltips: tips,
            tooltipsEvent: onmousemove,
        }
    }).wave({frames: 60}); 
};

此函数使数据数组成为字符串

function makeString(item) {
    tips.push(item.toString());
//    console.log(tips.toString());
};

但是当使用工具提示将这些函数实现到我的代码中时,工具提示不会显示在画布上

1 个答案:

答案 0 :(得分:0)

您不能同时启用十字准线和工具提示。每次移动鼠标时都需要使用十字准线重绘画布 - 并重新绘制隐藏工具提示。

http://www.rgraph.net/fiddle/view.html/scope-issue

相关问题