2010-10-27 88 views
11

jqPlot更改鼠標懸停時填充的顏色...我想刪除該效果。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

看到你的代碼... – 2010-10-27 11:19:19

+0

這將是有趣的易於創建,隨便抓一個簡單的圖形,設置「填充:真正的」串聯違約,增加變焦控制器,你會看到我的意思是...將在幾個小時後發佈代碼,我從我的工作場所回來... – Shrinath 2010-10-27 16:15:05

回答

25

有在jqueryplot版本的變化0.9.7-546及更高版本增加了一系列的幾個新的屬性:

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

如果設置highlightMouseOver爲false,這會消失。

More details are available in the source code for the line renderer

+0

謝謝肖恩:)我很高興有人終於發佈了一些在這個線程中工作的東西:)我經歷了jqplot的源文件,但沒有找到任何東西,除了我不得不改變他們的繪圖功能... – Shrinath 2010-11-08 03:36:52

+0

非常感謝信息肖恩,似乎工作得很好。 – zenzelezz 2010-11-08 11:43:16

+2

是的,我花了一段時間才弄清楚,但是因爲我看到幾個關於它的問題而沒有答案,所以我決定挖一點。我下載了十幾個版本,並試圖隔離它開始這種行爲的地方,然後我在版本之間做了差異。不幸的是,這導致了3000多行的差異,但是在一次錯誤的開始之後,我能夠通過搜索差異來找到變化。 – 2010-11-08 13:58:34

相關問題