This project is read-only.

FoxCharts: Values from Rows or Columns ?

Topics: Attention VFPX Admins
Jul 27, 2009 at 11:52 AM

First off all I want to tank for this outstanding software and tanks to all contributors for the efforts put is this challenge.
My question as to do with the way as foxcharts (and others chart tools for that matter), takes the data to display. I’m a rooky in these concepts, rows and columns. 

The problem:
Supose I have a table to colect values by Year/membersID’s/Months like this:

MemberN

Year

Jan

Fev

Etc until Dez

1

2007

42642,85

53996,22

Etc until Dez

1

2008

34324,32

434534,55

Etc until Dez

1

2009

60956,44

23242,55

Etc until Dez

2

2007

5168,36

36254,85

Etc until Dez

2

2008

123131

455445,33

Etc until Dez

3

2008

62567,16

76282,36

Etc until Dez

3

2009

234223,34

2232,44

Etc until Dez

 Then I issue the folowing select statement :
SELECT SUM(v_q_1) as Janeiro,SUM(v_q_2) as Fevereiro,SUM(v_q_3) as Março,SUM(v_q_4) as Abril,SUM(v_q_5) as Maio,SUM(v_q_6) as Junho,;
SUM(v_q_7) as Julho,SUM(v_q_8) as Agosto,SUM(v_q_9) as Setembro,SUM(v_q_10) as Outubro,SUM(v_q_11) as Novembro,SUM(v_q_12) as Dezembro,;
ano FROM quotas INTO CURSOR quotasmes WHERE ano >= 2006 AND ano <= 2009 GROUP BY ano

This result in that cursor (don't look at values)

Year

Jan

Fev

Etc until Dez

2007

42642,85

53996,22

Etc until Dez

2008

5168,36

36254,85

Etc until Dez

2009

62567,16

76282,36

Etc until Dez

My question is; How can I (thru a select statement) creat a cursor with the right structure to obtain a bar char with monts displayed.
This is because the way Foxcharts take values to display, by row. Eatch bar in the charts is taken by row not by column (the natural way the tables are created). In this example I cannot creat a table to record the contributions from members where columns representing Years and rows representing members and monts, this doesn’t make any sence.

Because of this the work for the programer is very difult as he must take values with select statements in a program due to the choices made by users and not creat cursors with fixed values, as the examples do.
Way foxcharts don’t take values the way tables are created?

Sorry if this doesn’t make any sence to you but for me thus. 

Thanks

Jul 27, 2009 at 12:06 PM

Hi,

You could study the concepts as stipulated in the example FoxChart Builder. Here you select charttype 7, simple bar and with the combodropdown you select a row.

Please study the way FoxCharts is preparing the cursors, in your case you should 'replace' products with MemberN

Please report back if still unclear

 

Koen

 

Jul 27, 2009 at 12:21 PM

Hi Koen,

Thanks for your repplay

Sorry but I don't understand this: should 'replace' products with MemberN

There are not any field 'products'

Tank you

Jul 27, 2009 at 1:00 PM

Hi, AedGaeDG

 

indeed, you are correct, you have to focus on the sample provided by James Nelson, and focus on how he uses a cursor columns that should do the trick.

Sorry for confusion,

Regards,

 

Koen

Jul 27, 2009 at 3:02 PM

Ok

But you understand mi point ? The method of agregating values is not the natural method used in program languages like Fox and is somehow incompatible with SQL Select.

The selection of values to display It is not straightfoword. In the example I give I would like that you provid a programatic solution to creat a cursor with values in columns that is from the original table (on top). Ticky hein?

(Columns represent years)

column1         column2            column3

12121,33        45645,43            "Jan"

124343,44      6565,34              "Fev"

343,44           543545,54           "Mar"

Thanks