在c#中执行时未显示图表

时间:2016-03-06 04:13:31

标签: c# charts highcharts transactions

我有一个汉堡店的销售点系统,我想创建一个显示当天销售额的图表。代码是正确的,但是当我测试它时。交易后图表根本没有显示。 transaction proper

sales chart after transaction

这两个代码如下:

(在交易和保存交易之后)

void paymentSuccess(object sender, PaymentMadeEventArgs e)
        {

            TblTransaction transaction = new TblTransaction();
            transaction.TransactionDate = DateTime.Now;


            if (e.PaymentSuccess == true)
            {
                //save the current transaction 


                foreach (TblProduct product in products)
                {
                    transaction.TblTransactionItems.Add(new TblTransactionItem() { ProductID = product.ProductID });

                }

                rde.AddToTblTransactions(transaction);
                rde.SaveChanges();
            }

(我在图表上的代码):

private void generateGraph()
        {



            using (RanchoPOSDatabaseEntities rde = new RanchoPOSDatabaseEntities()) //inherits the database class of the main form into a private class
            {
                var query = from product in rde.TblTransactionItems    //var ay isang datatype na iniindicate na hindi defined kung anong data ang ipapasok sa system
                            group product by product.TblProduct.Description into g  //groups products by their description at ilalagay sa variable na 'g'
                            select new { ProductID = g.Key, TotalUnitSold = g.Count() };  //display data base on primary key and the number of items sold


                chart1.DataSource = query; //binds the query to the chart1 
                chart1.Series["Series1"].XValueMember = "ProductID";
                chart1.Series["Series1"].YValueMembers = "TotalUnitSold";

                chart1.Series["Series1"].Name = "Products";

                chart1.DataBind();

                chart1.Show();
            }

我使用c# 2010与SQL Server 2008作为媒介,有些人可以查找此>

中的任何更正

1 个答案:

答案 0 :(得分:0)

我刚刚尝试使用调试器,这发生了error during debug

通常,它运行顺利。 这个错误是什么意思?