These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

Basic technical graphing features

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Basic technical graphing features

Postby urbanjost » Sun Feb 03, 2008 5:05 am

The HTML <canvas> element features seem to be oriented more towards
displaying vector-based art than technical graphics; thereby missing out
on easily supporting a large number of users. Why do I say this?
My first attempt at using the element to support vector-based graphics
produced by a program that dates back at least three decades was actually more difficult to implement in a <canvas> element that it was on
an HP pen plotter many years ago.

Even though I quickly became a fan of the HTML5 element because of the
ease with which I could interface with standard HTML documents and ECMAScript/JavaScript, I was surprised there was no built-in support for
dashed lines, Hershey/vector fonts, even-odd polygon fill rules, and points.
And yet gradient fill patterns, opacity control, image manipulation, and complex clipping regions were all supported (which I consider more advanced graphic features than a dashed line!).

Yet I found I could quickly create server-side applications or JavaScript
functions that let me get around these problems. The document found
at http://home.comcast.net/~urbanjost/canvas/vogle4.html shows some
simple XY plots containing simple labels, dotted grids, and dashed lines.
This was done with the help of a server-side library, but the functionality
is all very plausibly portable to JavaScript functions.

But everyone does not have routines laying around to do sofware-based
dash codes, ASCII text strings, and grids. However, it looks like others have already raised these issues except for the topic of points (although I don't think anyone brought them up together, pointing out that they are all common elements of any simple XY-plot utility).

Since the other topics have already been breached, I'll make my point
about points!

It is common practice in many graphic formats to represent a polyline
composed of a simple "move2(x,y)" or "move2(x,y) draw2(x,y)"
as a point. Another common solution is to provide a marker(x,y,"name",sz) routine that can draw various markers at points.

It is quite common for a technical plot to be a so-called "scatter" plot
where the data is marked purely by marker symbols or points. It is also
common to unpredictably have a polyline be just a single point. If dashed
lines are going to be supported, it is important to note that almost all dash code models support points as part of the dash-code pattern. Every graphing utility I can thing of supports dotted grids, and so on. Points are so common in technical plots that I strongly prefer
that a polyline that has no length is represented as a filled circle with a
diameter equal to the current line width or as a square centered on the
point with an edge length equal to the current line width.

Inconveniently, the current <canvas> standard says to ignore a polyline with no length. This means any code drawing simple curves has to detect such lines and render them as circles or squares or give them a false non-zero length.

If others have reasons for not wanting to render lines with zero length,
perhaps the solution would be a new graphics state option that would let
you toggle between the two behaviors.

The other surprise was that there was no display list or object definition
capability. Simple plots usually don't make much use of these, except to
define a marker style, but I find them invaluable in nearly any interactive
program.

All that being said, I find the <canvas> element a welcome and overdue
addition to the Web ( I actually liked VML better than either SVG or PDF or
CANVAS because there was a common editor, browser, and drawing utility immediately available that supported it, but I'm practical enough to know VML is now destined to be a proprietary MS-centric product).
urbanjost
<h5>
 
Posts: 16
Joined: Sun Feb 03, 2008 3:48 am

Postby zcorpan » Mon Feb 04, 2008 12:59 am

I think all you've raised has been raised on the list before, but real examples that work around missing features is good stuff so I've forwarded this to the list.

http://lists.whatwg.org/htdig.cgi/whatw ... 13870.html
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Footnote: safari(1) does render points

Postby urbanjost » Fri Feb 22, 2008 11:43 pm

It is worth mentioning that as of this date, safari(1) renders points for polylines of zero length if the line terminator style is "round"; while opera(1) and firefox(1) do not. safari(1) does not render points if the line terminator is "butt" or "square".
urbanjost
<h5>
 
Posts: 16
Joined: Sun Feb 03, 2008 3:48 am

Postby zcorpan » Wed Apr 29, 2009 8:31 am

zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest