jlplot问题与荧光笔

时间:2010-12-25 16:34:14

标签: jquery jqplot

我正在使用jqplot提供的jQuery插件进行制图。 当我使用seriesDefaults:{fill:true}时,荧光笔(工具提示)停止工作。

这是我正在使用的代码。

var line1=[['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84],
    ['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56],
    ['23-Jan-09', 299.14], ['20-Feb-09', 346.51], ['20-Mar-09', 325.99], ['24-Apr-09', 386.15]];

var plot = $.jqplot('chartarea', [line1],
                   {
                    seriesDefaults : { fill : true },
                    title          : "Area chart with tooltip",
                    axes           : {
                                      xaxis : { renderer : $.jqplot.DateAxisRenderer },
                                      yaxis : { tickOptions : { formatString : '$%.2f'} }
                                     },
                    highlighter    : { show : true, sizeAdjust : 7.5},
                    cursor         : { show : false } 
                   });

有没有办法让荧光笔在填充中工作:真实情况。

谢谢..

1 个答案:

答案 0 :(得分:0)

你需要破解介绍jqplot js文件以使其工作。我设法让这个工作,但线下的填充区域不会改变其悬停的透明度。

您可以在JS文件中查找switch (s.renderer.constructor) {,在以下情况下case $.jqplot.LineRenderer:注释if (s.fill) {的代码,只留下其他代码。

你会在$.jqplot.ShapeRenderer.prototype.draw = function(ctx, points, options) {的某个地方收到错误,因为未定义积分,但您可以使用if来检查点是否已设置。

这可能不是最好的解决方案,但我们确实需要填充线的工具提示,这是目前最好的选择。