Axis Formatting

136 views
Skip to first unread message

DariusK

unread,
Dec 6, 2007, 4:17:05 PM12/6/07
to Google Chart API
Hi,

I want to create sparklines, and I can almost do that except for one
thing: I need to be able to turn off the default axes so that a line
or bar chart can just "float". So, what I'm able to make right now is
something like this:

http://chart.apis.google.com/chart?cht=lc&chs=100x20&chd=s:ABHaaaaeaaazaa

When what I really want to do is make something like this:

http://sparkline.org/images/CSCO3a.png

Note the lack of axes on the second one. Is there a way to get the
default axes on a line chart to disappear?

Thanks,
Darius

tim lawrenz

unread,
Dec 6, 2007, 5:43:06 PM12/6/07
to Google Chart API
I am interested in creating sparklines, as well.

and thanks for this nice api!

On Dec 6, 10:17 pm, DariusK <darius.kaz...@gmail.com> wrote:
> Hi,
>
> I want to create sparklines, and I can almost do that except for one
> thing: I need to be able to turn off the default axes so that a line
> or bar chart can just "float". So, what I'm able to make right now is
> something like this:
>
> http://chart.apis.google.com/chart?cht=lc&chs=100x20&chd=s:ABHaaaaeaa...

Marty Alchin

unread,
Dec 7, 2007, 10:12:01 AM12/7/07
to google-c...@googlegroups.com
I wholeheartedly agree that the ability to remove axis lines would be
immensely useful to this API. It would allow small charts (most
notably sparklines) to be more easily included in dense tables,
without extra lines cluttering things up.

As an implementation suggestion, I would recommend that if the chxt
argument ignores a particular axis (x, y, r or t) that axis doesn't
show the axis line at all. Currently, there are three different
handlings at work: the standard x and y axes are always present,
regardless of their existence in chxt, while the top axis is always
invisible, regardless of its inclusion in chxt. The right-hand axis is
the only one that exhibits the behavior I believe to be most
effective, so if that behavior could be extended to the other three,
it would be an easy way to help this out.

If someone wishes to keep the existing behavior, they'd simply specify
chxt=x,y explicitly, which is probably for the best anyway.

-Gul

Stuart Langridge

unread,
Dec 7, 2007, 12:35:00 PM12/7/07
to Google Chart API
Ah, doing that breaks the existing API, though. It might be better to
just allow colour control of the axes; at the moment it's possible to
control the colour of labels on the axes, but not the axes themselves.
If there was, say, an argument chac (for axis colour) which took a
comma-separated list of axis colours, in the same order as chxt, then
we could set the colour of the x axis to white. It also means that the
axes aren't always grey, which is nice in itself!

sil

Andrew Chilton

unread,
Dec 7, 2007, 7:44:05 PM12/7/07
to google-c...@googlegroups.com
On 08/12/2007, Stuart Langridge <stuart.l...@gmail.com> wrote:
> Ah, doing that breaks the existing API, [snip]

That may be true, but I think it is a good suggestion to be able to
turn off the axis (rather than fudge it with setting it the same
colour as the background).

Therefore, if you want to change the API, maybe a parameter v=1,
v=1.1, v=2 etc could be used (default v=1). That means you can make
incompatible changes but keep compatibility with older APIs.

I know with Google Maps you can specify which version of the API you
want to use via the URL[1].

How does that sound? :-)

Cheers,
Andy

[1] http://code.google.com/apis/maps/documentation/index.html#API_Updates

--
contact: Andrew Chilton
website: http://kapiti.geek.nz/

Stuart Langridge

unread,
Dec 7, 2007, 8:14:22 PM12/7/07
to Google Chart API
On Dec 8, 12:44 am, "Andrew Chilton" <andychil...@gmail.com> wrote:
> On 08/12/2007, Stuart Langridge <stuart.langri...@gmail.com> wrote:
>
> > Ah, doing that breaks the existing API, [snip]
>
> That may be true, but I think it is a good suggestion to be able to
> turn off the axis (rather than fudge it with setting it the same
> colour as the background).

True, although remember that you could set the colour to, say,
ffffff00, which is fully transparent (rather than "the same colour as
the background") which makes it less of a fudge, and being able to
colour the axes something appropriate is a nice goal in itself; this
kills two birds with one stone, perhaps?

> Therefore, if you want to change the API, maybe a parameter v=1,
> v=1.1, v=2 etc could be used (default v=1). That means you can make
> incompatible changes but keep compatibility with older APIs.

That sort of thing is certainly needed for breaking changes, but it'd
be nice to avoid adding a breaking change entirely if possible :-)

sil

brianpeiris

unread,
Dec 8, 2007, 4:15:38 AM12/8/07
to Google Chart API
A bit off CSS trickery will give you the effect you want:

background: transparent url(http://chart.apis.google.com/chart?
cht=lc&amp;chs=100x20&amp;chd=s:ABHaaaaeaaazaa) no-repeat scroll -1px
1px;
width: 100px; height: 20px;

Here is a demo: http://brianpeiris.googlepages.com/googlechartsapi-sparklines



On Dec 6, 4:17 pm, DariusK <darius.kaz...@gmail.com> wrote:
> Hi,
>
> I want to create sparklines, and I can almost do that except for one
> thing: I need to be able to turn off the default axes so that a line
> or bar chart can just "float". So, what I'm able to make right now is
> something like this:
>
> http://chart.apis.google.com/chart?cht=lc&chs=100x20&chd=s:ABHaaaaeaa...

helly

unread,
Dec 10, 2007, 5:14:34 AM12/10/07
to Google Chart API
Hi,

we will add a new type for spark lines soon.

marcus

On Dec 6, 10:17 pm, DariusK <darius.kaz...@gmail.com> wrote:
> Hi,
>
> I want to create sparklines, and I can almost do that except for one
> thing: I need to be able to turn off the default axes so that a line
> or bar chart can just "float". So, what I'm able to make right now is
> something like this:
>
> http://chart.apis.google.com/chart?cht=lc&chs=100x20&chd=s:ABHaaaaeaa...
Reply all
Reply to author
Forward
0 new messages