2010-10-27 42 views
11

jqPlot thay đổi màu tô khi di chuột ... Tôi muốn xóa hiệu ứng đó .. How ??jqplot thay đổi màu sắc của biểu đồ khi di chuột

Dưới đây là các tùy chọn sử dụng:

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

Sẽ rất thú vị để xem mã của bạn ... –

+0

nó dễ dàng để tạo, chỉ cần lấy một đồ thị đơn giản, thiết lập "fill: true" trong giá trị mặc định loạt, thêm bộ điều khiển zoom, và bạn sẽ thấy Ý tôi là .. Sẽ đăng đoạn mã sau vài giờ, tôi quay lại từ nơi làm việc của tôi ... – Shrinath

Trả lời

25

Có một sự thay đổi trong phiên bản jqueryplot 0.9.7-546 và sau đó bổ sung thêm một vài thuộc tính mới cho series:

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

Nếu bạn đặt highlightMouseOver thành false, điều này biến mất.

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

+0

Cảm ơn Sean :) Tôi rất vui vì ai đó đã đăng một thứ gì đó hoạt động trong chủ đề này :) Tôi đã xem qua các tệp nguồn của jqplot, nhưng đã không tìm thấy bất cứ điều gì ở đó, khác hơn là tôi phải thay đổi chức năng âm mưu của họ ... – Shrinath

+0

Cảm ơn rất nhiều thông tin Sean, dường như làm việc rất tốt. – zenzelezz

+2

Vâng, tôi mất một lúc để tìm ra, nhưng vì tôi thấy một số câu hỏi về nó mà không có câu trả lời, tôi quyết định đào một chút. Tôi đã tải xuống khoảng một chục phiên bản và cố gắng để cô lập nơi nó bắt đầu hành vi này, sau đó tôi đã làm một sự khác biệt giữa các phiên bản. Thật không may, điều đó dẫn đến một sự khác biệt hơn 3.000 dòng, nhưng sau một khởi đầu sai, tôi đã có thể tìm thấy sự thay đổi bằng cách tìm kiếm sự khác biệt đó. –

Các vấn đề liên quan