Exemplo n.º 1
0
 /// <summary>
 /// 下一個
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     if (iStock < (Stocks.Count() - 1))
     {
         iStock = iStock + 1;
     }
     GoToWeb();
 }
Exemplo n.º 2
0
 private void GoToWeb()
 {
     webBrowser1.Url = new Uri(string.Format(@"https://so.cnyes.com/JavascriptGraphic/chartstudy.aspx?country=tw&market=tw&code={0}&divwidth=990&divheight=330", Stock.Id.ToString()));
     label1.Text     = string.Format("{0} {1} {2}/{3}", Stock.Id, Stock.Name, iStock, Stocks.Count() - 1);
     label2.Text     = GetStockType();
 }
Exemplo n.º 3
0
        private void GoTo()
        {
            try
            {
                string today       = System.DateTime.Today.ToString("yyyy-MM-dd");
                string yearAgo     = System.DateTime.Today.AddYears(-1).ToString("yyyy-MM-dd");
                string rnd         = System.Guid.NewGuid().ToString().Replace("-", "");
                string filename    = "i" + rnd + "__Rimage";
                string filenamePNG = filename + ".png";
                string rcode       = string.Format(@"library(quantmod)
			stock <- getSymbols('{0}.TW', auto.assign = FALSE,from='{1}')
			ind <- apply(stock, 1, function(x) all(is.na(x)))
			stock <- stock[!ind,]
			chartSeries(stock['{1}::{2}'],name='{3}')"            ,
                                                   Stock.Id, "2017-01-03", "2018-01-25", filename);
                REngine engine = REngine.GetInstance();
                engine.Initialize();

                //engine.Evaluate(string.Format("png(file='{0}',bg ='transparent',width={1},height={2})", filename, this.pictureBox1.Width, this.pictureBox1.Height));

                engine.Evaluate(rcode);
                //engine.Evaluate("dev.off");

                //string path = System.IO.Path.GetFullPath(filenamePNG);
                //Bitmap image = new Bitmap(path);
                //pictureBox1.Image = image;
                label1.Text = string.Format("{0} {1} {2}/{3}", Stock.Id, Stock.Name, iStock, Stocks.Count());
                label2.Text = GetStockType();
            }
            catch (Exception e) {
            }
        }