Barcharts

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

Barcharts

Postby tweetie » Thu Jan 08, 2004 11:44 am

Anyone knows how to make barcharts in Servoy??

Here's an example I made in Filemaker (is that an ugly word in here??) :oops:
Attachments
barchart.jpg
barchart.jpg (49.53 KiB) Viewed 4234 times
User avatar
tweetie
 
Posts: 345
Joined: Thu Jan 08, 2004 11:32 am
Location: Rotterdam, Netherlands

Postby maarten » Thu Jan 08, 2004 3:08 pm

Filemaker certainly isn't an ugly word.
Depends on what you want to achieve :wink:

I've attached a small example solution using HTML
to simulate your barchart.
Another way to go is using a bean.
(I'll do another post in a short while)
Attachments
barchart.servoy
(5.82 KiB) Downloaded 416 times
barChart.jpg
screen shot
barChart.jpg (3.22 KiB) Viewed 4226 times
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby tweetie » Sun Jan 11, 2004 9:21 pm

I wanna maken bars for an agenda for appointments.
The bars have diffrent colors for every kind of appointment.

For example:
outdoor appointment: red
not available:yellow
indoor appointment: blue

And I want nice bars....not the html thingie you made (hope ya don't mind). Question though....does this means....you have to open Explorer to see you appointment...or do you stay in Servoy

In Filemaker I made this with a textfont (wingdings or webdings)...it's quite fast for Filemaker :shock: since it's text (though it looks quite graphically)
User avatar
tweetie
 
Posts: 345
Joined: Thu Jan 08, 2004 11:32 am
Location: Rotterdam, Netherlands

Postby IT2Be » Sun Jan 11, 2004 10:33 pm

You can also assign just a backgoundcolor to the example of Maarten instead of an image. You then resize the table fields and voila the result is there...

But, you can also use the font you suggest to do the same thing like you did in fm.

And you can use another image than the example.

In short: there are may ways to do this in Servoy :D
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

TIP: Barchart using .gif and HTML

Postby bcusick » Thu Jan 15, 2004 3:11 pm

Hi everyone,

I created this example because there was an issue with bean storage (so I couldn't use the JProgress Bean - which is a MUCH better solution!)...

So, here's a little tip on creating a "fake" progress bar. I hope it inspires.

Cheers,

Bob Cusick

==================================================

Pseudo Servoy "Progress Bar"

On forms that you want a progress bar you need to create a field and a label. The field MUST be named "progress" and the label MUST be named "caption". Set the "displayType" of the "progress" field to HTML_AREA and the dataProvider to gt_progress, set the scrollbars of this field to "never" and "never". Set the dataprovider of "caption" to gt_progressCaption.

media requried:

blue_dot.gif (or your own single color gif)


globals required:

gi_progressMax (int);
gi_progressValue (int);
gn_progressIncrement (num);
gt_progress (text);
gt_progressCaption(text);

/****************************************
METHODS
****************************************/

/************************
Progress Bar Init

Suggested global method name: progressInit

arguments[0] = maxValue

useage: progressInit(50)

************************/

var theForm = currentcontroller.getName()

globals.gt_progressCaption = '';
globals.gt_progress = '';
var width = eval('(forms.' + theForm + '.elements.progress.getWidth() - 8 ).toFixed(0)');

eval('forms.' + theForm + '.elements.progress.visible=true');
eval('forms.' + theForm + '.elements.caption.visible=true');

if(!globals.gi_progressMax || arguments[0] == 0 || arguments[0] == null) {
globals.gi_progressMax = 100;
}
else {
globals.gi_progressMax = arguments[0];
}

globals.gn_progressIncrement = width/globals.gi_progressMax;

globals.gi_progressValue = 0;

return;



/************************
Progress Bar Increment

Suggested global method name: progressIncrement

arguments[0] = updateString

useage: progressIncrement('Processing ?')

In the string you pass - include the "?" character
somewhere in there - and the routine will replace
it with the current count. For example:

progressIncrement('Downloading record ?...') will
return "Downloading record 5..."

************************/

var height = 17;

var topHTML="<html><table cellpadding='0' cellspacing='0' width='" +
Math.round(globals.gi_progressValue * globals.gn_progressIncrement) +
"' height='" + height + "' border='0'><tr><td>"

var bottomHTML = "</td></tr></table></html>"


globals.gt_progress = topHTML + "<img src='media:///blue_dot.gif' border='0' height='" + height +
"' width='" + Math.round(globals.gi_progressValue * globals.gn_progressIncrement) + "'>" + bottomHTML;

globals.gt_progressCaption = utils.stringReplace(arguments[0], '?', Math.round(globals.gi_progressValue)+'');
application.updateUI();

globals.gi_progressValue += 1;

return;



/************************
Progress Bar Dispose

Suggested global method name: progressDispose

useage: progressDispose()

************************/

var theForm = currentcontroller.getName();

globals.gt_progressCaption = "Complete";
application.sleep(500);
application.updateUI();

globals.gt_progressCaption = "";
globals.gt_progress = '';
application.updateUI();
eval('forms.' + theForm + '.elements.progress.visible=false');
eval('forms.' + theForm + '.elements.caption.visible=false');




/***************************
EXAMPLE
***************************/

var max = 100

progressInit(max);

for(var i = 1; i < max; i++)
{
progressIncrement('Processing ?')
}

progressDispose();
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Thankx

Postby tweetie » Fri Jan 16, 2004 5:03 pm

Since I'm new at this....I'm gonna rumble a little bit with these examples
User avatar
tweetie
 
Posts: 345
Joined: Thu Jan 08, 2004 11:32 am
Location: Rotterdam, Netherlands


Return to How To

Who is online

Users browsing this forum: No registered users and 7 guests

cron