Página 1 de 1

ChartDirector

NotaPublicado: 2014-08-22 10:13 @468
por seafree
Hola. Me podrán apoyar con el manejo de configuración del formato de etiquetas en las gráficas de ChartDirector setLabelFormat.

Espero alguien me responda, para plantearle la situación.

Gracias.

Re: ChartDirector

NotaPublicado: 2014-08-22 11:56 @538
por seafree
Utilizo la siguiente sentencia para dibujar una gráfica de PIE en Chartdirector:

$c->setLabelFormat("<*block*>{label}<*font=arialbd.ttf,color=FF0000*> \${value}K<*br*><*block*>\n <*block,halign=center*><*color=000000*>({percent}%)<*block*>");

Pero necesito que el parámetro ${value} tome los valores de un arreglo distinto a los de los sectores de la gráfica, no usado en los parámetros de la gráfica. Así creé un arreglo independiente y necesito usar el arreglo creado para representarlo como value.

Les agradezco su valioso apoyo, saludos.

Re: ChartDirector

NotaPublicado: 2014-08-22 15:38 @693
por explorer
Las etiquetas, junto con los datos, se definen con el método setData().

Te valdría con cambiar la referencia al del array con las etiquetas, ¿no?
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!/usr/bin/perl
  2. use perlchartdir;
  3.  
  4. # The data for the pie chart
  5. my $data = [25, 18, 15, 12, 8, 30, 35];
  6.  
  7. # The labels for the pie chart
  8. my $labels = ["Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities", "Production"];
  9.  
  10. # Create a PieChart object of size 360 x 300 pixels
  11. my $c = new PieChart(360, 300);
  12.  
  13. # Set the center of the pie at (180, 140) and the radius to 100 pixels
  14. $c->setPieSize(180, 140, 100);
  15.  
  16. # Set the pie data and the pie labels
  17. $c->setData($data, $labels);
  18.  
  19. # Output the chart
  20. $c->makeChart("simplepie.png")
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4

Imagen

Más ejemplos de tartas.