Adam Sayler

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAdam Sayler
ToMe
SubjectHelp with Multigraph.js script customization
Date9 June 2004 17:35
Hi,

I'm using your script in a box that is stand alone for graphing some 
system information.  I really like the script and have some java/java 
script experience but I was having trouble finding where I could make 
the X axis scale static and set to a predefined amount.  I was wanting 
to make a graph of my radio signal strength with a scale of 0 - 50.  Is 
this possible?

Thanks,
Adam
FromMe
ToAdam Sayler
SubjectRe: Help with Multigraph.js script customization
Date10 June 2004 9:31
Adam,

I assume you mean you want to make the Y axis static, not the X axis.

change:
function MWJ_graph(oW,oH,oType,oLegend,oRotate,oColor) {
to:
function MWJ_graph(oW,oH,oType,oLegend,oRotate,oColor,oLimit) {
    this.ylimit = oLimit;

Change:
if( minH == maxH ) { maxH = 1; }
to:
if( this.ylimit ) { maxH = this.ylimit; }
if( minH == maxH ) { maxH = 1; }

now when you want to set the Y axis range of a graph, pass an extra value
to the constructor:
var g = new MWJ_graph(400,300,MWJ_stacked,true,false,'#bfbfbf',50);

This may cause problems in some cases, since it does no error checking (one
of the reasons I did not include this functionality in the first place).
However for what you want to do, this is perfectly fine.

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromAdam Sayler
ToMe
SubjectRe: Help with Multigraph.js script customization
Date10 June 2004 17:39
Attachmenta screenshot of some graphs made using my script (in Safari [or something made to look like it] - if you were wondering)
Mark,

Thanks for the response.  Yes, it was the Y axis sorry about that.  I 
had it tilted 90deg.  I had a couple of follow up questions...

 Do I have to make a copy of the script and use the modifed version 
with the new graph that has the set axis? or will the modified script 
work the same way as it did before if I don't pass the parameter?

Also, is it possible to display the x-axis units only every 5 or 10 
points?  Take a look at the enclosed graphic.  I wanted to use the time 
values but they are unreadable currently.
FromMe
ToAdam Sayler
SubjectRe: Help with Multigraph.js script customization
Date11 June 2004 10:54
>   Do I have to make a copy of the script and use the modifed version 
> with the new graph that has the set axis? or will the modified script 
> work the same way as it did before if I don't pass the parameter?

The modified script will work fine for both (which is why I used the
if(this.ylimit) ) so you can just overwrite the existing one.

> Also, is it possible to display the x-axis units only every 5 or 10 
> points?  Take a look at the enclosed graphic.  I wanted to use the time 
> values but they are unreadable currently.

I see what you mean, and yes, it would be possible to do this with some
modifications to my script. However, since you are filling these in
yourself, surely you can just write in the ones you want, and set the
others to a blank string (as long as you have the right number of arguments,
the script does not care whether they are blank or not):
g.setXAxis('January','','','April','','','July','','','October','','');

I'm sure that this would be more easy than modifying my script to do the
same thing.
FromAdam Sayler
ToMe
SubjectRe: Help with Multigraph.js script customization
Date11 June 2004 16:44
thanks for all the help
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.