Exemplo n.º 1
0
        public void ShowDailyGraph(string graphName)
        {
            //List<string> paramList;
            DataManager dataManager = new DataManager();
            DataTable   resultTable = dataManager.getNAVRecordsTable(Int32.Parse(Master.selectedSchemeCode.Text), Master.textboxFromDate.Text,
                                                                     Master.textboxToDate.Text);

            if ((resultTable != null) && (resultTable.Rows.Count > 0))
            {
                GridViewDaily.DataSource = resultTable;
                GridViewDaily.DataBind();
                ViewState["SchemeData"] = resultTable;

                chartMF.ChartAreas[0].Visible = true;
                if (chartMF.Series.FindByName(graphName) == null)
                {
                    chartMF.Series.Add(graphName);

                    chartMF.Series[graphName].Name       = graphName;
                    chartMF.Series[graphName].ChartType  = SeriesChartType.Line;
                    chartMF.Series[graphName].ChartArea  = chartMF.ChartAreas[0].Name;
                    chartMF.Series[graphName].Legend     = chartMF.Legends[0].Name;
                    chartMF.Series[graphName].LegendText = graphName;

                    chartMF.Series[graphName].XAxisType = AxisType.Secondary;
                    chartMF.Series[graphName].YAxisType = AxisType.Primary;

                    chartMF.Series[graphName].ToolTip = "Date: #VALX; " + graphName + ": #VALY{#.00}";

                    chartMF.Series[graphName].PostBackValue = graphName + "," + Master.selectedFundName.Text + "," + "#VALX,#VALY{#.00}";

                    chartMF.Series[graphName].XValueMember  = "NAVDATE";
                    chartMF.Series[graphName].XValueType    = ChartValueType.Date;
                    chartMF.Series[graphName].YValueMembers = "NET_ASSET_VALUE";
                    chartMF.Series[graphName].YValueType    = ChartValueType.Double;
                    //indicatorSeries.Points.DataBind(resultTable.Rows, "NAVDATE", "RSI", "");
                }
                else
                {
                    chartMF.Series[graphName].Enabled = true;
                }
                chartMF.Series[graphName].Points.Clear();
                chartMF.Series[graphName].Points.DataBind(resultTable.AsEnumerable(), "NAVDATE", "NET_ASSET_VALUE", "");
            }
        }
Exemplo n.º 2
0
 protected void GridViewDaily_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridViewDaily.PageIndex  = e.NewPageIndex;
     GridViewDaily.DataSource = (DataTable)ViewState["SchemeData"];
     GridViewDaily.DataBind();
 }
Exemplo n.º 3
0
        public void ShowGraph(string scriptName)
        {
            string    folderPath = Server.MapPath("~/scriptdata/");
            bool      bIsTestOn = true;
            DataTable scriptData = null;
            DataTable tempData = null;
            string    expression = "";
            string    outputSize = "";
            string    interval = "";
            string    fromDate = "", toDate = "";

            DataRow[] filteredRows = null;


            if (ViewState["FetchedData"] == null)
            {
                if (Session["IsTestOn"] != null)
                {
                    bIsTestOn = System.Convert.ToBoolean(Session["IsTestOn"]);
                }

                if (Session["TestDataFolder"] != null)
                {
                    folderPath = Session["TestDataFolder"].ToString();
                }
                if ((Request.QueryString["size"] != null) && (Request.QueryString["interval"] != null))
                {
                    outputSize = Request.QueryString["size"].ToString();
                    interval   = Request.QueryString["interval"];
                    scriptData = StockApi.getIntraday(folderPath, scriptName, time_interval: interval, outputsize: outputSize, bIsTestModeOn: bIsTestOn, bSaveData: false);
                }
                ViewState["FetchedData"] = scriptData;
            }
            else
            {
                if (ViewState["FromDate"] != null)
                {
                    fromDate = ViewState["FromDate"].ToString();
                }
                if (ViewState["ToDate"] != null)
                {
                    toDate = ViewState["ToDate"].ToString();
                }

                if ((fromDate.Length > 0) && (toDate.Length > 0))
                {
                    tempData     = (DataTable)ViewState["FetchedData"];
                    expression   = "Date >= '" + fromDate + "' and Date <= '" + toDate + "'";
                    filteredRows = tempData.Select(expression);
                    if ((filteredRows != null) && (filteredRows.Length > 0))
                    {
                        scriptData = filteredRows.CopyToDataTable();
                    }
                }
                else
                {
                    scriptData = (DataTable)ViewState["FetchedData"];
                }
            }
            if (scriptData != null)
            {
                chartintraGraph.DataSource = scriptData;
                chartintraGraph.DataBind();
                chartintraGraph.ChartAreas[0].AxisX.LabelStyle.Format = "g";
                if (checkBoxOpen.Checked)
                {
                    showOpenLine(scriptData);
                }
                if (checkBoxHigh.Checked)
                {
                    showHighLine(scriptData);
                }
                if (checkBoxLow.Checked)
                {
                    showLowLine(scriptData);
                }
                if (checkBoxClose.Checked)
                {
                    showCloseLine(scriptData);
                }
                if (checkBoxCandle.Checked)
                {
                    showCandleStickGraph(scriptData);
                }
                if (checkBoxVolume.Checked)
                {
                    showVolumeGraph(scriptData);
                }
                if (checkBoxGrid.Checked)
                {
                    GridViewDaily.Visible    = true;
                    GridViewDaily.DataSource = scriptData;
                    GridViewDaily.DataBind();
                }
            }
        }