Results 1 to 6 of 6
  1. #1

    SVG CSS and data

    I have a page I want to draw several SVG polygons on.<br><br>The polygons are coloured according status flags that change at the server end.<br><br>It appears to me that the&nbsp; the dynagrid is ok for this.&nbsp;<br><br>I call for a list of elements - about 30 on my page. the metadat provider supplieds the shapes and ids and my adaptor simply provides the status updates to allow the js to change colours as thing change in my middleware.<br><br>Any guidance on where I can an end to end picture of how to do this?<br><br>

  2. #2
    Join Date
    Feb 2012
    Hi nimbusgb,

    Yes, I confirm that DynaGrid can be used to display your svg polygons and let Lightstreamer updates their style properties.
    Please be sure to add the respective html nodes to those managed by the grid, for example:

    Then you should define a grid cell for your svg polygon:

    HTML Code:
          <td><svg width="40" height="15">
              <rect data-source="lightstreamer" data-field="mypoly" data-fieldtype="extra" data-update="style.width" width="30" height="10" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
    Please note that in this case I have mapped the width property for automatic update with the field mypoly; if you need to update more than a single property you should implement that in the onVisualUpdate, something like this:
    onVisualUpdate: function(key,info,domNode) {
    	if ( info.getCellValue("myflag") ) {
    		info.setCellAttribute("mypoly", "green", "green", "fill");
    	} else {
    		info.setCellAttribute("mypoly", "red", "red", "fill");

    Hope that helps.


  3. #3
    Excellent. I'll get on to that now .......

  4. #4
    Small increments here.

    Each polygon is also sourced from the database. ( usually only once during the snapshot one assumes )

    The colour then changes depending on status.

    So my handcrafted html looks like this

                <div class="svg-container">
                       <svg viewBox="-0.015766113996505737 -0.004459307994693518 344.0315246582031 288.0089111328125" >
                            <polygon style="" id="A2_polygon" points="136.91 247.353 145.347 246.97 148.798 248.887 149.949 251.188 142.279 270.747 138.827 266.912 133.842 266.528 136.526 257.324"/>

    How do I get the points to be served from the db and the fill to be processed at the client end?

    The svg-container on each table row is required to ensure that all shapes are painted relative to the same point on the canvas.

    similarly the viewbox keeps everything in one window.

    I am sourcing the list of points from my db ..... how do I attach them to the points keyword and keep the lot interpreted as svg?

    Last edited by nimbusgb; July 16th, 2019 at 05:30 PM.

  5. #5
    Join Date
    Feb 2012
    Hi nimbusgb,

    One option you could leverage is that in the onItemUpdate callback you cleanup your polygon and associate the new values for points received from Lightstreamer server.
    Something like this:
    onItemUpdate: function(info) {
    			var A2 = document.getElementById(info.getItemName());
    			var SVG_Box = document.getElementById("A2_Box");
    			var Po1 = SVG_Box.createSVGPoint();
    			Po1.x = info.getValue("Po1X");
    			Po1.y = info.getValue("Po1Y");
    			var Po2 = SVG_Box.createSVGPoint();
    			Po2.x = info.getValue("Po2X");
    			Po2.y = info.getValue("Po2Y");
    			var Po8= SVG_Box.createSVGPoint();
    			Po8.x = info.getValue("Po8X");
    			Po8.y = info.getValue("Po8X");
    But I'm not sure if it's actually what you need.


  6. #6
    think that's a little off track.

    I'll keep experimenting.



Similar Threads

  1. Replies: 1
    Last Post: October 2nd, 2017, 09:34 AM
  2. Replies: 1
    Last Post: July 22nd, 2013, 10:28 AM
  3. Passing data dynamicatlly to Java Data Adapter via
    By V S Suresh in forum Adapter SDKs
    Replies: 2
    Last Post: October 25th, 2012, 09:11 AM
  4. Single data provider and multiple data sources
    By pluczak in forum Adapter SDKs
    Replies: 1
    Last Post: April 26th, 2012, 11:50 AM
  5. General data and User specific data
    By mnenchev in forum Adapter SDKs
    Replies: 5
    Last Post: September 1st, 2009, 10:36 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 10:26 AM.