<%@ language = "JavaScript" %>
<% /*
     $Revision$
     $Id$

    fac_usrgraph.asp

    Parameters:
        usrgraph_key      Key in the FAC_USRGRAPH table


*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="fac.inc" -->
<!-- #include file="fac_usrgraph.inc" -->
<%
  FCLTHeader.Requires({plugins: ["jQuery"],
                       js: ["../Localscripts/jqPlot/dist/excanvas.js",
                            "../Localscripts/jqPlot/dist/jquery.jqplot.min.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.canvasTextRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.canvasAxisLabelRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.canvasAxisTickRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.categoryAxisRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.barRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.meterGaugeRenderer.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.pieRenderer.min.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.highlighter.min.js",
                            "../Localscripts/jqPlot/dist/plugins/jqplot.canvasOverlay.js"
                           ],
                       css: ["../Localscripts/jqPlot/dist/jquery.jqplot.css"]
                       });

var usrgraph_key = getQParamInt("usrgraph_key");
var fclt_key = getQParamInt("fclt_key",  -1);
var fclt_text = getQParamArray("fclt_text", []);
// De standaard widget hoogte is 300. Hierbij reserveren we 20 pixels voor de titel
var widget_height = getQParamInt("widget_height", 300)-20;
var l_type = fac_graph_type(usrgraph_key);
if (l_type == 1)
{
    // Alleen bij barchart dit script voor label-points, bij gaugemeter NIET(!) om runtime error te voorkomen (en voegt daar niets toe).
    // "axes[...]._ticks.0.formatter is null or not an object" krijg je namelijk
    // https://bitbucket.org/cleonello/jqplot/issue/201/highlighter-plugin-causes-error-on-hover meldt min of meer hetzelfde
    FCLTHeader.Requires({  js: ["../Localscripts/jqPlot/dist/plugins/jqplot.pointLabels.js"]});
}

var params = { fclt_text: fclt_text };
%>
<html>
<head>
 <% FCLTHeader.Generate() %>
<script type="text/javascript">
  $(document).ready(function()
    {
<%
fac_graph_generate(usrgraph_key, fclt_key, params );
%>
   })
</script>
</head>
<body>
<div id="myGraph" style="height:<%=widget_height%>px;"></div>

</body>
</html>
