Results 1 to 10 of 31

Thread: Action script

Hybrid View

  1. #1
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,
    you can follow three paths:
    1. Plot a graph with html using our ChartTable (doc), custom code or a third party library
    2. Pass your data through our FlashBridge (doc) to a flash application and create your graph there
    3. Use our Actionscript client (doc) to receive pushed data directly on your flex application.
    HTH

  2. #2
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    I'm digging through the code but have two questions. My adapter changes data very rapidly. Every 0.01 seconds. Can the client plot that recieved data that fast? And second - can CLIENT create timestamp? Like when transmission began - and in two predefined points. Say 30 sec and 60 sec from beggining?

  3. #3
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    My adapter changes data very rapidly. Every 0.01 seconds. Can the client plot that recieved data that fast?
    It depends on your machine and on the client technology that you choose. Probably for the best performance you should choose the path #3 (see my previous post)

    Note that you need a Vivace server to reach such update frequency: http://www.lightstreamer.com/products.htm

    If the update rate is too high for the client you can limit it.
    Be sure to read the General Concepts.pdf file available under LS_HOME/DOCS-SDKs to explore all the possibilities.

    can CLIENT create timestamp?
    what do you mean?

  4. #4
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    ok here's the thing. I'm simulating ECG (electrocardiogram) and I get a set of numbers ranging from -1 to 1. In adapter I send ONLY that value. No timestamp or anything. Value is generated (read from file or outside source) every 0.01 second. I managed to accept the data and I get it. But now I need to plot that line so that we can see how nice our heart beats. The thing is - bandwith is not a problem - since we're using our own servers and network (very powerfull - My college works with Ericsson ) with very high capped bandwith. I got evaluation version of Lightstreamer Vivace. This project I'm working on will be long past done by the time license expires. And when I present the results decision will be made about buying the license.

    Anyway I got carried away... I used the source from number 1 in your earlier post and copied the part which uses the graph. Problem is graph recieves two parameters. Timestamp on X axis and price on Y. Y axis is trivial since I just use the value I get but as for X axis I don't have timestamp... And I don't use schema as well. I just get one value so there's no sense in using schema for that. (I changed the range of X axis to 120 seconds since that is the amount of data we have. And Y axis is between -2 and 2 just so we have some breathing space)

  5. #5
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    p.s. I would use Flex since it looks better but I don't even know where to start with it since I'm a total stranger. I understand a little from your example but that's far from anything usable.

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    p.s. I would use Flex since it looks better but I don't even know where to start with it since I'm a total stranger. I understand a little from your example but that's far from anything usable.

  7. #7
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    ok, you can certainly add your timestamp client-side, in the ChartDemo you can see that the chart is based on fields 3 and 4 (setXAxis & setYAxis calls) but the subscribed table has only two fields: fields 3 and 4 are calculated client side and added to the table through addField calls;

    Btw in case of a timestamp, I advise you to generate it server side to keep your data coherent: the timestamp related to the received data should be the timestamp the data was generated, not the timestamp the data was received&processed (e.g.: imagine your client running on a slow connection or two different clients subscribed to the same data but one client on a speedy machine while the other on a slow machine).

  8. #8
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    I've added the line to push timestamp on the adapter but I still get only the value for presentation. Here's the code part:

    Map<String,String> data = new HashMap<String,String>();
    try {Reader r = new BufferedReader(new FileReader("C:\\primjer.txt"));
    StreamTokenizer stok = new StreamTokenizer(r);
    stok.parseNumbers();
    // double sum = 0;
    stok.nextToken();
    while (stok.ttype != StreamTokenizer.TT_EOF) {
    if (stok.ttype == StreamTokenizer.TT_NUMBER)
    i++;
    if(i%3==2){
    data.put("timestamp", (new Date()).toString());
    data.put("Next", Double.toString(stok.nval));
    listener.update(item, data, false);
    try {
    Thread.sleep(10);
    } catch (InterruptedException e) {
    }
    stok.nextToken();
    }
    stok.nextToken();
    That part of code is in while loop. Now... The problem is that timestamp seems not to be sent. I get only Next. And if I changed that what do I have to add to client so that even timestamp gets shown in table? (Do I need schema or group?)

  9. #9
    Member
    Join Date
    Jul 2009
    Location
    Zagreb
    Posts
    18
    and I got one new idea. I changed the timestamp above into float value that increases by 0.01 and represents time since beggining of stream. I believe I can use it as X axis. But I cannot accept it and show it as time in table on client side. I just get "Next".

  10. #10
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    first of all, sorry if I didn't notice it before, but I see that you're reusing the same map for each update.
    This is not supported, please check the ItemEventListener class description.

    At a first look the rest of the code seems ok, maybe you used the wrong name client side.

    You can send any string through Lightstreamer, but, as long as you plot your chart with our ChartTable, any value on the axis must be a number. You can easily convert your date client-side as we do on the ChartDemo. Don't know about adobe chart libraries.

 

 

Similar Threads

  1. IE script warning
    By jonasby1 in forum Client SDKs
    Replies: 3
    Last Post: July 27th, 2011, 09:58 AM
  2. Replies: 5
    Last Post: December 23rd, 2010, 08:34 AM
  3. Unresponsive Script
    By vaduganathan in forum Client SDKs
    Replies: 1
    Last Post: March 23rd, 2010, 02:38 PM

Bookmarks

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 07:43 PM.