Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10401 > unrolled thread

"Stupid" Array Question - Graph4VO

Started bybeerhand <michael_j_schmidt@yahoo.de>
First post2017-04-07 10:38 -0700
Last post2017-04-08 08:08 -0700
Articles 8 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  "Stupid" Array Question - Graph4VO beerhand <michael_j_schmidt@yahoo.de> - 2017-04-07 10:38 -0700
    Re: "Stupid" Array Question - Graph4VO "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-04-07 20:11 +0200
      Re: "Stupid" Array Question - Graph4VO beerhand <michael_j_schmidt@yahoo.de> - 2017-04-07 11:41 -0700
    Re: "Stupid" Array Question - Graph4VO "Gerhard Bunzel" <g.bunzel@domonet.de> - 2017-04-07 21:39 +0200
      Re: "Stupid" Array Question - Graph4VO beerhand <michael_j_schmidt@yahoo.de> - 2017-04-07 13:18 -0700
        Re: "Stupid" Array Question - Graph4VO Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2017-04-07 22:41 +0200
          Re: "Stupid" Array Question - Graph4VO beerhand <michael_j_schmidt@yahoo.de> - 2017-04-08 00:41 -0700
    Re: "Stupid" Array Question - Graph4VO beerhand <michael_j_schmidt@yahoo.de> - 2017-04-08 08:08 -0700

#10401 — "Stupid" Array Question - Graph4VO

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-04-07 10:38 -0700
Subject"Stupid" Array Question - Graph4VO
Message-ID<0c0ba76b-82c8-4ac1-b82d-0b1040960660@googlegroups.com>
Started to look at the Graph4VO library and it looks really good. BUT, I am struggling to fill the array with data from a dbserver. I fully understand that this might be/are basic programming skills, nevertheless reading the manual doesn't help. 


This is from the lineChart example how the data is filled with static data:

aPoints := {}

AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
              {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 1
AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
              {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 2
AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
              {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 3
AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
              {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 4

I need to loop through my database and fill only 1 line (Start-Year to End-Year.

It is a simple 1 LineChart:
x Axis = number of Years (e.g. 2017 to 2065)
y Axis = Value in €

***************
j:= 1
db:GoTop()
For i := Db:StartYear to db:EndYear
 
 AAdd(aPoints,{{j,db:Value}}) 
                           //this does not work as I believe in every loop a 
                           //new "Line" is created and result are single  
                           //points. So they need to be added to the 
                           //1 line i need.

 db:Skip()
 j := j+1
Next i

Thanks,
Michael

[toc] | [next] | [standalone]


#10402

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2017-04-07 20:11 +0200
Message-ID<ekq32qF43m5U1@mid.individual.net>
In reply to#10401
Hi Michael,

I don't know Graph4VO, but I would try

AAdd(aPoints,{j,db:Value}) 

instead of

AAdd(aPoints,{{j,db:Value}}) 


(add only one array instead of a nested array)

Wolfgang




beerhand wrote:

> Started to look at the Graph4VO library and it looks really good.
> BUT, I am struggling to fill the array with data from a dbserver. I
> fully understand that this might be/are basic programming skills,
> nevertheless reading the manual doesn't help.
> 
> 
> This is from the lineChart example how the data is filled with static
> data:
> 
> aPoints := {}
> 
> AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
>               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}})
> //Line 1
> AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
> {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 2
> AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
> {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 3
> AAdd(aPoints,{{01,300},{02,590},{03,600},{04,
> 800},{05,700},{06,500},;               {07,300},{08,210},{09,
> 10},{10, 10},{11,130},{12,200}}) //Line 4
> 
> I need to loop through my database and fill only 1 line (Start-Year
> to End-Year.
> 
> It is a simple 1 LineChart:
> x Axis = number of Years (e.g. 2017 to 2065)
> y Axis = Value in €
> 
> ***************
> j:= 1
> db:GoTop()
> For i := Db:StartYear to db:EndYear
>  
>  AAdd(aPoints,{{j,db:Value}}) 
>                            //this does not work as I believe in every
> loop a                            //new "Line" is created and result
> are single                            //points. So they need to be
> added to the                            //1 line i need.
> 
>  db:Skip()
>  j := j+1
> Next i
> 
> Thanks,
> Michael



-- 

[toc] | [prev] | [next] | [standalone]


#10403

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-04-07 11:41 -0700
Message-ID<e05fddf1-02cb-431f-be99-60786d0f7b3c@googlegroups.com>
In reply to#10402
Am Freitag, 7. April 2017 20:11:40 UTC+2 schrieb Wolfgang Riedmann:
> Hi Michael,
> 
> I don't know Graph4VO, but I would try
> 
> AAdd(aPoints,{j,db:Value}) 
> 
> instead of
> 
> AAdd(aPoints,{{j,db:Value}}) 
> 
> 
> (add only one array instead of a nested array)
> 
> Wolfgang
> 
> 
> 
> 
> beerhand wrote:
> 
> > Started to look at the Graph4VO library and it looks really good.
> > BUT, I am struggling to fill the array with data from a dbserver. I
> > fully understand that this might be/are basic programming skills,
> > nevertheless reading the manual doesn't help.
> > 
> > 
> > This is from the lineChart example how the data is filled with static
> > data:
> > 
> > aPoints := {}
> > 
> > AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
> >               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}})
> > //Line 1
> > AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
> > {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 2
> > AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
> > {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 3
> > AAdd(aPoints,{{01,300},{02,590},{03,600},{04,
> > 800},{05,700},{06,500},;               {07,300},{08,210},{09,
> > 10},{10, 10},{11,130},{12,200}}) //Line 4
> > 
> > I need to loop through my database and fill only 1 line (Start-Year
> > to End-Year.
> > 
> > It is a simple 1 LineChart:
> > x Axis = number of Years (e.g. 2017 to 2065)
> > y Axis = Value in €
> > 
> > ***************
> > j:= 1
> > db:GoTop()
> > For i := Db:StartYear to db:EndYear
> >  
> >  AAdd(aPoints,{{j,db:Value}}) 
> >                            //this does not work as I believe in every
> > loop a                            //new "Line" is created and result
> > are single                            //points. So they need to be
> > added to the                            //1 line i need.
> > 
> >  db:Skip()
> >  j := j+1
> > Next i
> > 
> > Thanks,
> > Michael
> 
> 
> 
> --

Hi Wolfgang, 

I have tried this "combination" as well. Did not work. Also this doesn't work: 

AAdd(aPoints,{aPoints,{j,db:Value}}) 

Feels like: Lukas 23:34 Jesus aber sprach: Vater, vergib ihm er weiß nicht was er da tut ... (in other words: I have no clue what I am doing). Guessing is quite frustrating :-)

Thanks Michael

[toc] | [prev] | [next] | [standalone]


#10404

From"Gerhard Bunzel" <g.bunzel@domonet.de>
Date2017-04-07 21:39 +0200
Message-ID<oc8psn$7cr$1@news-1.m-online.net>
In reply to#10401
Michael,


a For-Next-Loop with  For i := Db:StartYear to db:EndYear  and in that loop 
Db:Skip(1) ??????????
Do you realy have a field 'StartYear' and a field 'EndYear in that file?

.....one more test.....

aPoints := {}
AAdd(aPoints,{}) // Empty Line 1

db:GoTop()
For i := Db:StartYear to db:EndYear
   AAdd(aPoints[1],{i,db:Value})     // Add your points to that only one 
line
   Db:Skip(1)
Next i

This loop will be more logical with one record per year:
db:GoTop()
Do while .NOT. Db:EoF
   AAdd(aPoints[1], {db:Year, db:Value})     // Add your points to that only 
one line
   Db:Skip(1)
EndDo


HTH

Gerhard Bunzel


"beerhand"  schrieb im Newsbeitrag 
news:0c0ba76b-82c8-4ac1-b82d-0b1040960660@googlegroups.com...

Started to look at the Graph4VO library and it looks really good. BUT, I am 
struggling to fill the array with data from a dbserver. I fully understand 
that this might be/are basic programming skills, nevertheless reading the 
manual doesn't help.


This is from the lineChart example how the data is filled with static data:

aPoints := {}

AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
              {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 
1
AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
              {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 
2
AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
              {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 
3
AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
              {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 
4

I need to loop through my database and fill only 1 line (Start-Year to 
End-Year.

It is a simple 1 LineChart:
x Axis = number of Years (e.g. 2017 to 2065)
y Axis = Value in €

***************
j:= 1
db:GoTop()
For i := Db:StartYear to db:EndYear

AAdd(aPoints,{{j,db:Value}})
                           //this does not work as I believe in every loop a
                           //new "Line" is created and result are single
                           //points. So they need to be added to the
                           //1 line i need.

db:Skip()
j := j+1
Next i

Thanks,
Michael 

[toc] | [prev] | [next] | [standalone]


#10405

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-04-07 13:18 -0700
Message-ID<3dbd5cd6-0863-41d1-b86e-a8422c8a4209@googlegroups.com>
In reply to#10404
Am Freitag, 7. April 2017 21:39:03 UTC+2 schrieb Gerhard Bunzel:
> Michael,
> 
> 
> a For-Next-Loop with  For i := Db:StartYear to db:EndYear  and in that loop 
> Db:Skip(1) ??????????
> Do you realy have a field 'StartYear' and a field 'EndYear in that file?
> 
> .....one more test.....
> 
> aPoints := {}
> AAdd(aPoints,{}) // Empty Line 1
> 
> db:GoTop()
> For i := Db:StartYear to db:EndYear
>    AAdd(aPoints[1],{i,db:Value})     // Add your points to that only one 
> line
>    Db:Skip(1)
> Next i
> 
> This loop will be more logical with one record per year:
> db:GoTop()
> Do while .NOT. Db:EoF
>    AAdd(aPoints[1], {db:Year, db:Value})     // Add your points to that only 
> one line
>    Db:Skip(1)
> EndDo
> 
> 
> HTH
> 
> Gerhard Bunzel
> 
> 
> "beerhand"  schrieb im Newsbeitrag 
> news:0c0ba76b-82c8-4ac1-b82d-0b1040960660@googlegroups.com...
> 
> Started to look at the Graph4VO library and it looks really good. BUT, I am 
> struggling to fill the array with data from a dbserver. I fully understand 
> that this might be/are basic programming skills, nevertheless reading the 
> manual doesn't help.
> 
> 
> This is from the lineChart example how the data is filled with static data:
> 
> aPoints := {}
> 
> AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
>               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 
> 1
> AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
>               {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 
> 2
> AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
>               {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 
> 3
> AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
>               {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 
> 4
> 
> I need to loop through my database and fill only 1 line (Start-Year to 
> End-Year.
> 
> It is a simple 1 LineChart:
> x Axis = number of Years (e.g. 2017 to 2065)
> y Axis = Value in €
> 
> ***************
> j:= 1
> db:GoTop()
> For i := Db:StartYear to db:EndYear
> 
> AAdd(aPoints,{{j,db:Value}})
>                            //this does not work as I believe in every loop a
>                            //new "Line" is created and result are single
>                            //points. So they need to be added to the
>                            //1 line i need.
> 
> db:Skip()
> j := j+1
> Next i
> 
> Thanks,
> Michael

Hi Gerhard,

you are correct that the database has only one field to store the date. "First record" contains the Start-date "last record" the End-Date. Means, while !eof will work as well. Sorry for the confusion.

I have tried your code but it is still not working. I saw a post from a few years ago and Geoff answered that it is simple...

Have a great weekend.
Michael

[toc] | [prev] | [next] | [standalone]


#10406

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2017-04-07 22:41 +0200
Message-ID<3ntfecdjmlntekci48bhgc5vdcp3o5jhhg@4ax.com>
In reply to#10405
Michael,
i'puzzled by the sample code. Looks, like each line is described by
one subarrayof points, but these having only one value instead of 2
koordinates?
Only explanation would be, the x-axis  is NOT set to reflect any real
value, but maps values to "index number".
In your case, x-point 1 would be mapped to 2017 etc.

I'd first try to view one lineelement, e.g. 
AAdd(aPoints{{1, 500},{2,700}}
should show a line,
 if not, we are on the wrong track ;)

No need to complicate things with db access...


>Am Freitag, 7. April 2017 21:39:03 UTC+2 schrieb Gerhard Bunzel:
>> Michael,
>> 
>> 
>> a For-Next-Loop with  For i := Db:StartYear to db:EndYear  and in that loop 
>> Db:Skip(1) ??????????
>> Do you realy have a field 'StartYear' and a field 'EndYear in that file?
>> 
>> .....one more test.....
>> 
>> aPoints := {}
>> AAdd(aPoints,{}) // Empty Line 1
>> 
>> db:GoTop()
>> For i := Db:StartYear to db:EndYear
>>    AAdd(aPoints[1],{i,db:Value})     // Add your points to that only one 
>> line
>>    Db:Skip(1)
>> Next i
>> 
>> This loop will be more logical with one record per year:
>> db:GoTop()
>> Do while .NOT. Db:EoF
>>    AAdd(aPoints[1], {db:Year, db:Value})     // Add your points to that only 
>> one line
>>    Db:Skip(1)
>> EndDo
>> 
>> 
>> HTH
>> 
>> Gerhard Bunzel
>> 
>> 
>> "beerhand"  schrieb im Newsbeitrag 
>> news:0c0ba76b-82c8-4ac1-b82d-0b1040960660@googlegroups.com...
>> 
>> Started to look at the Graph4VO library and it looks really good. BUT, I am 
>> struggling to fill the array with data from a dbserver. I fully understand 
>> that this might be/are basic programming skills, nevertheless reading the 
>> manual doesn't help.
>> 
>> 
>> This is from the lineChart example how the data is filled with static data:
>> 
>> aPoints := {}
>> 
>> AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
>>               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 
>> 1
>> AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
>>               {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 
>> 2
>> AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
>>               {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 
>> 3
>> AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
>>               {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 
>> 4
>> 
>> I need to loop through my database and fill only 1 line (Start-Year to 
>> End-Year.
>> 
>> It is a simple 1 LineChart:
>> x Axis = number of Years (e.g. 2017 to 2065)
>> y Axis = Value in €
>> 
>> ***************
>> j:= 1
>> db:GoTop()
>> For i := Db:StartYear to db:EndYear
>> 
>> AAdd(aPoints,{{j,db:Value}})
>>                            //this does not work as I believe in every loop a
>>                            //new "Line" is created and result are single
>>                            //points. So they need to be added to the
>>                            //1 line i need.
>> 
>> db:Skip()
>> j := j+1
>> Next i
>> 
>> Thanks,
>> Michael
>
>Hi Gerhard,
>
>you are correct that the database has only one field to store the date. "First record" contains the Start-date "last record" the End-Date. Means, while !eof will work as well. Sorry for the confusion.
>
>I have tried your code but it is still not working. I saw a post from a few years ago and Geoff answered that it is simple...
>
>Have a great weekend.
>Michael
Regards

Karl

[toc] | [prev] | [next] | [standalone]


#10407

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-04-08 00:41 -0700
Message-ID<dc54397a-a89b-463c-af7e-b742a1627402@googlegroups.com>
In reply to#10406
Am Freitag, 7. April 2017 22:41:27 UTC+2 schrieb Karl Faller:
> Michael,
> i'puzzled by the sample code. Looks, like each line is described by
> one subarrayof points, but these having only one value instead of 2
> koordinates?
> Only explanation would be, the x-axis  is NOT set to reflect any real
> value, but maps values to "index number".
> In your case, x-point 1 would be mapped to 2017 etc.
> 
> I'd first try to view one lineelement, e.g. 
> AAdd(aPoints{{1, 500},{2,700}}
> should show a line,
>  if not, we are on the wrong track ;)
> 
> No need to complicate things with db access...
> 
> 
> >Am Freitag, 7. April 2017 21:39:03 UTC+2 schrieb Gerhard Bunzel:
> >> Michael,
> >> 
> >> 
> >> a For-Next-Loop with  For i := Db:StartYear to db:EndYear  and in that loop 
> >> Db:Skip(1) ??????????
> >> Do you realy have a field 'StartYear' and a field 'EndYear in that file?
> >> 
> >> .....one more test.....
> >> 
> >> aPoints := {}
> >> AAdd(aPoints,{}) // Empty Line 1
> >> 
> >> db:GoTop()
> >> For i := Db:StartYear to db:EndYear
> >>    AAdd(aPoints[1],{i,db:Value})     // Add your points to that only one 
> >> line
> >>    Db:Skip(1)
> >> Next i
> >> 
> >> This loop will be more logical with one record per year:
> >> db:GoTop()
> >> Do while .NOT. Db:EoF
> >>    AAdd(aPoints[1], {db:Year, db:Value})     // Add your points to that only 
> >> one line
> >>    Db:Skip(1)
> >> EndDo
> >> 
> >> 
> >> HTH
> >> 
> >> Gerhard Bunzel
> >> 
> >> 
> >> "beerhand"  schrieb im Newsbeitrag 
> >> news:0c0ba76b-82c8-4ac1-b82d-0b1040960660@googlegroups.com...
> >> 
> >> Started to look at the Graph4VO library and it looks really good. BUT, I am 
> >> struggling to fill the array with data from a dbserver. I fully understand 
> >> that this might be/are basic programming skills, nevertheless reading the 
> >> manual doesn't help.
> >> 
> >> 
> >> This is from the lineChart example how the data is filled with static data:
> >> 
> >> aPoints := {}
> >> 
> >> AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
> >>               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 
> >> 1
> >> AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
> >>               {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 
> >> 2
> >> AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
> >>               {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 
> >> 3
> >> AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
> >>               {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 
> >> 4
> >> 
> >> I need to loop through my database and fill only 1 line (Start-Year to 
> >> End-Year.
> >> 
> >> It is a simple 1 LineChart:
> >> x Axis = number of Years (e.g. 2017 to 2065)
> >> y Axis = Value in €
> >> 
> >> ***************
> >> j:= 1
> >> db:GoTop()
> >> For i := Db:StartYear to db:EndYear
> >> 
> >> AAdd(aPoints,{{j,db:Value}})
> >>                            //this does not work as I believe in every loop a
> >>                            //new "Line" is created and result are single
> >>                            //points. So they need to be added to the
> >>                            //1 line i need.
> >> 
> >> db:Skip()
> >> j := j+1
> >> Next i
> >> 
> >> Thanks,
> >> Michael
> >
> >Hi Gerhard,
> >
> >you are correct that the database has only one field to store the date. "First record" contains the Start-date "last record" the End-Date. Means, while !eof will work as well. Sorry for the confusion.
> >
> >I have tried your code but it is still not working. I saw a post from a few years ago and Geoff answered that it is simple...
> >
> >Have a great weekend.
> >Michael
> Regards
> 
> Karl

Karl,

the static build of the array works fine and in your example it draws a line from (x-point1:500) to (x-point2:700). 

In my example the j is the x-point, rValue is from the db
********************************************************** 
j := 1                        //  x-point 1 to 48 (years)
For i := 2017 to 2065
 AAdd(aPoints,{{j, rValue}})  //  at the end it must look like a static 
                                  created array AAdd(aPoints,{{1, rValue1},
                                  {2,rValue2}, {3, rValue3}, etc.})
 j := j+1                     //  next x-point
Next i

**********************************************************

Best
Michael

[toc] | [prev] | [next] | [standalone]


#10408

Frombeerhand <michael_j_schmidt@yahoo.de>
Date2017-04-08 08:08 -0700
Message-ID<4b93e3a4-4c9d-47ea-8192-8a9832b0cacf@googlegroups.com>
In reply to#10401
Am Samstag, 8. April 2017 13:43:47 UTC+2 schrieb Johan Nel:
> Hi Michael,
>     
> I know from experience it is a bit confusing to get the array for
>       Grap4VO correct.
>     
> Basically the aPoints array is an array of series, where each
>       series is an array.
>     
> To explain and make it a bit more simple, modify your code like
>       this, it is actually the way Gerhard explained, just broken up a
>       bit into more detail:
>     
> aPoints := {}
>     
> aSeries := {} // You only have 1 series "YEAR"
>     j:= 1
> db:GoTop()
> For i := Db:StartYear to db:EndYear
>  
>  AAdd(aSeries, {j, db:Value})  // See how splitting up the "sub-array" suddenly make it so much easier??? 
>  db:Skip()
>  j := j+1
> Next i
> AAdd(aPoints, aSeries)
> 
> // Voila I think the array is created correctly!
> 
> To access a specific x, y point you need something like this, where your example iSeries can only be 1. 
> aPoints[iSeries, iYear, 1] // This will give the X value
> aPoints[iSeries, iYear, 2] // This will give the Y value
> // iYear represent the "j" value in your loop, which will also be the same value as the X value.
> 
> Hope this is not too confusing.
> 
> Regards,
> -- 
> Johan Nel
> George, South Africa
>     
>     On 2017/04/07 19:38, beerhand wrote:
> 
>     
>       Started to look at the Graph4VO library and it looks really good. BUT, I am struggling to fill the array with data from a dbserver. I fully understand that this might be/are basic programming skills, nevertheless reading the manual doesn't help. 
> 
> 
> This is from the lineChart example how the data is filled with static data:
> 
> aPoints := {}
> 
> AAdd(aPoints,{{01,550},{02,800},{03,700},{04, 900},{05,910},{06,820},;
>               {07,450},{08,330},{09,120},{10,120},{11,180},{12,360}}) //Line 1
> AAdd(aPoints,{{01,550},{02,660},{03,720},{04,1010},{05,880},{06,760},;
>               {07,400},{08,300},{09, 80},{10, 80},{11,170},{12,290}}) //Line 2
> AAdd(aPoints,{{01,500},{02,600},{03,690},{04,1030},{05,840},{06,620},;
>               {07,350},{08,290},{09, 60},{10, 60},{11,150},{12,240}}) //Line 3
> AAdd(aPoints,{{01,300},{02,590},{03,600},{04, 800},{05,700},{06,500},;
>               {07,300},{08,210},{09, 10},{10, 10},{11,130},{12,200}}) //Line 4
> 
> I need to loop through my database and fill only 1 line (Start-Year to End-Year.
> 
> It is a simple 1 LineChart:
> x Axis = number of Years (e.g. 2017 to 2065)
> y Axis = Value in €
> 
> ***************
> j:= 1
> db:GoTop()
> For i := Db:StartYear to db:EndYear
>  
>  AAdd(aPoints,{{j,db:Value}}) 
>                            //this does not work as I believe in every loop a 
>                            //new "Line" is created and result are single  
>                            //points. So they need to be added to the 
>                            //1 line i need.
> 
>  db:Skip()
>  j := j+1
> Next i
> 
> Thanks,
> Michael
> 
>     
>     
> 
>   
> 
> 
> 	
>         
> 		Virus-free. www.avast.com

Hi Johan,

it works. Thanks a lot.

Best Regards,
Michael

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web