2011-08-04 12 views
5

Ok, tengo un gráfico de barras. Y básicamente funciona ... pero las etiquetas en el eje y son un poco largas y envuelven y luego se topan entre sí.Cambiando el ancho del área de la etiqueta del eje y en jqplot

He intentado cambiar el CSS, pero JS lo sobrepasa. Intenté escanear a través de la biblioteca jqplot para averiguar dónde sucede, pero me perdí. Alguna idea? ¿Hay solo una opción que pueda establecer?

Se puede ver aquí:

enter image description here

Aquí está mi archivo html:

<html> 
<head> 
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]--> 
<script language="javascript" type="text/javascript" src="jquery.min.js"></script> 
<script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script> 
<script language="javascript" type="text/javascript" src="jqplot.barRenderer.min.js"></script> 
<script language="javascript" type="text/javascript" src="jqplot.categoryAxisRenderer.js"></script> 
<link rel="stylesheet" type="text/css" href="jquery.jqplot.css" /> 
<script> 
    $(function() { 
     graph_me('chart1',[ 'This is a label', 'This is another label..', 'Is this too long? This looks like it might break','Im not sure, but '], [40, 20, 5, 1]); 
    }); 
    function graph_me(div_name, labels_in, values_in) { 
     var labels = labels_in.reverse(); 
     var values = values_in.reverse(); 
     $.jqplot(div_name, [values], { 
      series:[{ 
       renderer:$.jqplot.BarRenderer, 
       rendererOptions: { 
        barDirection: 'horizontal', 
        varyBarColor: true 
        } 
       } 
      ], 
      axes: { 
       yaxis: { 
        renderer: $.jqplot.CategoryAxisRenderer, 
        ticks: labels, 
        tickOptions: { 
         showGridline: false, 
         markSize: 0 
        } 
       } 
      } 
     }); 
    } 
</script> 
</head> 
<body> 
<div id="chart1" style="height:400px;width:500px; margin: 0 auto;"></div> 
</body> 
</html> 
+0

estoy teniendo el SAE problema icchanobot - ¿lograste encontrar una solución? – davy

+0

@davy: la solución de abajo funcionó para mí, creo que solo necesitaba la parte '! Important' – icchanobot

Respuesta

7

Usted podría intentar esto en el CSS:

.jqplot-yaxis { 
    margin-left:-80px !important; 
    width:80px !important; 
} 
+0

Hola, gracias, lo descubrí usando una respuesta muy similar a esta. – icchanobot

Cuestiones relacionadas