Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/10/2015, 09:26
javierconesa23
 
Fecha de Ingreso: febrero-2011
Ubicación: Barcelona
Mensajes: 195
Antigüedad: 13 años, 2 meses
Puntos: 1
implementar Gauge circular a respuesta de un select

hola buenas encontre un medior circular en javascript:
Código Javascript:
Ver original
  1. <body>
  2.     <div id="gg1" style="width: 200px; height: 150px;"></div>
  3.     <a href="#" id="gg1_refresh" class="button grey">Random Refresh</a>
  4.     <script src="../raphael-2.1.4.min.js"></script>
  5.     <script src="../justgage-1.1.0.min.js"></script>
  6.     <script>
  7.     document.addEventListener("DOMContentLoaded", function(event) {
  8.         var gg1 = new JustGage({
  9.             id: "gg1",
  10.             value: 50,
  11.             min: 0,
  12.             max: 100,
  13.             title: "Cupo",
  14.             label: "Toneladas",
  15.             textRenderer: customValue
  16.         });
  17.  
  18.         document.getElementById('gg1_refresh').addEventListener('click', function() {
  19.             gg1.refresh(getRandomInt(0, 100000));
  20.             return false;
  21.         });
  22.  
  23.         function customValue(val) {
  24.             if (val < 50) {
  25.                 return 'low';
  26.             } else if (val > 50) {
  27.                 return 'high';
  28.             } else if (val === 50) {
  29.                 return 'noideal';
  30.             }
  31.         }
  32.     });
  33.     </script>
  34. </body>
me gustaria saber como puedo hacer el valor del medidor representara una respuesta de un select como por ejemplo esta:
Código PHP:
Ver original
  1. if (is_array($incidencias))
  2. {   echo '<div class="form-group">';                            
  3.     echo '<label class="col-sm-3 control-label">Contratos</label>';
  4.     echo '<div class="col-sm-5">'; 
  5.     echo '<select name="elejir_contratos" class="selectboxit" onchange="mostrarValor(this);">';
  6.     foreach($incidencias as $cust)
  7.     {
  8.        
  9.         echo '<option value="'.$cust->Cdad_disponible.'">'.$cust->Num_contrato.'</option>';
  10.        
  11.     }
  12.     echo '<option selected="disabled">Selecciona un Contrato</option>';
  13.     echo '</select>';
  14.     echo '</div>'; 
  15.     echo '<input type="text" name="cupo" id="cupo" value="" />';
  16.  
  17. }
  18. ?>
  19. <script>
  20. var mostrarValor = function(x){
  21.             document.getElementById('cupo').value=x.value;                           <<-----------------------------------------------------------
  22.             }
  23. </script>
  24. <?
  25.  
  26. die();

Gracias