Exemplo n.º 1
0
        private void LoadChartData()
        {
            int     i;
            TabPage newTab;
            VisualSummaryTabPage vspage;

            for (i = 0; i < dataSet.Count; i++)
            {
                //Update the selected equity tab control
                if (!tabControlLocked)
                {
                    if (i == 0)
                    {
                        tabVisualsData.TabPages[0].Text = dataSet[i].Name.PadRight(dataSet[i].Name.Length + TAB_X_PAD_CHARS, ' ');
                        visualSummaryTabPage1.BindDataSet(dataSet[i]);
                    }
                    else
                    {
                        newTab = new TabPage();
                        vspage = new VisualSummaryTabPage(dataSet[i]);
                        newTab.Controls.Add(vspage);
                        newTab.Text = dataSet[i].Name.PadRight(dataSet[i].Name.Length + TAB_X_PAD_CHARS, ' ');
                        tabVisualsData.TabPages.Add(newTab);
                        vspage.Anchor       = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        vspage.Width        = tabVisualsData.TabPages[0].Controls[0].Width;
                        vspage.Invalidated += new InvalidateEventHandler(this.vspage_Invalidated);
                    }
                }

                //Plot the chart data
                chartMain.Series.Add(dataSet[i].Name);
                chartMain.Series[dataSet[i].Name].ChartType = SeriesChartType.Line;

                if (((VisualSummaryTabPage)tabVisualsData.TabPages[i].Controls[0]).DisplayedData == DisplayedDataSet.HISTORICAL)
                {
                    chartMain.Series[dataSet[i].Name].Points.DataBindXY(dataSet[i].HistoricalPriceDate, dataSet[i].HistoricalPrice);
                    chartMain.CreateCandleStick(dataSet[i], dataSet[i].Name);
                }
                else if (((VisualSummaryTabPage)tabVisualsData.TabPages[i].Controls[0]).DisplayedData == DisplayedDataSet.LIVE)
                {
                    chartMain.Series[dataSet[i].Name].Points.DataBindXY(dataSet[i].DailyTime, dataSet[i].DailyLast);
                }
                else
                {
                }

                AddChartLegend();
                CorrelationTableSortInstruction.Add(String.Empty);
            }

            chartMain.CurrentSeriesIndex = 0;
            UpdateChartTitles();

            if (tabVisualsData.SelectedIndex != lastDisplayedCorrelation)
            {
                BindCorrelationTable();
                lastDisplayedCorrelation = tabVisualsData.SelectedIndex;
            }
        }
Exemplo n.º 2
0
        private void AppendChartData(List <Equity> appData)
        {
            int     i, total_index;
            TabPage newTab;
            VisualSummaryTabPage vspage;

            for (i = 0; i < appData.Count; i++)
            {
                if (!tabControlLocked)
                {
                    //Update tab control
                    newTab = new TabPage();
                    vspage = new VisualSummaryTabPage(appData[i]);
                    newTab.Controls.Add(vspage);
                    newTab.Text = appData[i].Name.PadRight(appData[i].Name.Length + TAB_X_PAD_CHARS, ' ');
                    tabVisualsData.TabPages.Add(newTab);
                    vspage.Anchor       = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    vspage.Width        = tabVisualsData.TabPages[0].Controls[0].Width;
                    vspage.Invalidated += new InvalidateEventHandler(this.vspage_Invalidated);

                    //Plot chart data
                    chartMain.Series.Add(appData[i].Name);
                    chartMain.Series[appData[i].Name].ChartType = SeriesChartType.Line;

                    total_index = i + dataSet.Count - 1;
                    if (((VisualSummaryTabPage)tabVisualsData.TabPages[total_index].Controls[0]).DisplayedData == DisplayedDataSet.HISTORICAL)
                    {
                        chartMain.Series[appData[i].Name].Points.DataBindXY(appData[i].HistoricalPriceDate, appData[i].HistoricalPrice);
                        chartMain.CreateCandleStick(appData[i], appData[i].Name);
                    }
                    else if (((VisualSummaryTabPage)tabVisualsData.TabPages[total_index].Controls[0]).DisplayedData == DisplayedDataSet.LIVE)
                    {
                        chartMain.Series[appData[i].Name].Points.DataBindXY(appData[i].DailyTime, appData[i].DailyLast);
                    }
                    else
                    {
                    }

                    AddChartLegend();
                    CorrelationTableSortInstruction.Add(String.Empty);
                }
            }

            UpdateChartTitles();
        }