Mini Kabibi Habibi
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="indexContent" ContentPlaceHolderID="ContentHolder" runat="server">
<script type="text/javascript">
// <![CDATA[
$(window).load(UpdateLabelPositionDisabled);
function SetLabelPositionEnabled() {
$("#labelLevel")[0].disabled = false;
}
function UpdateLabelPositionDisabled() {
$("#labelLevel")[0].disabled = !($("#showLabels")[0].checked);
}
// ]]>
</script>
<%
Html.BeginForm();
ChartFinacialViewsDemoOptions options = (ChartFinacialViewsDemoOptions)ViewData[ChartDemoHelper.OptionsKey];
%>
<div class="chartOptionsPanel" style="height:40px;">
<div style="float: left;">
<div style="padding-bottom: 4px;">
<label for="view">View Type:</label>
<%=Html.DropDownList("view", ChartDemoHelper.GetFinancialViews())%>
</div>
<div>
<%=Html.CheckBox("showLabels", options.ShowLabels, new { onclick = "UpdateLabelPositionDisabled()", style = "vertical-align: -2px; margin-left: 0px; padding-left: 0px;" })%>
<label class="checkBox" for="showLabels">Show Labels</label>
</div>
</div>
<div>
<div style="padding-bottom: 4px;">
<label style="margin-left: 8px;" for="reductionLevel">Reduction Level:</label>
<%=Html.DropDownList("reductionLevel", typeof(StockLevel), options.ReductionLevel)%>
<%=Html.CheckBox("workDaysOnly", options.WorkDaysOnly, new { style = "vertical-align: -2px; margin-left: 5px;" })%>
<label class="checkBox" for="workDaysOnly">Work Days Only</label>
</div>
<div>
<div style="float: left; vertical-align:baseline;">
<label style="margin-left: 8px; margin-right: 26px;" for="labelLevel">Label Level:</label>
<%=Html.DropDownList("labelLevel", ChartDemoHelper.GetFinancialLabelLevels())%>
</div>
<input style="float: right;" type="submit" value="Apply" onclick="SetLabelPositionEnabled()"/>
</div>
</div>
</div>
<br/>
<%
ChartControlSettings settings = new ChartControlSettings();
settings.Name = "chart";
settings.BorderOptions.Visible = false;
settings.Height = 400;
settings.Width = 700;
settings.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
settings.CrosshairEnabled = options.ShowLabels ? DefaultBoolean.False : DefaultBoolean.True;
Series series = new Series("DELL", options.View);
series.LabelsVisibility = options.ShowLabels ? DefaultBoolean.True : DefaultBoolean.False;
((FinancialSeriesViewBase)series.View).ReductionOptions.Level = options.ReductionLevel;
((StockPointOptions)series.Label.PointOptions).ValueLevel = options.LabelLevel;
series.ArgumentScaleType = ScaleType.DateTime;
series.ArgumentDataMember = "Date";
series.ValueDataMembers[0] = "LowValue";
series.ValueDataMembers[1] = "HighValue";
series.ValueDataMembers[2] = "OpenValue";
series.ValueDataMembers[3] = "CloseValue";
settings.Series.Add(series);
XYDiagram diagram = (XYDiagram)settings.Diagram;
diagram.AxisX.Label.Staggered = true;
diagram.AxisX.GridLines.Visible = true;
diagram.AxisX.Range.SideMarginsEnabled = true;
diagram.AxisX.Interlaced = true;
diagram.AxisX.DateTimeScaleOptions.WorkdaysOnly = options.WorkDaysOnly;
diagram.AxisY.Title.Text = "US Dollars";
diagram.AxisY.Title.Visible = true;
diagram.AxisY.Range.Auto = false;
diagram.AxisY.Range.SetMinMaxValues(23, 30);
diagram.AxisY.GridLines.MinorVisible = true;
settings.Titles.Add(new ChartTitle() {
Font = new Font("Tahoma", 18),
Text = "Stock Prices"
});
settings.Titles.Add(new ChartTitle() {
Alignment = StringAlignment.Far,
Dock = ChartTitleDockStyle.Bottom,
Font = new Font("Tahoma", 8),
TextColor = Color.Gray,
Text = "From bigcharts.marketwatch.com"
});
Html.DevExpress().Chart(settings).Bind(Model)
.Render();
Html.EndForm();
%>
</asp:Content>