× Support forum for php-RGraph and php-rgraph content plugin for Joomla

Data from MySql Database using K2

7 Monate 5 Tage her - 7 Monate 5 Tage her #1251 von jochen
jochen antwortete auf Data from MySql Database using K2
hi,

chart options  "responsive" has not (yet) been implemented - I have to look into this. Anyway this does only help with text and not with canvas-graphics. Canvas Size (width and height) must be set to number of pixels. (e.g. if you specify "100%" size will be set to "100"). You may google about this - you will find  lots of discussions about this topic..

There is no easy standard way from a server (php) perspective to find out the pixel-size of your document area within a browser client window,, in order to set canvas size to a desired value.
 
So the best and easiest way is in my opinion to leave it to the user.  
Folgende Benutzer bedankten sich: Vlask

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 5 Tage her #1250 von Vlask
Vlask antwortete auf Data from MySql Database using K2

jochen schrieb: 2.you cannot use percent values for width or height (html5 'canvas' doesnot support this)


Maybe found solution, but i'm not sure that can be used with joomla plugin and for sure i dont know how to properly implement the code....Simplest example can be found in offline RGRAPHs demos under name "A responsive Horizontal Bar chart"
They seems to be using responsive function to define graphs size as well fonts sizes according to screen resolutions. But i have to define them manually. Code looks like this...not sure that i can use it in this formatting...

}).grow().responsive([
                  {maxWidth: 600, width: 400, height: 200, options: {textSize: 8}},
{maxWidth: 900, width: 400, height: 200, options: {textSize: 12}},
{maxWidth: null, width: 700, height: 350, options: {textSize: 19}}

Info page about function is here -  www.rgraph.net/canvas/responsive.html

You think that this can be used together with joomla?

jochen schrieb: cannot access your flashchart sample ( vgamuseum.info/index.php/charts/fillrates ) - it kills  my browser (firefox)

It works in Opera, its disabled in chrome and firefox portable show something, but its not drawed properly. Thats why i need to change from flash plugin.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 6 Tage her #1247 von jochen
jochen antwortete auf Data from MySql Database using K2
hi,

glad to hear that my proposal works...

here some hints to your questions:
1. you may of course have any number of copies of db php-script (you call it via your its name in url-parameter)
2.you cannot use percent values for width or height (html5 'canvas' doesnot support this)
3.you found it: - its done by labelsAbove="true"
4.what do you mean with "text description of bars" (you mean tooltips)?

cannot access your flashchart sample ( vgamuseum.info/index.php/charts/fillrates ) - it kills  my browser (firefox)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 1 Woche her - 7 Monate 1 Woche her #1246 von Vlask
Vlask antwortete auf Data from MySql Database using K2
Edit: found how to fix number 4 - its defined by truncate_label="20,..".
And number 3) its done by labelsAbove="true"

No need to answer that....or anything at all if you dont have time... i will eventually find the solution....

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 1 Woche her #1245 von Vlask
Vlask antwortete auf Data from MySql Database using K2
Thanks a lot, it works!!!!!
Still have some minor issues, but i guess it just needs some more documentation reading.

Now it looks like this and i'm very happy that it works at all

vgamuseum.info/index.php/charts/test-area

goal is to make it look like old flash version

vgamuseum.info/index.php/charts/fillrates

So i may have some few questions for you....

1) if i want more graphs i guess just copy getJsonDatafromDB.php and rename it to for example getJsonDatafromDB1.php and then edit mysql code in it and in another article just call new getJsonDatafromDB1.php file.....

2)can i use % of width and height in defining graph sizes? because in flashchart its working great, charts are dynamicaly changing size according to browser window and height according to number of records. I tried to change default width in backend plugin settings, but it won't allow me enter %, only numbers are accepted. Height in % would be great too. Should i use code in article, or its there a way how to set it in plugin backend?
Tried using 100% width in article code and it only shinked graph size....

3)any quick tip how to show numbers on the right side of graph bars? some numbers are really low compared to highest and bar sizes are too tiny to even click on them by mouse to see value :-)

4)how to make show whole text description of bars in chart? tried to change Default left margin to 50 in plugin backend, it helped a little bit, but increasing this number even higher has zero effect.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 1 Woche her - 7 Monate 1 Woche her #1235 von jochen
jochen antwortete auf Data from MySql Database using K2
hi,
you may try this:

Install php-RGraph (download-url: www.jschmidt-systemberatung.de/downloads/php-RGraph-V2.zip ) e.g. into
'/php-apps'

1. change all double-qotes(") in your sql into "qq"
2. create this code 'getJsonDatafromDB.php' in your 'templates/system' directory
<?php

defined('_JEXEC') or die('Restricted access');
$lib = JPATH_ROOT . "/php-apps/RGraph/lib/rgraph_chart.php";
require_once ($lib);

$db_config_file = $_SERVER["DOCUMENT_ROOT"] . "/configuration.php";
$sql="SELECT
title,
round(substr(extra_fields,
((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))),
((locate('qq}',extra_fields,((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields)+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))))))-(locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))-(char_length('{qqidqq:qq29qq,qqvalueqq:qq')))
))
as final
FROM umhtg_k2_items where substr(extra_fields,
((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))),
((locate('qq}',extra_fields,((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields)+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))))))-(locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))-(char_length('{qqidqq:qq29qq,qqvalueqq:qq')))
) >1
order by
cast(substr(extra_fields,
((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))),
((locate('qq}',extra_fields,((locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields)+(char_length('{qqidqq:qq29qq,qqvalueqq:qq'))))))-(locate('{qqidqq:qq29qq,qqvalueqq:qq',extra_fields))-(char_length('{qqidqq:qq29qq,qqvalueqq:qq')))) as decimal)  desc";

$sql = str_replace('qq', '"', $sql);

$dbdata = rgraph_chart::getDataFromDB($db_config_file, $sql);

$data = array("labels"=>$dbdata[0], "data"=>$dbdata[1]);

echo json_encode($data);

?>
>

3. build rgraph plugin paramters like
{rgraph height="400" width="600" variantThreedOffsety="10"  variantThreedOffsetx="15"data="url" 
url="http://your-host/index.php?option=com_content&tmpl=getJsonDatafromDB" type="Bar" tooltip="#label# <br>#val#" title="your title"
marginBottom="105" truncate_label="20,.." variant="3d" tooltipsPositionStatic="0"}sample006{/rgraph}
Folgende Benutzer bedankten sich: Vlask

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Ladezeit der Seite: 0.116 Sekunden
Powered by Kunena Forum

Besucher

Heute: 24
Gestern: 24
Diese Woche: 481
Letzte Woche: 441
Dieser Monat: 1.158
Letzter Monat: 2.369
0171602
United States 30,1% USA
Germany 20,0% Deutschland
Russia 4,4% Russland
France 3,4% Frankreich
Italy 2,8% Italien
Indonesia 2,6% Indonesien
India 2,1% Indien
Poland 2,1% Polen
Spain 2,1% Spanien

Total:

204

Länder

Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbesssern. Auf keinen Fall werden persönliche oder vertrauliche Daten gespeichert oder weitergegeben.