Hi Dylan,

"Dylan Browne" <[EMAIL PROTECTED]> wrote on 07/21/2006 05:22:46 
AM:

> I've scanned the archives but didn't see anything that relates to my 
current 
> issue, that is displaying a large number of elements AND those elements 
> containing a great deal of information. 
> 
> For example, as below, this is my code to render a single circle on a 
graph, 
> together with it's associated JS etc. None of the information is 
redundant, as
> far as I can see. 

   It's a little hard to give good suggestion of what information might be
redundant given a sample of one!  But I'll try anyways... ;)

> I was wondering if there is any way to 'compress' this, if 
> that makes sense. I could conceivably need to generate 50,000 of these 
> circular points

   The first thing I would do is as much as possible move things up
to the containing group.  So The main examples I can think of for this
would be fill, stroke, fill-opacity, and your event attributes.
The small amount of really node specific data ("name" for example) can
I think be pulled from what's left on the element (transform for location,
although I would lean towards using getBBox for that), read up on DOM
event capture/bubbling.

   Also It strikes me as odd to have a scale(5.0) and width="5%", either
you should just make it width/height="25%" or more likely you aren't
referencing a symbol element and you can drop the width and height attrs.

   The xlink attrs aren't really needed on the element (I'm sure some of
them are provided by Batik) but I think you must be setting xmlns:xlink
on the use.

   Trim your coordinates to something reasonable (14 decimal places?)...

  <g onmousedown="select_group(evt)" onmouseup="deselect_group(evt)" 
     onmouseout="deselectAll(evt)"/>
    <g fill-opactiy="0.2" fill="blue" stroke="blue"> 
          <!-- note you can have multiple groups if you have
               a few colors you use -->
        <use name="1.0" otherParameterForScript="true"
             transform="translate(145.947, 445.359)"
             width="25%" height="25%"
             xlink:href="#circle"/>
    </g>
  </g>

   I should also mention that you are probably blowing up the DOM
and Graphics tree significantly by using the 'use' element instead of
a simple circle.  Use is potentially good to use if you are referencing
really complex geometry (although I suspect that like Batik many
implementations end up cloning the referenced content so that CSS
cascading can take place - effectively muting the memory savings,
although their is a file size savings, for complex objects).
In this case you are probably needlessly introducing 1-2 group
elements for each circle.

   I would probably change the transform to good old 'cx' 'cy',
but their is nothing really wrong with using transform.

        <circle name="1.0" otherParameterForScript="true"
                transform="translate(145.947, 445.359)"
                width="25%" height="25%"/>

>     xlink:show="embed" xlink:type="simple" xlink:actuate="onLoad"/>

> (I'm using Batik DOM to generate my SVG Document in memory
> and then streaming it to a browser).

   For most use cases you can strip the 'unspecified' attributes
when you serialize the document (these are attributes that are
defined by the language's DTD/Schema).  You can detect them by
calling the 'public boolean Attr.getSpecified()' method.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to