Ejemplo n.º 1
0
        public void InsertDetails(List <Eco.Company> companies, int selectedindex)
        {
            listofCompanies = companies;
            FieldName.Text  = Field.fieldName;


            //insert company names:
            if (companyList.Items.Count < 1)
            {
                companyList.Items.Clear();
                for (int i = 0; i < listofCompanies.Count; i++)
                {
                    //make listboxitem to shove name into (with force)
                    TextBlock item = new TextBlock();
                    item.Text = listofCompanies[i].name;
                    //item.PointerPressed += Item_PointerPressed;
                    //item.PointerReleased += Item_PointerPressed;
                    companyList.Items.Add(item);
                }
            }

            if (selectedindex != -1)
            {
                Eco.Company selectedcomp = listofCompanies[companyList.SelectedIndex];
                CompanyName.Text    = selectedcomp.name;
                companyValue.Text   = "Company value: " + selectedcomp.Value.ToString();
                currStockPrice.Text = "Stock price: " + selectedcomp.stockprice.ToString();

                //shove prices into graphs
                loadCompanyGraphs(selectedcomp);
            }
            else
            {
                //load the first company's details in already, before the user has to click anything
                Eco.Company comp1 = listofCompanies[0];
                CompanyName.Text    = comp1.name;
                companyValue.Text   = "Company value: " + comp1.Value.ToString();
                currStockPrice.Text = "Stock price: " + comp1.stockprice.ToString();

                //shove stock prices into chart: biek baukes moet daarmit mar eem helpen
                loadCompanyGraphs(listofCompanies[0]);
            }
        }
Ejemplo n.º 2
0
        void loadCompanyGraphs(Eco.Company comp)
        {
            stockPriceChart.Series.Clear();
            companyValueChart.Series.Clear();

            //INSERT COMPANY VALUES
            FastLineSeries series = new FastLineSeries()
            {
                ItemsSource  = comp.ValueviewModel.values,
                XBindingPath = "Year",
                YBindingPath = "Value"
            };

            series.ListenPropertyChange = true;

            companyValueChart.Series.Add(series);

            //INSERT STOCK PRICES
            FastCandleBitmapSeries candleSeries = new FastCandleBitmapSeries()
            {
                ItemsSource  = comp.stockViewModel.prices1m,
                XBindingPath = "Year",
                High         = "High",
                Low          = "Low",
                Open         = "Open",
                Close        = "Close"
            };

            candleSeries.ListenPropertyChange = true;
            candleSeries.BullFillColor        = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 70, 220, 75));
            candleSeries.BearFillColor        = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 235, 30, 30));
            //stockPriceChart.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 30, 30, 35));

            (stockPriceChart.SecondaryAxis as NumericalAxis).ZoomFactor = 1.4;
            candleSeries.ComparisonMode = FinancialPrice.None;

            stockPriceChart.Series.Add(candleSeries);
        }