【发布时间】:2016-12-20 09:29:31
【问题描述】:
我制作了一些图表,可能会在其中放置一个标记,但我不明白如何使标记与 y 轴值一起悬停。
$.plot($("#flot-chart-@ControlID"), series_@ControlID, {
series: {
lines: {
lineWidth: 2,
fill: @((Model.Series.Count() == 1).ToString().ToLower()),
},
bars: {
barWidth: 0.6,
align: "center"
},
points: {
fill: @((Model.Series.Count() == 1).ToString().ToLower()),
}
},
xaxis: {
ticks: xlabels_@ControlID,
tickDecimals: 0
},
colors: @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Series.Select(o => o.Color).ToArray())),
grid: {
color: "#999999",
hoverable: true,
clickable: true,
borderWidth: 0,
@if (Model.LimitLine != null)
{
<text>
markings: [
{ color: '#000', lineWidth: 1, yaxis: { from: @Model.LimitLine, to: @Model.LimitLine }},
]
</text>
}
},
legend: {
show: true
},
tooltip: true,
tooltipOpts: {
content: function(label, xval, yval) {
var content = getLabel_@(ControlID)(xval) + ": " + yval;
return content;
},
}
});
如何显示带有值的工具提示?
图表示例:
【问题讨论】:
标签: javascript jquery html charts flot