-
Notifications
You must be signed in to change notification settings - Fork 7
/
adx.aspx
101 lines (92 loc) · 4.7 KB
/
adx.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="adx.aspx.cs" Inherits="Analytics.adx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
html, body, form {
height: 100%;
}
.chart {
width: 100% !important;
height: 100% !important;
}
.label {
text-align: right;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 100%; border: groove; text-align: left">
<h3 id="headingtext" runat="server" style="text-align:center">Average directional movement index</h3>
<table>
<tr>
<td style="border-right: dashed; border-right-width: thin;">
<asp:Label ID="Label2" runat="server" Text="From date:"></asp:Label>
<asp:TextBox ID="textboxFromDate" runat="server" TextMode="Date"></asp:TextBox><br />
<asp:Label ID="Label1" runat="server" Text="To date:"></asp:Label>
<asp:TextBox ID="textboxToDate" runat="server" TextMode="Date"></asp:TextBox><br />
<asp:Button ID="buttonShowGraph" runat="server" Text="Reset Graph to dates" OnClick="buttonShowGraph_Click" TabIndex="2" />
</td>
</tr>
</table>
</div>
<asp:ScriptManager ID="scriptManager1" runat="server" />
<asp:HiddenField ID="panelWidth" runat="server" Value="" />
<asp:HiddenField ID="panelHeight" runat="server" Value="" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width: 100%; height: 100%">
<ContentTemplate>
<asp:Chart ID="chartADX" runat="server" CssClass="chart" Visible="false" BorderlineColor="Black" BorderlineDashStyle="Solid" EnableViewState="True"
OnClick="chartADX_Click" ImageType="Png">
<%--onmouseover="drawline(this)" onmouseout="clearline(this)"--%>
<%--<Titles>
<asp:Title Name="titleADX" Text="Average Directional Movement Index" Alignment="TopCenter" Font="Microsoft Sans Serif, 10pt"></asp:Title>
</Titles>
<Legends>
<asp:Legend Name="legendADX" LegendItemOrder="SameAsSeriesOrder" Docking="Top" Alignment="Center" LegendStyle="Row" BorderDashStyle="Dash" BorderColor="Black"></asp:Legend>
</Legends>--%>
<Series>
<asp:Series Name="seriesADX" Legend="legendADX" LegendText="ADX" ChartType="Line" ChartArea="chartareaADX" PostBackValue="#VALX, #VALY" ToolTip="Date:#VALX; Value:#VALY"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="chartareaADX" AlignmentOrientation="Vertical"></asp:ChartArea>
</ChartAreas>
</asp:Chart>
<asp:Button ID="btnPostBack" runat="server" Style="display: none" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
<script type="text/javascript">
(function () {
var panel = document.getElementById('<%= UpdatePanel1.ClientID %>');
var panelWidth = document.getElementById('<%= panelWidth.ClientID %>');
var panelHeight = document.getElementById('<%= panelHeight.ClientID %>');
var initialWidth = panel.offsetWidth;
var initialHeight = panel.offsetHeight;
function getChangeRatio(val1, val2) {
return Math.abs(val2 - val1) / val1;
};
function redrawChart() {
setTimeout(function () {
initialWidth = panel.offsetWidth;
initialHeight = panel.offsetHeight;
document.getElementById('<%= btnPostBack.ClientID %>').click();
}, 0);
};
function savePanelSize() {
var isFirstDisplay = panelWidth.value == '';
panelWidth.value = panel.offsetWidth;
panelHeight.value = panel.offsetHeight;
var widthChange = getChangeRatio(initialWidth, panel.offsetWidth);
var heightChange = getChangeRatio(initialHeight, panel.offsetHeight);
if (isFirstDisplay || widthChange > 0.2 || heightChange > 0.2) {
redrawChart();
}
};
savePanelSize();
window.addEventListener('resize', savePanelSize, false);
})();
</script>
</body>
</html>