jqPlot - How to change opacity or z-index of canvasOverlay?

前端 未结 2 2032
猫巷女王i
猫巷女王i 2020-12-06 13:57

I would like to show 3 color zones on my graph on the background according to y axis value, as I understand, I cannot control the background color by different colors.

2条回答
  •  有刺的猬
    2020-12-06 14:35

    A much better solution is to use Canvas rectangle object without any hacking http://services.mbi.ucla.edu/jqplot/examples/draw-rectangles.html

    $(document).ready(function(){
      var plot1 = $.jqplot ('chart1', [[30,-10,90,20,50,130,80,120,50]], {
          canvasOverlay: {
            show: true,
            objects: [
              { rectangle: { ymax: 0, xminOffset: "0px", xmaxOffset: "0px", yminOffset: "0px", ymaxOffset: "0px",
                        color: "rgba(0, 0, 200, 0.3)", showTooltip: true, tooltipFormatString: "Too Cold" } },
              { rectangle: { ymin: 100, xminOffset: "0px", xmaxOffset: "0px", yminOffset: "0px", ymaxOffset: "0px",
                        color: "rgba(200, 0, 0, 0.3)", showTooltip: true, tooltipFormatString: "Too Warm" } }
            ]
          } 
      });
    });
    

提交回复
热议问题