<%@ Page Language="c#" AutoEventWireup="false" Inherits="ms.aq.cview.BPDefault" %>

<%@ Import Namespace="ms.aq.cview" %>
<%@ Import Namespace="ms.aq.cview.util" %>
<%@ Register TagPrefix="uc2" TagName="Header" Src="tinytop.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>[<%=Request.Params["tableName"] %>] CasJobs Plot</title>
    <link rel="shortcut icon" href="../favicon.ico" type="image/vnd.microsoft.icon" />
    <link href="cview.css" rel="stylesheet" />
    <link href="../cjobs.css" rel="stylesheet" />

    <script type="text/javascript" src="scripts/qspop.js"></script>

    <script type="text/javascript" src="scripts/BufferFactory.js"></script>

    <script type="text/javascript" src="scripts/PreviewBot.js"></script>

    <script type="text/javascript" src="scripts/importNode.js"></script>

    <script type="text/javascript" src="scripts/PlotTypeManager.js"></script>

    <script type="text/javascript" src="scripts/ClickEventBot.js"></script>

    <script type="text/javascript" src="scripts/SeriesManager.js"></script>

    <script type="text/javascript" src="scripts/xhr.js"></script>

    <script type="text/javascript" src="scripts/requests.js"></script>

    <script type="text/javascript" src="scripts/responses.js"></script>

    <script type="text/javascript" src="scripts/init.js"></script>

    <script type="text/javascript" src="scripts/focus.js"></script>

    <meta http-equiv="Pragma" content="no-cache" />
</head>
<body onload="ceb.Init();ptm.TogglePlotType();" onclick="qspop.hideqsnodeNow();"
    style="padding: 0; margin: 0">
    <table id="big_table" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
        <tr>
            <td id="header" colspan="2">
                <uc2:Header ID="Header" runat="server" />
            </td>
        </tr>
        <tr>
            <td id="rootLeftPaneTD" style="vertical-align: top;" height="100%" rowspan="3">
                <div id="rootLeftPane" style="vertical-align: top; width: 225; height: 100%">
                    <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
                        <tr>
                            <td>
                              <table cellpadding="0" cellspacing="0" style="width: 100%;">
                                    <tr>
                                        <th style="text-align: left;">
                                            Table:</th>
                                        <th style="width: 100%">
                                            &nbsp;</th>
                                        <th style="text-align: right;">
                                            <%=Session[BPDefault.BPTABLE] %>
                                        </th>
                                    </tr>
                                </table>
                                <table cellpadding="0" cellspacing="0" style="width: 100%;">
                                    <tr>
                                        <td style="display: none; width: 0;">
                                            <select id="plotTypeDDL" onchange="ptm.TogglePlotType();" style="display: none;">
                                                <option value="<%=PrefixDecoder.P1 %>">Range & Series</option>
                                                <option value="<%=PrefixDecoder.P2 %>">Scatter</option>
                                            </select>
                                            <select id="aggDDL" style="display: none">
                                                <option title="Average" value="<%=AggregateFunctions.Avg %>">avg</option>
                                                <option title="Count" value="<%=AggregateFunctions.Count %>">cnt</option>
                                                <option title="Max" value="<%=AggregateFunctions.Max %>">max</option>
                                                <option title="Min" value="<%=AggregateFunctions.Min %>">min</option>
                                                <option title="Sum" value="<%=AggregateFunctions.Sum %>">sum</option>
                                            </select>
                                        </td>
                                        <th id="readyPane" style="text-align: left; white-space: nowrap;">
                                            <input type="button" class="btn" value="Reset" onclick="ceb.ResetAll();" style="padding: 0;
                                                margin: 0; display: none;" />
                                            <input id="pbutton" type="button" class="btn" value="Plot" onclick="ceb.DoPlot();"
                                                style="margin: 0 1 0 0" />
                                        </th>
                                         <th style="white-space: nowrap; text-align: right; width: 100%; vertical-align: middle;" colspan="3">
                                            Resolution
                                            <select id="rezDDL" onchange="">
                                                <option value="4">Medium</option>
                                                <option value="8">Coarse</option>
                                                <option value="1">Fine</option>
                                            </select>
                                        </th>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 100%; vertical-align: top; padding: 3 0 0 0; margin: 0 0 0 0;"
                                id="ltd">
                                <div id="dim_browser_title" style="vertical-align: top; padding: 0 0 0 0; margin: 0 0 0 0">
                                </div>
                                <div id="leftPane" style="vertical-align: top; overflow: auto;">
                                    <div id="dim_browser" style="vertical-align: top; overflow: auto">
                                        Loading...
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
            <td style="width: 100%; height: inherit; vertical-align: top;" id="outerCenter">
                <div style="overflow: auto; width: 100%; height: 100%;">
                    <div id="centerPane" style="width: 100%; overflow: auto;">
                        <h4 style="margin:0">
                            CasJobs Plot</h4>
                        <div style="padding: 0 4 0 3">
                            <div style="width: 500;">
                                <p>
                                    This tool is designed to provide a visual representation of table data through simple
                                    scatter plots.
                                </p>
                                <p>
                                    Plot data is specified using a 'range' and 'series' system, similar to that of a
                                    popular spreadsheet application.</p>
                                <p>
                                    To get started, first pick a column from the left panel that will represent the
                                    range of this plot. This column will correspond to the x-axis of your plot.</p>
                                <p>
                                    After choosing a range, you should then select at least one column to represent
                                    your plot's serie[s]. These selections will be arranged on the y-axis.</p>
                                <p>
                                    To change a selection, first click on its title (ie 'Range' or 'Series 1'), then
                                    click on your new selection. To remove a selection simply click on the selected
                                    column so that it is no longer highlighted.</p>
                                <p>
                                    Once you've made your selections, you can then produce an image by clicking 'Plot'.
                                    The brightness of a cell indicates its density.</p>
                                <p>
                                    The size of the plot is determined by availble window, thus you can get a larger/smaller
                                    plot by resizing your browser.</p>
                                <p>
                                    Plot queries are limited by the 'Quick' queue of the MyDB context. If you're having
                                    timeout or memory problems, try lowering the resolution.</p>
                                <p>Known Issues</p>
                                <ul>
                                    <li>Multiple series on the same plot must be the same data type. </li>
                                    <li>Column listing fails for group tables.</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <form style="display: none;" name="pform" id="pform" method="post" action="preview.aspx"
        target="pframe">
        <input type="hidden" id="ptype" name="ptype" value="<%=PrefixDecoder.P1 %>" />
        <input type="hidden" id="targ" name="targ" />
        <input type="hidden" id="val" name="val" />
        <input type="hidden" id="rval" name="rval" />
        <input type="hidden" id="agg" name="agg" />
        <input type="hidden" id="width" name="width" />
        <input type="hidden" id="height" name="height" />
        <input type="hidden" id="doplot" name="doplot" />
        <input type="hidden" id="reset" name="reset" />
        <input type="hidden" id="xmin" name="xmin" />
        <input type="hidden" id="xmax" name="xmax" />
        <input type="hidden" id="ymin" name="ymin" />
        <input type="hidden" id="ymax" name="ymax" />
        <input type="hidden" id="atab" name="atab" value="<%=Session[BPDefault.BPTABLE] %>" />
        <input type="hidden" id="rez" name="rez" />
    </form>
    <input type="hidden" style="display: none" id="deepHList" />
    <iframe style="display: none; width: 100%; position: absolute; top: 0; left: 0;"
        name="mframe" id="mframe"></iframe>
    <iframe style="display: none; width: 100%; position: absolute; top: 0; left: 0;"
        src="preview.aspx" name="pframe" id="pframe"></iframe>
    <div id="messagePane" style="top: 0; left: 0; visibility: hidden; position: absolute;
        overflow: auto">
    </div>
    <div id="fhelp" style="visibility: hidden; position: absolute; top: 0; left: 0">
        Click to show columns for this Range/Series</div>
</body>
</html>
