I have created this function that is passing in an array of numbers for the frequencies and an array of the alphabet as alphabet.
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});
};
and this function to make the data array into a string
function makeString(item) {
tips.push(item.toString());
// console.log(tips.toString());
};
But when these functions are implemented into my code with the tooltips, the tooltips do not display on the canvas
You can't have crosshairs and tooltips enabled at the same time. With crosshairs redrawing the canvas is necessary every time that you move the mouse - and redrawing hides tooltips.