简体   繁体   中英

JqPlot Bar and Line Chart

I have a line and barchart made from jqplot. The problem is, whenever I have my cursor on the bar the line chart plot goes invisible. I want the User to be able to move the cursor on the line plot so, that I can highlight some information to the User. Thanks in advance.

在此处输入图片说明

Edit:

function gkDrawBarAndLineChart(location) {
var s1 = [4, 7, 9, 15];
var s2 = [12, 6, 19, 8];
var s3 = [[1, 28], [2, 13], [3, 54], [4, 47]];
var values=  [s1,s2,s3]
var dates = ['2012-10-22', '2012-10-23', '2012-10-24', '2012-10-25']

                var optionsObj = {
                title: 'Report',
                 animate: !$.jqplot.use_excanvas,
                axes: {
                     xaxis: {
                        renderer: $.jqplot.CategoryAxisRenderer,
                        ticks: dates
                    },
                    yaxis: {
                        tickOptions: { showMark: true, formatString: "%d" }, 
                        padMin: 0   
                    },
                },

                grid: {
                    borderColor: "#fff",
                    background: "#FFF",
                    drawGridlines: true,
                    shadow: true
                }, 

                series: [
                    {label:'Open',renderer:$.jqplot.BarRenderer, },
                    {label:'Incoming', renderer:$.jqplot.LineRenderer, color:'red', },
                    {label:'Resolved', renderer:$.jqplot.LineRenderer, color:'green'}
                    ],

                legend: {
                    show: true,
                    location: 'ne'
                    },
                seriesDefaults:{
                    shadow: false,
                    rendererOptions:{
                       barPadding: 0,
                       barMargin: 10,
                       barWidth: 25,
                   },
                },
                highlighter : {
                show : true,
                sizeAdjust : 7.5,
                formatString:'<table class="jqplot-highlighter"> \
                              <tr><td>Timestamp:</td><td>%s</td></tr> \
                              <tr><td>Value:</td><td>%s</td></tr>',
                },
            };

                var plot2 = $.jqplot(location, values, optionsObj);
            }       

try the following

seriesDefaults:{
                  shadow: false,
                  rendererOptions:{
                   barPadding: 0,
                   barMargin: 10,
                   barWidth: 25,
                  highlightMouseDown: true
               }    //Removing the Comma
            },

Here is working fiddle for you

according to jqplot you can turn of the default highlighting using highlightMouseDown: true

If I understood correctly hovering mouse over bar chart makes line chart invisible. The solution is to add "highlightMouseOver: false" to BarRenderer options.

renderer: $.jqplot.BarRenderer,
      rendererOptions: {
         highlightMouseOver: false
      }

Fiddle: http://codepen.io/alkuzad/pen/LpyawY

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM