jqplot在鼠标悬停时改变图形的颜色。

11

jqPlot 当鼠标悬停时会改变填充颜色...我想要去掉这个效果.. 怎么做?

以下是使用的选项:

var options={
    series: [{
            neighborThreshold: -1,
            shadowAngle:0,
            shadowOffset:2.5,
            shadowAlpha:.05,
            shadowDepth:5
        }],
    seriesDefaults: {
        color: '#224',
        fill: true,        // fill under the line,
        fillAndStroke: true,       // *stroke a line at top of fill area.
        fillColor: '#66CCCC',       // *custom fill color for filled lines (default is line color).
        fillAlpha: 0.2,       // *custom alpha to apply to fillColor.
        markerRenderer: $.jqplot.MarkerRenderer,    // renderer to use to draw the data
        // point markers.
        markerOptions: {
            show: false,             // wether to show data point markers.
            style: 'filledCircle',  // circle, diamond, square, filledCircle.
            // filledDiamond or filledSquare.
            lineWidth: 2,       // width of the stroke drawing the marker.
            size: 9,            // size (diameter, edge length, etc.) of the marker.
            color: '#FFFF00',    // color of marker, set to color of line by default.
            shadow: true,       // wether to draw shadow on marker or not.
            shadowAngle: 45,    // angle of the shadow.  Clockwise from x axis.
            shadowOffset: 1,    // offset from the line of the shadow,
            shadowDepth: 3,     // Number of strokes to make when drawing shadow.  Each stroke
            // offset by shadowOffset from the last.
            shadowAlpha: 0.07   // Opacity of the shadow
        },
        trendline: {
            show: false,         // show the trend line
            color: '#666666',   // CSS color spec for the trend line.
            label: '',          // label for the trend line.
            type: 'linear',     // 'linear', 'exponential' or 'exp'
            shadow: true,       // show the trend line shadow.
            lineWidth: 1.5,     // width of the trend line.
            shadowAngle: 45,    // angle of the shadow.  Clockwise from x axis.
            shadowOffset: 1.5,  // offset from the line of the shadow.
            shadowDepth: 3,     // Number of strokes to make when drawing shadow.
            // Each stroke offset by shadowOffset from the last.
            shadowAlpha: 0.07   // Opacity of the shadow
        }
    },
    grid: {
        drawGridLines: true,        // wether to draw lines across the grid or not.
        gridLineColor: '#d0d0d0',    // *Color of the grid lines.
        background: '#ffffff',      // CSS color spec for background color of grid.
        borderColor: '#ffffff',     // CSS color spec for border around grid.
        borderWidth: 2.0,           // pixel width of border around grid.
        shadow: true,               // draw a shadow for grid.
        shadowAngle: 45,            // angle of the shadow.  Clockwise from x axis.
        shadowOffset: 1.5,          // offset from the line of the shadow.
        shadowWidth: 3,             // width of the stroke for the shadow.
        shadowDepth: 3,             // Number of strokes to make when drawing shadow.
        // Each stroke offset by shadowOffset from the last.
        shadowAlpha: 0.07,           // Opacity of the shadow
        renderer: $.jqplot.CanvasGridRenderer,  // renderer to use to draw the grid.
        rendererOptions: {}         // options to pass to the renderer.  Note, the default
        // CanvasGridRenderer takes no additional options.
    },
    axes: {
        xaxis: {
            renderer:$.jqplot.DateAxisRenderer,
            rendererOptions:{tickRenderer:$.jqplot.CanvasAxisTickRenderer},
            tickOptions:{
                formatString:'%b %#d,%y'

            }
        },
        yaxis: {      
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
            borderColor:'#808080',
            renderer: $.jqplot.LogAxisRenderer,
            autoscale:true,
            min:0,
            tickOptions:{formatString:'$%.2f'}
        }
    },
    highlighter: {
        show:true,
        sizeAdjust: 7.5
    },
    cursor:{zoom:true, showTooltip:true},
    legend:{show:false}
};

1
很有趣能够看到你的代码... - Golmote Kinoko
创建起来很简单,只需获取一个简单的图形,将“fill:true”设置为系列默认值,在其中添加缩放控制器,你就会明白我的意思了。几个小时后我会发布代码,我刚从工作地点回来... - Shrinath
1个回答

26

在jqueryplot版本0.9.7-546及以后的版本中,有一些新的系列属性被添加了:

seriesDefaults: {
    rendererOptions: {
        highlightMouseOver: true,
        highlightMouseDown: false,
        highlightColor: null,
    },
},

如果将highlightMouseOver设置为false,这个就会消失。 线渲染器的源代码中有更多细节可用。

谢谢Sean :) 我很高兴终于有人在这个帖子里发布了一些有效的东西 :) 我查看了jqplot的源文件,但除了我必须修改它们的绘图函数之外,没有找到其他任何东西... - Shrinath
2
是的,我花了一段时间才弄清楚,但由于我看到了很多关于这个问题的问题而没有答案,所以我决定深入挖掘一下。我下载了大约十几个版本并尝试隔离它开始出现这种行为的地方,然后我在这些版本之间进行了差异比较。不幸的是,这导致了超过3,000行的差异,但经过一次错误的尝试后,我通过搜索该差异找到了更改点。 - Sean Reifschneider
感谢你的努力,Sean :) 解决方案很好用... 接受你的答案 :) - Shrinath
你知道是否有一种(简单的)方法可以更改悬停效果的行为吗?例如更改悬停不透明度或填充颜色? - Roman

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接