Gráfico Dashboard - Extendido a más tipos

La funcionalidad gráfica del dashboard se expandió en v11 release 1 para soportar SVG, PNG y un URL para una imagen (Google Chart URL). Este ejemplo muestra cómo integrar los 3 nuevos tipos de gráficos en su sitio Web.

Creación de un gráfico dashboard

Un gráfico dashboard se crea desde el panel de control. La clave para activar la funcionalidad de gráficos es marcar la casilla de selección "Use Chart" en el editor de Dashboards.

Nota: al menos debe añadirse un campo al dashboard para guardar el gráfico dashboard.

En este ejemplo, creamos 3 dashboards llamados PNG_Chart, SVG_Chart y Google_Chart. Desde la base final, cada gráfico dashboard será generado desde el método llamado DAX_DevHook_DefineChart. Así se el método DAX_DevHook_DefineChart:

  C_TEXT($1;$2;$3;$ReportName_t;$SelectionName_t;$ReportOwner_t)
  If(Count parameters>=3)
    $ReportName_t:=$1
    $SelectionName_t:=$2
    $ReportOwner_t:=$3
    Case of
      : ($ReportName_t="PNG_Chart") & ($SelectionName_t="View_1")
        C_PICTURE ($png_pic)
        Set_Chart_PNG (->$png_pic) ` Crear un gráfico PNG
        DAX_Dev_SetDashboardPNG (->$png_pic) ` Definir PNG creado para el Dashboard
      : ($ReportName_t="SVG_Chart") & ($SelectionName_t="View_1")
        C_BLOB ($svg_x)
        Set_Chart_SVG (->$svg_x) ` Crear un gráfico SVG
        DAX_Dev_SetDashboardSVG (->$svg_x) ` Definir SVG creado para el Dashboard
      : ($ReportName_t="Google_Chart") & ($SelectionName_t="View_1")
        C_TEXT ($googleurl_t)
        Set_Chart_GoogleURL (->$googleurl_t) ` Crear un Google Chart URL
        DAX_Dev_SetDashboardImageURL (->$googleurl_t) ` Definir Google URL creado para el Dashboard
    End case
  End if

Cargar gráfico Dashboard en HTML

En el archivo HTML, el comando dax_chartViewer se ejecuta en la función onAfterInit. El comando carga un gráfico dashboard en un <DIV> específico.

    Sintaxis: dax_chartViewer(DashboardName, DivReference);

pngchart = new dax_chartViewer('PNG_Chart', $('pngdiv'));
svgchart = new dax_chartViewer('SVG_Chart', $('svgdiv'));
googchart = new dax_chartViewer('Google_Chart', $('googdiv'));