jqPlot显示带有光标的自定义工具提示
jqPlot displaying custom tooltip with cursor
我使用Cursor插件在jqplot图表上显示一条竖线。光标插件的工具提示显示了X和Y值。
我想在plot points中添加一个元数据。
[x,y,1337]其中1337为元数据。
我想修改光标插件的工具提示,以显示这个元数据以及它已经显示的数据。
用例:我有多个系列,所有系列的趋势都缩放到0-100。我需要显示未缩放的值
更新:我已经得到了它的工作通过破解jqplot.cursor.js,有更好的方法吗?
Line 468: function updateToolTip(gridpos, datapos, plot){
// ...
s += $.jqplot.sprintf(c.tooltipFormatString, label, sx, sy, data[2]);
这就是我如何覆盖tooltipContentEditor
jqplot函数,它工作得很好。
highlighter: {
show: true,
showMarker:true,
showTooltip:true,
sizeAdjust: 10,
tooltipLocation: 'se',
tooltipAxes: 'xy',
yvalues: 1,
formatString:'<table class="jqplot-highlighter"><tr><td>date:</td><td>%s</td></tr><tr><td>PiecesPerHour:</td><td align="right">%s</td></tr></table>',
useAxesFormatters: true,
tooltipContentEditor: function(str, seriesIndex, pointIndex, plot){
var data = plot.series[seriesIndex].data[pointIndex];
var label = plot.legend.labels[seriesIndex].indexOf('Target')
var format = [];
//A little formatting to the data before I join it to the Html string
if (that.model.get('groupBy')==='month')
format[0] = new Date(data[0] + 1000*60*60*24).format('mmmm yyyy');
else
format[0] = new Date(data[0] ).format('mmmm dd, yyyy');
format[1] = new Number(data[1]).toFixed(1)
//join the data to the Html string:
str = $.jqplot.sprintf.apply($.jqplot.sprintf, [str].concat(format));
return str;
}
}
基本上你得到系列和点的数据,并与sprintf连接到一个Html字符串,然后返回字符串
相关文章:
- MVC中关于表的自定义工具提示-每行显示数据
- 图表.js - 具有多个值的自定义工具提示
- AngularJS中的自定义工具提示
- FancyBox和自定义工具提示一起使用不起作用
- 如何在堆栈中创建具有不同颜色和自定义工具提示的堆积柱形图
- KendoUI堆叠条形图自定义工具提示
- 如何将自定义工具提示添加到 jqxwidget 部分饼图系列
- 自定义工具提示的基本思想,使用纯Javascript
- 如何使用人力车库在折线图上显示自定义工具提示
- 显示图表点上的自定义工具提示
- Google图表中的自定义工具提示只适用于focustarget:category
- 如何使用jqueryui创建自定义工具提示动画
- 谷歌可视化:堆叠列.HTML自定义工具提示的问题
- 图表JS自定义工具提示,X轴和Y轴的%和标签
- jqPlot显示带有光标的自定义工具提示
- Highcharts自定义工具提示
- 我的自定义工具提示不会随着我悬停在其上的相应元素移动
- 使用jquery插件创建自定义工具提示
- 为气泡图/高图添加自定义工具提示
- Syncfusion JS图表自定义工具提示