jQuery flotcharts - 为yaxis标签添加单个值

时间:2022-12-04 10:17:11

How to add single value to yaxis label? Just like this 80 value: jQuery flotcharts  - 为yaxis标签添加单个值

如何为yaxis标签添加单个值?就像这个80值:

1 个解决方案

#1


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

1)对于线路使用标记,例如将其添加到图表选项中:

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.

根据您的需要和最小/最大值更改from和to值。

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

2)对于轴上的值,您必须像这样手动添加它(参见示例):

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>");

#1


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

1)对于线路使用标记,例如将其添加到图表选项中:

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.

根据您的需要和最小/最大值更改from和to值。

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

2)对于轴上的值,您必须像这样手动添加它(参见示例):

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>");