I was recently watching a computer class at the school I work in as a
sysadmin play with Microsoft Excel, and I realized something is missing
from the TABLE spec, as drafted in the HTML 3.0 draft and/or the
Netscape, NCSA Mosaic and other implementations: charts and graphs.
Currently the only way to create such charts (and you see them realtively
often) is to make them as pictures, and use the IMG tag to display them.
Here's a better idea I've been thinking about:
We currently have the TABLE tag and its enclosed elements, which allow us
to create a table of data, something like this (for example):
______|_ A _|_ B _|_ C _| Now, we all know how to create this in HTML
One | 123 | 456 | 789 | using TABLE. Ok. Done. I have a table of
Two | 911 | 666 | 555 | numeric data, on my page, with each column
Three | 987 | 654 | 321 | and row labled. Now, in Excel (getting back
to my point), I could select this, hit
graph, and it would come back with a beautifully rendered graph,
something like this:
__________________________ Of course, it would look better, and I could
| | render it in any sort of style I choosed,
| X=One YZ | including 3D and whatnot. Now, I'm sure that
| Y=Two YZ YZ X | browser authors could figure out what Micro-
| Z=Three YZ XYZ XY | soft has figured out, and give us a graph
| YZ XYZ XYZ | from a table, too. So I have an idea I'd
| XYZ XYZ XYZ | like to hear some comments on:
| A B C |
|________________________| We take the basic TABLE spec, as is, and add
an attribute to the main TABLE tag, the
CHART element. If present, it would define a type of chart, and the
browser would take the following table data and attempt to convert it
into a graph. For example, to create the above, I might use <TABLE BORDER
CHART=bar>. We could define a couple basics, say bar, line, pie and
chart. Everything else (including 2D vs. 3D) could be done via style
sheets. Well, actually, charts could be done via style sheets entirely
too, but I think that HTML needs to stand on its own without them, and
this would be a good feature to add directly to the spec.
Of course, it'd be a somewhat optional feature of HTML 3.0 (use that magic
'should' word when discussing implemntation), sorta like displaying the
image in the SRC attribute of IMG or (the proposed) FIG. If the client
was unable to display a graph (either it didn't support it - try doing
this reliably on a vt100 - or the data was too complex or
non-numerical), it would simply display the table, as written.
All the TABLE tags would be supported (BORDER, ALIGN, CLASS, ID, all
that other stuff that no browser supports currently), as with TABLE's
content tags.
And, although the spec (IMO) shouldn't say anything about how the table
is to be formatted, it should reccomend something like the following:
<TABLE CHART=type>
<CAPTION>
Table title
</CAPTION
<TR>
<TH>
</TH>
<TH>
First data point name
</TH>
<TH>
Second data point name
...
</TH>
</TR>
<TR>
<TH>
First data set name
</TH>
<TD>
Data for first data point, first data set
</TD>
<TD>
Data for second data point, first data set
...
</TD>
</TR>
<TR>
<TH>
Second data set name
</TH>
<TD>
Data for first data point, second data set
</TD>
...
</TR>
...
</TABLE>
And so forth. Obviously, that's not perfect (and, if you've kept track,
there's no way - at least that I can see - to make a pie chart with more
than one data set. But then, HTML 3.0 tables also let you, using the
COLSPAN and ROWSPAN attributes, let you overlap tags, so I think it'll
work.)
Comments?
--/ Alexei Kosut <akosut@nueva.pvt.k12.ca.us> /--------/ Lefler on IRC
----------------------------/ <http://www.nueva.pvt.k12.ca.us/~akosut/>
The viewpoints expressed above are entirely false, and in no way
represent Alexei Kosut nor any other person or entity. /--------------