K2 vs flashChart 1 year 10 months ago #143964

Hi, id like to use flashChart - www.jschmidt-systemberatung.de/index.php?option=com_content&view=article&id=176&Itemid=240&lang=en#overview
with K2 to show graphs generated from data saved in extrafields. But know next to nothing about databases and proper coding, so don't know how to call data from certain extra field in database.

Created simple sample page at vgamuseum.info/index.php/test-area where it works with standard data like number of hits, code looks like this.

{flashchart height="10000" width="90%" data="database" sql="Select title, hits From umhtg_k2_items Order By hits Asc" tooltip="#val# MPixel/s" title="Pixel Fillrate"}test007{/flashchart}

Now i need replace this part - sql="Select title, hits From umhtg_k2_items Order By hits Asc" - but cant simply replace "hits" for extra_fields, because data are stored there in this format:

[{"id":"1","value":"1"},{"id":"2","value":"Avenger"},{"id":"3","value":["6","8"]},{"id":"4","value":["16"]},{"id":"5","value":"16MB"},{"id":"6","value":["6","11"]},

So i need to call only one value from one id (in mine testing page for example i need value from id 29).

Is there any way how to do it?

Here is also image from phpmyadmin to see how looks data in extra_fields -
Last Edit: 1 year 10 months ago by Cz Vlask. Reason: x
  • Lefteris
  • Lefteris's Avatar
  • OFFLINE
  • Moderator
  • Posts: 9660

K2 vs flashChart 1 year 10 months ago #143969

Hi,

You need some PHP code to do this. The data in the field "extra_fields" are encoded in JSON. This means that you can use PHP's json_decode function ( php.net/manual/en/function.json-decode.php ) to turn this into an object and access the variables you wish.
IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/
Moderators: william white

Who Is Online

Total users online: 4 Members and 4367 Guests Online
Claudio Rosselli Jason Knobloch Harald Matthias
Legend ::   Site Administrator Global Moderator Moderator Banned User Guest
  • Total Messages: 134388 | Total Subjects: 35697
  • Total Sections: 6 | Total Categories: 32
  • Today Open: 0 | Yesterday Open: 4
  • Today Total Answer: 1 | Yesterday Total Answer: 28
Powered by Kunena Forum