Liberty BASIC Community Forum
« I need a graph...Please »

Welcome Guest. Please Login or Register.
Jun 24th, 2017, 2:08pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: I need a graph...Please  (Read 290 times)
debluzz
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 127
xx I need a graph...Please
« Thread started on: Jan 27th, 2017, 11:39am »

I have two columns(8 lines ea.) of numbers "##.##"


what I'm looking for is a graph as such:
that meaures from-200 to +200 I don't know what they call this type of graph
( -200 through +200)

kind of like this, example showing a -88
(-) (+)
#1 ---------88---------- 0
ect.ect


At this point I am using the following bargraph
I need the new one to scale within the 8 lines and 40/80 or end of line, with a ZERO in center of line.

any help would be great
'#1
for i= 1 to 1
print " #1";
a1=(total1)/3
for r=1 to a1
print "*";
next
PRINT " ";int(a1*3)
next i
'#2
for i= 1 to 1
print " #2";
a2=(total2)/3
for r=1 to a2
print "*";
next
PRINT " ";int(a2*3)
next i
'#3
for i= 1 to 1
print " #3";
a3=(total3)/3
for r=1 to a3
print "*";
next
PRINT " ";int(a3*3)
next i
'#4
for i= 1 to 1
print " #4";
a4=(total4)/3
for r=1 to a4
print "*";
next
PRINT " ";int(a4*3)
next i
'#5
for i= 1 to 1
print " #5";
a5=(total5)/3
for r=1 to a5
print "*";
next
PRINT " ";int(a5*3)
next i
'#6
for i= 1 to 1
print " #6";
a6=(total6)/3
for r=1 to a6
print "*";
next
PRINT " ";int(a6*3)
next i
'#7
for i= 1 to 1
print " #7";
a7=(total7)/3
for r=1 to a7
print "*";
next
PRINT " ";int(a7*3)
next i
'#8
for i= 1 to 1
print " #8";
a8=(total8)/3
for r=1 to a8
print "*";
next
PRINT " ";int(a8*3)
next i
« Last Edit: Jan 27th, 2017, 11:45am by debluzz » User IP Logged

tsh73
Board Moderator

member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1661
xx Re: I need a graph...Please
« Reply #1 on: Jan 27th, 2017, 1:10pm »

Something like this? (googled)
User Image

Still not sure.
Do you need it in a mainwin? In a graphic box? Should it be scaled to some size? Just 8 dots? Or some lines as well?

Could you just draw in Paint and show what are you up to?
« Last Edit: Jan 27th, 2017, 1:11pm by tsh73 » User IP Logged

The existence of bug reports means somebody is using the software and actually cares to report back to you that he is having a problem with it, instead of just deleting it from their hard disk.
(Janusz Marcin Gorycki)
tenochtitlanuk
Board Moderator

member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1154
xx Re: I need a graph...Please
« Reply #2 on: Jan 27th, 2017, 5:51pm »

Yeah, we're not sure what you want... it doesn't help that the forum removes multiple spaces in your request! ( Put text where this matters in a [ quote]/[ /quote] pair..
Two examples heading for what I THINK you want-
Code:
mainwin 140 40

'line$ =space$( 100)
for i =0 to 100
    select case
        case ( i /10) =int( i /10)
            line$ =line$ +str$( int( i /10))
        case else
            line$ =line$ +" "
    end select
next i

for i =0 to 7 step 0.1
    number      =1 +int( 50 +50 *sin( i))
    newLine$    =left$( line$, number -1) +"*" +mid$( line$, number +1)
    print ,newLine$
next i

end
 


User Image
Which generates the numbers of a sine wave, rather than your data..

AND

another example which squeezes your code to 8 repetitions of the SAME loop rather than repeating six loops differing only in variable name.
Code:
total( 1) =  80
total( 2) =  59
total( 3) = -33
total( 4) = 200
total( 5) = 100
total( 6) =   0
total( 7) =-100
total( 8) =-200

for i= 1 to 8
    print " #"; i; " *";
    a1 =int( total( i) /10) '   now -10 to +10

    for r =1 to a1 +20
        print "-";
    next

    print "|";

    for r =( a1 +22) to 41
        print "+";
    next

    print "* "; total( i)
next i
 

User Image

I haven't altered the scaling in these examples- fairly easy to add.
Note I had to show the results as screengrap GIFs since your display of this page probably doesn't use a monospaced font...

Of course if you are using a GUI you can make 'graphics' like bar charts much prettier..

Tell us more of what you want.....
User IP Logged

debluzz
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 127
xx Re: I need a graph...Please
« Reply #3 on: Jan 29th, 2017, 7:03pm »

I would like to use the 2nd example

where the values are, I'd like my variables. How would I get it to use my variables which are holding the values ?


And thanks for your help as always!

oh, my variable are:
<>
total1
total2
total3
total4
total5
total6
total7
total8
<>
« Last Edit: Jan 29th, 2017, 7:08pm by debluzz » User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5311
xx Re: I need a graph...Please
« Reply #4 on: Jan 30th, 2017, 02:09am »

change

Code:
total( 1) =  80
total( 2) =  59
total( 3) = -33
total( 4) = 200
total( 5) = 100
total( 6) =   0
total( 7) =-100
total( 8) =-200

 


to

Code:
total( 1) = total1
total( 2) = total2
total( 3) = total3
total( 4) = total4
total( 5) = total5
total( 6) = total6
total( 7) = total7
total( 8) = total9

 
« Last Edit: Jan 30th, 2017, 02:09am by Rod » User IP Logged

debluzz
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 127
xx Re: I need a graph...Please
« Reply #5 on: Jan 30th, 2017, 02:40am »

cancel my last post........got it worked out.. I'm using the 2nd example.. think it will be whats needed


thanks for all your help
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls