New question

Question:

Date: 18-06-2019 18:50:13 (In Spanish)

Winwheel[Unresolved]

Estoy haciendo una ruleta con la libreria winwheel, tengo el código pero quiero generar los segmentos de manera dinamica el script que tengo hasta ahora es este:
<script type="text/javascript">

var miRuleta = new Winwheel({


'numSegments':<?php echo $segmi; ?>,
'outerRadius': 170,

'segments': [

{'fillstyle': '#f1c40f', 'text': 'C#'},
{ 'fillStyle': '#2ecc71', 'text': 'JavaScript' },
{ 'fillStyle': '#e67e22', 'text': 'Python' },
{ 'fillStyle': '#e74c3c', 'text': 'Php' },
{ 'fillStyle': '#8e44ad', 'text': 'Go' },


],
'animation': {
'type': 'spinToStop', // Giro y alto
'duration': 8, // Duración de giro
'callbackFinished': 'Mensaje()', // Función para mostrar mensaje
'callbackAfter': 'dibujarIndicador()' // Funciona de pintar indicador
}

});
function Mensaje() {
var SegmentoSeleccionado = miRuleta.getIndicatedSegment();
alert("Elemento seleccionado:" + SegmentoSeleccionado.text + "!");
// reinicio de la ruleta (valor inicial)
miRuleta.stopAnimation(false);
miRuleta.rotationAngle = 0;
miRuleta.draw();
dibujarIndicador();
}
dibujarIndicador();
function dibujarIndicador() {
var ctx = miRuleta.ctx;
ctx.strokeStyle = 'navy';
ctx.fillStyle = 'black';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(170, 0);
ctx.lineTo(230, 0);
ctx.lineTo(200, 40);
ctx.lineTo(171, 0);
ctx.stroke();
ctx.fill();
}
</script>
De antemano gracias.
Tags: Database - HTML - Javascript - JQuery Votes: 0 - Answers: 3 - Views: 4 Share on: Google Facebook Twitter LinkedIn Link
 

Answers:

  • Date: 20-06-2019 12:00:12 y tu problema es....   Votes: 0 - Link answer
     
  • Date: 20-06-2019 17:08:58 Tal y como puse en la descripción "quiero generar los segmentos de manera dinamica" es decir cargar desde una tabla en mi base de datos esta parte:
    'segments': [

    {'fillstyle': '#f1c40f', 'text': 'C#'},
    { 'fillStyle': '#2ecc71', 'text': 'JavaScript' },
    { 'fillStyle': '#e67e22', 'text': 'Python' },
    { 'fillStyle': '#e74c3c', 'text': 'Php' },
    { 'fillStyle': '#8e44ad', 'text': 'Go' },


    ],
      Votes: 0 - Link answer
     
  • Date: 20-06-2019 17:11:23 Lo que dice C#, javascript, python etc. pero que esos valores sean un campo por ejemplo dirección de una tabla de usuarios.   Votes: 0 - Link answer
     
To actively participate in the community first must authenticate, enter the system.Sign In
 
frjcbbae garagebible.com