Forums

create statistics using the chart widget

Fredolino 27 Jan, 2020
Hi,

I would like to create statistics using the chart widget.
However, I have too little information on how this widget works.
There are few posts about it but I can't get any further.
I also can't see a debugger because the widget only shows me a blank white page.
It should look like on the screen later.

Here is my current status in the form:

FUNCTIONS:
Name: read_rl_bbg
Model:BBG
All matching records
Fields to retrieve: rl_bbg
Group fields: BBG.rl_bbg

VIEW:
Chart-Name: rote_liste
Data provider: {var:read_rl_bbg}.[n].BBG}
X Field name: rl
Y Field name: rl_result
x axis label: x-label
x axis label: y-label

EVENTS:
Name: index
{fn:read_rl_bbg}
{view:rote_liste}
{debug:read_rl_bbg}
Fredolino 27 Jan, 2020
ok, new:

I have this just in read_data/Fields to retrieve:
art_id
COUNT(*):BBG.count_species
rl_bbg

Group fields: rl_bbg

Debug:
Array
(
[log] => Array
(
[0] => SELECT `BBG`.`art_id` AS `BBG.art_id`, COUNT(*) AS `BBG.count_species`, `BBG`.`rl_bbg` AS `BBG.rl_bbg` FROM `mtb_haupt_brandenburg` AS `BBG` GROUP BY `BBG.rl_bbg` LIMIT 100;
)
.....

In my Table under VIEW display result correct.
But the chart page is white and blank. Why is that?
healyhatman 27 Jan, 2020
You need to add results to it in the same way you add them to CSV. So something like {var:read_data.model.[n].field} or model.[n].field or whatever. Needs to be a 1D array not associative.

Also, it's not that much harder and a LOT nicer to just use Google Charts.
Fredolino 28 Jan, 2020
When I use that:
X Fieldname: BBG.[n].art_id
{var:BBG.[n].count_species}
Then comes the error message:
"Unsupported operand types"

And when I create a "Custom code" function under "Function", it doesn't show me a Google Chart, only the arrays.

Fredolino 28 Jan, 2020
Answer
1 Likes
:-) solved with in CC6-Chart:

X Field: art_id
Y Field: count_species
This topic is locked and no more replies can be posted.