0
周波数の数値の配列とアルファベットのアルファベットの配列を渡すこの関数を作成しました。棒グラフでRGraph(javascript)ツールチップが機能しない
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());
};
しかし、これらの機能は、ツールチップで自分のコードに実装されたときに、ツールチップがキャンバスに表示されません