How to plot a listbox or an arrylist?

Jul 14, 2015 at 6: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.SetEnvironmentVariables();
            REngine engine = REngine.GetInstance();
            // REngine requires explicit initialization.
            // You can set some parameters.
            engine.Initialize();
            
            String RCommand = "plot(" + var1 + "," + Var2 + ")";
            engine.Evaluate(RCommand.ToString());
        }
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();
            try
            {
                conDataBase.Open();
                MySqlDataReader myReader = cmdDataBase.ExecuteReader();
                while (myReader.Read())
                {
                    //MessageBox.Show(""+myReader.GetFieldType(0));
                    //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);
                    DataAnnualPrice.Add(DataPrice);

//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("require('ggplot2')");
                    engine.Evaluate("library('ggplot2')");
                    engine.Evaluate("my_data <- data.frame(v1)");
                    engine.Evaluate("myChart <- ggplot(my_data, aes(x=Price, y=Quantity)) + geom_line()");
                    engine.Evaluate("print(myChart)");
Could you please give me a help to go one step forward?

Thanks