moose2004

Members
  • Content count

    4
  • Joined

  • Last visited

Posts posted by moose2004


  1. Afternoooon,

     

    I am unable to get my cylinder to color anything other then grey... I could hard code the color but I need the cylinder to change colors based on value.

     

    here is my xml.

    var chart_data = "<chart baseFontColor='FFFFFF' majorTMColor='FFFFFF' bgColor='000000'  bgAlpha='100' showBorder='0' cylHeight='200' tickMarkGap='5' upperLimit='20.00' lowerLimit='0.00' numberSuffix='FT' dataStreamURL='DATA URL' refreshInterval='5'>";
    chart_data += "		<colorRange>";
    chart_data += "			<color minValue='0' maxValue='17' code='33BB00'  label='Good'/>";
    chart_data += "			<color minValue='17' maxValue='18' code='FFFF00' label='Bad'/>";
    chart_data += "			<color minValue='18' maxValue='20' code='FF0000' label='Oh noes!'/>";
    chart_data += "		</colorRange>";
    chart_data += "		<styles>";
    chart_data += "			<definition>";
    chart_data += "				<style type='font' name='valueFont' borderColor='FFFFFF' bold='1' size='13'/>";
    chart_data += "			</definition>";
    chart_data += "			<application>";
    chart_data += "				<apply toObject='value' styles='valueFont'/>";
    chart_data += "			</application>";
    chart_data += "		</styles>";
    chart_data += "		<value>8.8</value>";
    chart_data += "</chart>";
    

     

     

    what am i doing wrong?


  2. I have implemented an angular gauge with a database query returning a numeric value to the gauge. Working great! Now I would like to also return a time stamp from the database and display it as a label below the gauge. How can achieve this?? I have attached image of what it currently looks like.

     

    Here is my javascript code…

     

    <div id="angular_<?php echo $random_value; ?>" align="center" style="width: 100%; height: 100%" >

    <script type="text/javascript">

    var myChart = new FusionCharts("<?php echo $SERVER_ADDRESS; ?>/includes/functions/widgets/gauges/fusion/AngularGauge.swf", "myChartId_<?php echo $random_value; ?>", "280", "280", "0", "0");

     

    var chart_data = "<chart tickValueDistance='30' pivotRadius='5' pivotFillColor='333333' bgAlpha='0' bgColor='000000' showBorder='0' basefontColor='FFFFFF' chartTopMargin='15' chartBottomMargin='100' chartLeftMargin='37' chartRightMargin='37' toolTipBgColor='80A905' gaugeFillMix='{dark-10},FFFFFF,{dark-10}' gaugeFillRatio='3' lowerLimit='<?php echo $min; ?>' upperLimit='<?php echo $max; ?>' numberSuffix='<?php echo $si; ?>' dataStreamURL='<?php echo $SERVER_ADDRESS; ?>/includes/functions/widgets/gauges/fusion/data/data_stream.php?location_id=<?php echo $location_id; ?>&parameter_id=<?php echo $parameter_id; ?>' refreshInterval='5' >";

    chart_data += " <colorRange>";

    chart_data += " <color minValue='0' maxValue='<?php echo ($max * (1/3)); ?>' code='8BBA00'/>";

    chart_data += " <color minValue='<?php echo ($max * (1/3)); ?>' maxValue='<?php echo ($max * (2/3)); ?>' code='8BBA00'/>";

    chart_data += " <color minValue='<?php echo ($max * (2/3)); ?>' maxValue='<?php echo $max; ?>' code='8BBA00'/>";

    chart_data += " </colorRange>";

    chart_data += " <dials>";

    chart_data += " <dial value='0' rearExtension='10' showValue='1' valueY='220' bgColor='FF5904' borderColor='FF0000'/>";

    chart_data += " </dials>";

    chart_data += " <styles>";

    chart_data += " <definition>";

    chart_data += " <style type='font' name='valueFont' borderColor='FFFFFF' bold='1' size='13'/>";

    chart_data += " </definition>";

    chart_data += " <application>";

    chart_data += " <apply toObject='value' styles='valueFont'/>";

    chart_data += " </application>";

    chart_data += " </styles>";

    chart_data += "</chart>";

     

    myChart.setDataXML(chart_data);

    myChart.setTransparent(true);

    myChart.render("angular_<?php echo $random_value; ?>");

    </script>

    </div>

     

    Here is my php code…

     

    $location_id = $_GET['location_id'];

    $parameter_id = $_GET['parameter_id'];

     

    $query = "SELECT

    parameter_{$parameter_id}.data,

    parameter_{$parameter_id}.date_time,

    unit.math

    FROM

    parameter_{$parameter_id}, location, parameter, unit

    WHERE

    parameter.id = {$parameter_id} AND

    unit.id = parameter.unit_id AND

    location.id = {$location_id} AND

    location.plc_id = parameter_{$parameter_id}.plc_id

    ORDER BY

    date_time DESC

    LIMIT 0,1";

    $result = mysql_query($query) or die(mysql_error());

    if($row = mysql_fetch_assoc($result))

    {

    $data = $row['data'];

    $date_time = $row['date_time'];

     

    switch($row['math'][0])

    {

    case '/' : $data /= substr($row['math'],1); break;

    case '*' : $data *= substr($row['math'],1); break;

    }

    echo "&value=" . $data . "&date_time=" . $date_time;

    }

     

    pic1.bmp