rrubiorr81
rrubiorr81

Reputation: 305

How do i limit the range of the x or y value in High charts?

I would like to limit the range of one of the axis of my chart(lets say a max value of 50), but the data should not be truncated. ie, it should display at the plot for 50, but the tooltip should still contain the real value(ie, 116.6)

series: [ {
            name: 'London',
            data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 116.6, 14.2, 10.3, 6.6, 4.8]
        }]

A base fiddle: http://jsfiddle.net/kD6q3/

Upvotes: 0

Views: 37

Answers (1)

Strikers
Strikers

Reputation: 4776

you can do this in this way,

maintain 2 data sets, one to plot the values and other to show on tooltip.

now manage which value is to be shown from tooltip formatter

data section:

realValues = [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 116.6, 14.2, 10.3, 6.6, 4.8];
data = [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 50, 14.2, 10.3, 6.6, 4.8]

tooltip section

tooltip: {
    formatter: function() {
        return realValues[this.point.x] + '°C'
    }
},

updated your fiddle here for reference : http://jsfiddle.net/kD6q3/1/

Upvotes: 1

Related Questions