This project is read-only.

How to plot a listbox or an arrylist?

Jul 14, 2015 at 7:30 PM
Hi R.NET community,

i have been straggling for days in this part and you are my last chance

i have the following listbox which is loading from MySql. Date is DateTime value and Price is double

Date Price
12/9/1990 15.30
12/9/1990 15.30
12/9/1990 15.30
12/9/1990 15.30
 var date = String.Format("{0,20}", myReader["Date"].ToString());
 var AnnualPrice = String.Format("{0,20}", myReader["AnnualPrice"].ToString());

                ListViewItem item = new ListViewItem(date + "," + AnnualPrice);
i have created my own Plot method RPlot
     public void RPlot(string var1, string Var2)
            REngine engine = REngine.GetInstance();
            // REngine requires explicit initialization.
            // You can set some parameters.
            String RCommand = "plot(" + var1 + "," + Var2 + ")";
but every time that i use it returns me this message 'R_ParseErrorMsg' in the file 'R.dll'

I also have tried the following
ArrayList DataAnnualPrice = new ArrayList();
                MySqlDataReader myReader = cmdDataBase.ExecuteReader();
                while (myReader.Read())
                    //MessageBox.Show("" + myReader.GetFieldType(1));
                    DataPrices DataPrice = new DataPrices();

                    DataPrice.Date = (DateTime)myReader["Date"];
                    DataPrice.AnnualPrice = (double)myReader["AnnualPrice"];
                    int date1 = Convert.ToInt32(DataPrice);
                    int price1 = Convert.ToInt32(DataPrice.AnnualPrice);

//i got the following code from stackoverflow and tried to modify 
                    var v1 = engine.CreateNumericVector(date1); //Initially compiler hits here
                    var v2 = engine.CreateNumericVector(price);
                    engine.SetSymbol("v1", v1);
                    engine.SetSymbol("v2", v2);
                    engine.Evaluate("my_data <- data.frame(v1)");
                    engine.Evaluate("myChart <- ggplot(my_data, aes(x=Price, y=Quantity)) + geom_line()");
Could you please give me a help to go one step forward?