Kemallyson / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Flot graph overlaps #651

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am getting problems with plotting of charts.

If you check the overlap.png we can see that the y-axis value is overlapping 
with the chart. This overlap happens on the first plotting where the values are 
got from ajax call. From second ajax call onwards the chart becomes proper as 
shown in propergraph.png. I am trying to understand the problem here but i have 
not got any idea yet.
Ajax calls are fired every 2 seconds.

This is the div in jsp
<div id="results" style="position 
:relative;height:300px;width:800px;left:45px;" />

This is the code.
$.plot($("#results"), [{ data:numbers, label: "CPU Usage", color: "#FF0000"}], 
{ series: { lines:{show:true}, points: { show: true }},
 yaxis:{min:0 ,max:100, tickDecimals : 1 ,                           tickFormatter: function (val, axis) {
          return val.toFixed(1) + "%" ;  }  } ,
xaxis: { mode: "time" , timeformat: "%H:%M:%S"  }, 
crosshair: { mode: "x" }, 
grid: { hoverable: true, autoHighlight: false } });
});

$("#results").bind("plothover", function (event, pos, item) {
              $("#x").text(pos.x.toFixed(2));
              $("#y").text(pos.y.toFixed(2));
              if (item) {
                     if (previousPoint != item.dataIndex) {
                           previousPoint = item.dataIndex;
                           $("#tooltip").remove();
                           y = item.datapoint[1].toFixed(2);
                           showTooltip(pos.pageX, pos.pageY, item.series.label + " " + y);
                    }
              }
              else {
                     $("#tooltip").remove();
                     previousPoint = null;            
              }

       });

I have tried the labelMargin(with 30) of grid as well. But the problem is the 
overlap still happens but it is small overlap and after that the yaxis is a bit 
far from the graph.

Can anybody help me with this issue. 

Original issue reported on code.google.com by bharatjo...@gmail.com on 10 Dec 2011 at 6:35

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed the problem. A problem with Css.

Original comment by bharatjo...@gmail.com on 10 Dec 2011 at 10:11

GoogleCodeExporter commented 9 years ago

Original comment by dnsch...@gmail.com on 8 May 2012 at 7:48

GoogleCodeExporter commented 9 years ago

Original comment by dnsch...@gmail.com on 9 May 2012 at 12:50

GoogleCodeExporter commented 9 years ago
i am facing same problem , if possible, can u send css code??

Original comment by keshav.s...@gmail.com on 22 Apr 2014 at 12:44