Skip to content Skip to sidebar Skip to footer

Vis.js - Set Graph Label's Font As Bold

I use vis.js to display a graph. I know we can update the node with: nodes.update([{ id: 1, font: { color: '#0d8' } }]); However, I can't update the font weight, for exa

Solution 1:

You need to combine a couple of options to make it work.

A. Set font option in node option:

// in the option object
nodes: {
    font: {
        // required: enables displaying <b>text</b> in the label as bold text
        multi: 'html',
        // optional: use this if you want to specify the font of bold text
        bold: '16px arial black'
    }
}

B. Add html element in the label option:

// in the option object or node data object
label: `<b>${YourLabel}</b>`


So basically, you only need to specify the multi property as html and add <b> element in the label property with your label text.


Solution 2:

var options = {axisFontSize = 30} and then pass to the graph object


Post a Comment for "Vis.js - Set Graph Label's Font As Bold"