Skodsgn
Skodsgn

Reputation: 981

jQuery flotcharts - add single value to yaxis label

How to add single value to yaxis label? Just like this 80 value: enter image description here

Upvotes: 2

Views: 133

Answers (1)

Raidri
Raidri

Reputation: 17550

1) For the line use markings, for example add this to your chart options:

grid: {
    markings: [ { xaxis: { from: 0, to: 2000 }, yaxis: { from: 80, to: 80 }, color: "black" }, ... ]
    ...
}

Change the from and to values according to your needs and min/max values.

2) For the value on the axis you have to add it manually like this (see the example):

var o = plot.pointOffset({ x: plot.getAxes().xaxis.min, y: 80.0});
$(plot.getPlaceholder()).append("<div style='position:absolute;right:" + (o.left - 4) + "px;top:" + o.top + "px;color:red;font-size:smaller;text-align:right'>80</div>");

Upvotes: 1

Related Questions