Undefined labels in chart...


#1

My labels say the number of records I counted for the reservation_hour.
But I need the reservation_hour as a label, and the inner label the number of records…

I tried several different things, but I can’t seem to find out how to do this.
Any hints anyone?

[code]
var myPieChart;
function doOnLoad() {
myPieChart = new dhtmlXChart({
view:“pie”,
container:“chart”,
value:"#reservation_hour#",
label:"#reservation_hour#",
// pieInnerText:"#reservation_hour#",
shadow:0,
group:{
by:"#reservation_hour#",
map:{
reservation_hour:[null,setCount]
}
},

	});
	

	myPieChart.load("<?php echo bloginfo('template_url'); ?>/buyer_sales/jpnx_regs_graph_conn.php");
	

}
function setCount(prop,data){
 return data.length;
}
</script>

Graph Test

[/code]

#2

I also tried the following, but then my labels say ‘undefined’!

[code]
var myPieChart;
function doOnLoad() {
myPieChart = new dhtmlXChart({
view:“pie”,
container:“chart”,
value:"#ID#",
label:"#reservation_hour#",
// pieInnerText:"#reservation_hour#",
shadow:0,
group:{
by:"#reservation_hour#",
map:{
ID:[’#ID#’,setCount]
}
}
});

	myPieChart.load("<?php echo bloginfo('template_url'); ?>/buyer_sales/jpnx_regs_graph_conn.php");

}
function setCount(prop,data){
 return data.length;
}
</script>

[/code]


#3

Hello
Here is documentation about grouping
docs.dhtmlx.com/chart__functor.html
and sample
dhtmlx.com/docs/products/dhtmlxC … cales.html

There is grouping by “company” and function for “sales” group.
Simple sample:

{company: "a", sales: 1}, {company: "a", sales: 2}, {company: "b", sales: 3}
After grouping we have:

{id: "a", sales: 1.5}, {id: "b": sales: 3}

So, there is a question: what field do you want to use as grouping parameter?


#4

It doesn’t work…
I tried using all the samples, but none of them have a count-function so I cannot seem to get what I need.

I need records grouped by: #reservation_hour# with also the labels of these hours. (It’s a varchar field.)
Then I need the records to be counted and show how many companies come at what hour.

e.g.
1 'o clock : 10 companies
2 'o clock : 9 companies
3 'o clock : 14 companies
and so on. Where the amount of companies is basically the amount of records.

Any ideas?
Cheers!


#5

Here is a demo for you:

[code]

DHTMLX test html,body { width: 100%; height: 100%; margin: 0; }
[/code] Result is on the picture: