Change font size
It is currently Tue Dec 18, 2018 11:49 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Charts on prims using google chart API
PostPosted: Sat Aug 01, 2009 8:38 am 
User avatar

Joined: Sun Jul 19, 2009 5:11 pm
Posts: 8
Google chart API (http://code.google.com/intl/bg/apis/chart/) may be used to draw charts on prims by combining it with osSetDynamicTextureURL function
Various chart types may be drawn by changing the parmeters supplied in the url.

{L_ATTACHMENT}:
googleometer.jpg
googleometer.jpg [ 43.67 KiB | Viewed 2947 times ]


Just place the following script in a prim and tweak the values and captions to meet you requirements

{L_CODE}:
//Anakin Lohner,1 Aug 2009

// This script demonstrates a method for drawing chart on a prim
// by using the google chart api:   http://code.google.com/intl/bg/apis/chart
// The script uses opensim specific functions.
// By modifying the parameters in the url different chart types may be drawn

//Function to draw google-o-meter chart as a texture on a prim
//function parameters:
//-----------------------------------
// value  - value of the meter in percents
// legend - caption drawn above the value
// title    - chart Title
// width  - chaat width in pixels
// height - chart height in pixels

drawGoogleOMeter(integer value, string legend,string title,integer width,integer height)
{
        //compose google api url
        string url = "http://chart.apis.google.com/chart"
        + "?chs="+(string)width+"x"+(string)height
        + "&chd=t:"+(string)value
        + "&cht=gom"
        + "&chtt="+title
        + "&chl="+legend;     
        //create texture from url           
        osSetDynamicTextureURL("","image",url,"",0);       
}

default
{   
    state_entry()
    {
       
       drawGoogleOMeter(25,"25 %","Google-O-Meter Demo",440,220);
    }         
}



This script is inspired by a sample code published in the LSL Wikki.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net