View previous topic :: View next topic |
Author |
Message |
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Jan 19, 2005 5:26 am Post subject: Bar Chart with no DLL |
|
|
A simple bar chart using text elements:
Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE "By Mac"
DIALOG CREATE,"Bar Chart Example",-1,0,260,230
DIALOG ADD,STYLE,S1,MS Sans Serif,10
DIALOG ADD,STYLE,Black,,,,BLACK
DIALOG ADD,STYLE,White,,,,WHITE
DIALOG ADD,STYLE,Red,,,,RED
DIALOG ADD,STYLE,Green,,,,LTGREEN
DIALOG ADD,STYLE,Blue,,,,LTBLUE
DIALOG ADD,EDIT,E1,5,205,50,24,"40",,S1
DIALOG ADD,EDIT,E2,35,205,50,24,"90",,S1
DIALOG ADD,EDIT,E3,65,205,50,24,"70",,S1
DIALOG ADD,BUTTON,Set,95,205,50,24,,,S1
DIALOG ADD,BUTTON,Clear,125,205,50,24,,,S1
rem -- background --
DIALOG ADD,TEXT,BG,0,0,200,200,"",,,White
rem -- horz lines --
%x = 0
REPEAT
DIALOG ADD,TEXT,Line_x%x,@prod(%x, 10),0,200,1,"",,Black
%x = @succ(%x)
UNTIL @greater(%x, 20)
rem -- vert lines --
%x = 0
REPEAT
DIALOG ADD,TEXT,Line_y%x,0,@prod(%x, 10),1,200,"",,Black
%x = @succ(%x)
UNTIL @greater(%x, 20)
DIALOG ADD,TEXT,Bar1,200,10,40,1,"",,Red
DIALOG ADD,TEXT,Bar2,200,80,40,1,"",,Green
DIALOG ADD,TEXT,Bar3,200,150,40,1,"",,Blue
DIALOG ADD,STATUS,Stat,"Enter percentages and press ''Set''."
DIALOG SHOW
:EVLOOP
WAIT EVENT
goto @event()
:SetBUTTON
%%bar1 = @dlgtext(E1)
%%bar2 = @dlgtext(E2)
%%bar3 = @dlgtext(E3)
if @both(@greater(%%bar1, 0), @greater(101, %%bar1))
DIALOG SETPOS,Bar1,@diff(200, @prod(%%bar1, 2)),,,@prod(%%bar1, 2)
end
if @both(@greater(%%bar2, 0), @greater(101, %%bar2))
DIALOG SETPOS,Bar2,@diff(200, @prod(%%bar2, 2)),,,@prod(%%bar2, 2)
end
if @both(@greater(%%bar3, 0), @greater(101, %%bar3))
DIALOG SETPOS,Bar3,@diff(200, @prod(%%bar3, 2)),,,@prod(%%bar3, 2)
end
goto EVLOOP
:ClearBUTTON
rem -- reset bar positions --
DIALOG SETPOS,Bar1,200,,,1
DIALOG SETPOS,Bar2,200,,,1
DIALOG SETPOS,Bar3,200,,,1
goto EVLOOP
:CLOSE
EXIT
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Jan 19, 2005 7:49 am Post subject: |
|
|
thanks mac, will check it out later on tonight my time
serge _________________
|
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Wed Jan 19, 2005 1:22 pm Post subject: |
|
|
Nice little example - could be helpful. _________________ Joe Floyd |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Jan 19, 2005 1:38 pm Post subject: |
|
|
nice job mac
serge _________________
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Jan 22, 2005 4:25 am Post subject: |
|
|
Cool _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Boo Valued Contributor
Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sat Jan 22, 2005 7:31 am Post subject: |
|
|
Coolio, Mac! |
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Jan 25, 2005 3:44 pm Post subject: |
|
|
Thought you'd like to see the bandscope program I made using this example. The program talks to my ham radio transceiver and sweeps it across a 100KHz width of the radio spectrum, and plots the signal strength across the spectrum. It's going to be really handy keeping watch for rare openings on normally quiet bands.
_________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Boo Valued Contributor
Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Jan 25, 2005 3:52 pm Post subject: |
|
|
Neat! |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Jan 25, 2005 10:20 pm Post subject: |
|
|
Nice job Jules.
Here's a coupla shots of a futures charting app I converted
to VDS 3 using text elements - had coded it in VDS 2 with
bitmaps - and that was converted from the original DOS
C++ version I wrote several (lol, many?) years ago...
Chart1 shows pure text elements (including the grid) and
Chart2 uses VDSug.dll drawing routines to chart highs
and lows from the same data.
Pics aren't the greatest, was trying to keep 'em small.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Wed Jan 26, 2005 7:48 am Post subject: |
|
|
looks great mac, i am puzzled as to how you did it all
serge _________________
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Wed Jan 26, 2005 9:03 am Post subject: |
|
|
Those charts look really impressive.
A couple of advantages I discovered using text elements for my app: I can set tooltips for each bar to display the exact value. You couldn't do that using a charting element. I also use the click events for each bar, so if you click on one, the app tunes the radio to that frequency. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Jan 26, 2005 6:46 pm Post subject: |
|
|
Jules,
Thanks. You're right - the fact ya can store info in the text
elements is a definite plus. The futures chart elements also
store data for each day, and display that day's data when
ya click it. The info displayed in the pic is from clicking on
the last day shown in the chart (that's March 2005 wheat
btw). No tooltips in VDS 3 though.
Serge,
Thanks - it's a mathematical nightmare... Not only does
it grab data from over a years worth of files and turn the
figures into pixel XY info, it must also do a scaling routine
to fit the data on the display area, since price ranges can
vary greatly from one commodity to another.
The little short blue lines at the bottom are for weekdays
that have no valid data - most are holidays, but ya get
one occasionally when there's corrupted data in a file.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Thu Jan 27, 2005 12:29 am Post subject: |
|
|
i figured it would be a mathematical nightmare as i did something like this a long time ago in a different language and what a a mind bender it was
you have done a great job with it
serge _________________
|
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Feb 10, 2005 10:32 pm Post subject: |
|
|
I have to say I'm highly impressed.
Any chance you can provide example code for that? _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 10, 2005 11:03 pm Post subject: |
|
|
Sorry FF, but that app is not open source.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
|
|
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 vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|