JqPlot : Set a fix height value for the graph area not including y axe labels

前端 未结 1 1881
青春惊慌失措
青春惊慌失措 2020-12-17 23:01

I am using JqPlot.

The graph height is depending on the height of the main container or the default JqPlot value.

My problem is that if the y label is very l

相关标签:
1条回答
  • 2020-12-17 23:37

    Only thing that comes to my mind is something along these lines presented in this sample.
    After the call to paint the plot, call the below code to get the current plot's size and adjust it accordingly by adding the size taken by the surrounding divs (i.e. title & axes).
    In result whatever you set for the size of your chart in CSS will be taken by the graphical part of the chart, just as you want it.

    var w = parseInt($(".jqplot-yaxis").width(), 10) + parseInt($("#chart").width(), 10);
    var h = parseInt($(".jqplot-title").height(), 10) + parseInt($(".jqplot-xaxis").height(), 10) + parseInt($("#chart").height(), 10);
    $("#chart").width(w).height(h);
    plot.replot();
    
    0 讨论(0)
提交回复
热议问题