[FX.php List] jquery/gChart help
Gjermund Gusland Thorsen
ggt667 at gmail.com
Fri Jan 9 01:01:54 MST 2009
foreach( $r['data'] as $k => $v ) {
$tmp[] = $v['label'];
$tmp[] = $v['color'];
$tmp[] = $v['y1'];
$chart = implode( ',', $tmp );
unset( $tmp );
}
$chart should now contain something similar to
---
burgundy,ff0000,2
bourdeaux,00ff00,3
cabernet,0000ff,5
---
asuming these are field names: label,color,y1 and you did a reasonable
FMFind prior to the foreach.
ggt667
2009/1/9 Steve Winter <steve at bluecrocodile.co.nz>:
> Hi David,
> I've never used gChart before, but I'm going to take a punt at what you're
> trying to do, and make a few assumptions about the structure of your
> database and the labels that you want...
> I presume in FM you have a table which looks something like this;
> label quantity
> burgundy 2
> bordeaux 3
> cabernet 5
> If the labels in FM are the same as the labels that you want to put on the
> chart, then I'd suggest adding another field to your database and storing
> the colour in there as well, so extend the above table,
> label quantity colour
> burgundy 2 ff00ff
> bordeaux 3 00ffff
> cabernet 5 0000ff
> Then you can do an FX FindAll, and a simple foreach loop to parse the data
> from the query into whatever format the gChart engine requires (writing it
> an xml file? javascript array...?)
> If any of my assumptions above aren't correct, then let us know and we can
> add more information...
> Hope this helps
> Cheers
> Steve
> On 8 Jan 2009, at 22:56, david weiner wrote:
>
> Hi,
> Does anyone on the list have experience getting data formatted correctly
> from Filemaker to FX and picked up by the gChart jQuery plugin?
> I've got it all but working and am missing just how to format my data so it
> can be successfully parsed by the Google Chart API.
> What I've got is a qty listing of wine that I'm trying to get into the
> requested format of:
> label,color,y1 burgundy,ff0000,2 bourdeaux,00ff00,3 cabernet,0000ff,5
> (where 2,3 and 5 are qty's stored in the db)
> All help is appreciated, and if there's a suggestion for a better way to
> bring data into charts please let me know.
> Thanks,
> David
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
More information about the FX.php_List
mailing list