jquery sparkline highlight bar on load

350 views Asked by At

I'm using the jQuery sparkline library to render a bar chart.

The bar chart will highlight the bars on mouseover however I would like to highlight a specific bar on load.

Is there a way highlight an individual bar when the sparkline is first displayed?

1

There are 1 answers

0
JP. Aulet On

Without viewing any code is more difficult, but if you have a Mouse-over Events to hightlight, you could use the range_map to assign a different value in the first load:

barColor = '#0000FF';   //assign a color to the bar (i.e: blue)

//i.e if you know that the bar highlighted is the nºX bar:

var selected = X;
var range_map = $.range_map({
    selected: 'red'
})

This way, you will have a blue bar char with the X bar in red. Hope it works for you.