Hide the label of xaxis and yaxis ?

3,852 views
Skip to first unread message

Daniel

unread,
Aug 23, 2010, 8:45:11 AM8/23/10
to Flot graphs
Hi, how can I hide the background grid(no lines) and the xaxis + yaxis
labels ?
I tried this:
var arrColors = [];
arrColors[0] = "#005283";
arrColors[1] = "#89a7c5";
$.plot($("#graph2"), [
{
data: arr,
label: null,
xaxis: { ticks: [] },
lines: {
show: true,
fill: true,
lineWidth: 0,
fillColor: { colors: arrColors}
}
}
]);

But it shows some javascript error:
"Ae.p2c is not a function
(function(){jQuery.color={};jQuery.col...){return D*Math.floor(E/D)}})
(jQuery);"

If I don't put xaxis, it works :)

Thanks!

Phillip Howell

unread,
Aug 23, 2010, 12:42:59 PM8/23/10
to flot-...@googlegroups.com
Try:

xaxis: { tickColor: 'white' }

or 

xaxis: { tickColor: 'transparent' }

This may or may not be the best way to do it, but it's worked for me. (I'd love to hear less hackish solutions, if anyone has them.)

-pkh

Daniel

unread,
Aug 23, 2010, 1:33:34 PM8/23/10
to Flot graphs
It gives me the same error:
"axisx.p2c is not a function
ctx.moveTo(axisx.p2c(x1), axisy.p2c(bottom))" on jquery.flot.js

:(

On Aug 23, 1:42 pm, Phillip Howell <phow...@cothm.org> wrote:
> Try:
>
> xaxis: { tickColor: 'white' }
>
> or
>
> xaxis: { tickColor: 'transparent' }
>
> This may or may not be the best way to do it, but it's worked for me. (I'd
> love to hear less hackish solutions, if anyone has them.)
>
> -pkh
>

Phillip Howell

unread,
Aug 23, 2010, 1:41:04 PM8/23/10
to flot-...@googlegroups.com
Oh.

Your arguments to .plot() are wrong. The format of the call is:

  $.plot(placeholder, data, options);

Take a look at API.txt -- xaxis needs to be part of your options, not your data.

-pkh

Daniel

unread,
Aug 23, 2010, 3:53:49 PM8/23/10
to Flot graphs
You're right!
Problem solved, thanks a lot!

On Aug 23, 2:41 pm, Phillip Howell <phow...@cothm.org> wrote:
> Oh.
>
> Your arguments to .plot() are wrong. The format of the call is:
>
>   $.plot(placeholder, data, options);
>
> Take a look at API.txt -- xaxis needs to be part of your options, not your
> data.
>
> -pkh
>

chrisPlusPlus

unread,
Sep 30, 2010, 1:52:38 AM9/30/10
to Flot graphs
You can hide the axis like so:
xaxis: { ticks: false }
Reply all
Reply to author
Forward
0 new messages