Sign in to follow this  
bobotime

Widget Hlineargauge With Php And Mysql

Recommended Posts

Hello guys,

I wanted to create this widget with PHP, because it does not work with this code?

I do like to display readings with php and MySQL? :)

 

thank you very much

 

<?php
$query= "SELECT
COUNT(CODE_A) AS TOT_A,
COUNT(CODE_ AS TOT_B
FROM CUSTOMER";
$result=mysql_query($query) or die("Query fallita".mysql_error()." ".$query);
$ors = mysql_fetch_array($result);

$perc_= $ors_2['TOT_B'] / $ors['TOT_A'] * 100;
$perc = number_format($perc_, 0, '.', '');

$strXML = "<Chart bgColor='FFFFFF' bgAlpha='0' showBorder='0' upperLimit='100' lowerLimit='0' gaugeRoundRadius='5' chartBottomMargin='10' ticksBelowGauge='0' 
showGaugeLabels='0' valueAbovePointer='0' pointerOnTop='1' pointerRadius='9'>";
$strXML .= "<colorRange>"; 
$strXML .= "<color minValue='0' maxValue='100' name='GOOD'  />";
$strXML .= "<color minValue='35' maxValue='70' name='WEAK' />"; 
$strXML .= "<color minValue='70' maxValue='100' name='BAD' />";
$strXML .= "</colorRange>";

$strXML .= "<value>" . $perc . "</value>";

$strXML .= "<styles>";
$strXML .= "<definition>";
$strXML .= "<style name='ValueFont' type='Font' bgColor='333333' size='10' color='FFFFFF'/>";
$strXML .= "</definition>";
$strXML .= "<application>";
$strXML .= "<apply toObject='VALUE' styles='valueFont'/>";
$strXML .= "</application>";	
$strXML .= "</styles>";

$strXML .= "</chart>";

echo renderChart("swf/HLinearGauge.swf", "", $strXML, "PERC_CUST", 250, 50, false, false, true);
?>

Share this post


Link to post
Share on other sites

Please note that to provide value to the HLinearGauge you need to use <pointer> element.

 

I do not understand why the graph HLinearGauge.swf the example of XML code in the official documentation is this?

 

<Chart bgColor='FFFFFF' bgAlpha='0' showBorder='0' upperLimit='100' lowerLimit='-50' gaugeRoundRadius='5' chartBottomMargin='10' ticksBelowGauge='0' 
showGaugeLabels='0' valueAbovePointer='0' pointerOnTop='1' pointerRadius='9'>
   <colorRange> 
       <color minValue='0' maxValue='100' name='GOOD'  />
       <color minValue='35' maxValue='70' name='WEAK' /> 
       <color minValue='70' maxValue='100' name='BAD' />
   </colorRange>
   <value>-11</value>

   <styles>
       <definition>
           <style name='ValueFont' type='Font' bgColor='333333' size='10' color='FFFFFF'/>
       </definition>
       <application>
           <apply toObject='VALUE' styles='valueFont'/>
       </application>	
   </styles>
</Chart>

 

anyway I do not work either with the pointer :)

 

 

.

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

We have kept this for backward compatibility.

 

However, it would be helpful if you can please show us your issue through screenshot.

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this