如何在asp.net中使用c#绘制图形而不使用zed图形

本文关键字:图形 zed 绘制 net asp | 更新日期: 2023-09-27 18:14:53

我有一个web应用程序,我想在图形中显示一些数据,我使用zedgraph dll,但现在我想通过使用系统dll不与zed图形绘制图形

zed图形代码如下

protected void ZedGraphWeb1_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, System.Drawing.Graphics g, ZedGraph.MasterPane masterPane)
    {
        // Get the GraphPane so we can work with it
        GraphPane myPane = masterPane[0];
        // Set the title and axis labels        
        myPane.XAxis.Title.Text = "Order Status";
        myPane.YAxis.Title.Text = "No Of Orders";
        myPane.XAxis.Type = AxisType.Text;
        string[] labels = { "Pending", "Elapsed", "Dispatched", "Delivered" };
        myPane.XAxis.Scale.TextLabels = labels;
        //myPane.XAxis.Scale.TextLabels = arr1;
        // Declare a BarItem:- Bar Item is used for creating a bar     
        BarItem myCurve;
        BarItem myCurve2;
        // Declare a LineItem:- LineItem is used for creating a line     
        PointPairList listEcoPack = new PointPairList();
        PointPairList listProduct = new PointPairList();
        double[] lstEcoPack = new double[4];
        double[] lstProduct = new double[4];

                   OrderStatusoutput objOrderStatusoutput = new OrderStatusoutput();
            OrderStatusinput objOrderStatusinput = new OrderStatusinput();
                objOrderStatusinput.StartDate = Convert.ToDateTime(txtfromdatepacks.Text).ToShortDateString();
                objOrderStatusinput.EndDate = Convert.ToDateTime(txttodatepacks.Text).ToShortDateString();
                objOrderStatusoutput.dsorderstatusresult = objHrservice.OrderStatus(objOrderStatusinput).dsorderstatusresult;
                objHrservice.Close();
                DataSet dsoreder = objOrderStatusoutput.dsorderstatusresult;
                double EcoPendingOrders = Convert.ToDouble(dsoreder.Tables[4].Rows[0]["PendingOrders"]);
                double EcoElapsed = Convert.ToDouble(dsoreder.Tables[4].Rows[0]["Elapsed"]);
                double EcoDispatchedOrders = Convert.ToDouble(dsoreder.Tables[4].Rows[0]["DispatchedOrders"]);
                double EcoDeliveredOrders = Convert.ToDouble(dsoreder.Tables[4].Rows[0]["DeliveredOrders"]);
                double ProPendingOrders = Convert.ToDouble(dsoreder.Tables[3].Rows[0]["PendingOrders"]);
                double ProElapsed = Convert.ToDouble(dsoreder.Tables[3].Rows[0]["Elapsed"]);
                double ProDispatchedOrders = Convert.ToDouble(dsoreder.Tables[3].Rows[0]["DispatchedOrders"]);
                double ProDeliveredOrders = Convert.ToDouble(dsoreder.Tables[3].Rows[0]["DeliveredOrders"]);


                lstEcoPack[0] = EcoPendingOrders;
                lstEcoPack[1] = EcoElapsed;
                lstEcoPack[2] = EcoDispatchedOrders;
                lstEcoPack[3] = EcoDeliveredOrders;

                lstProduct[0] = ProPendingOrders;
                lstProduct[1] = ProElapsed;
                lstProduct[2] = ProDispatchedOrders;
                lstProduct[3] = ProDeliveredOrders;
            }

如何在asp.net中使用c#绘制图形而不使用zed图形

在ASP中尝试微软的图表控件。网https://web.archive.org/web/20211020203246/https://www.4guysfromrolla.com/articles/072209 - 1. - aspx

        GraphPane pane = zedGraphControl1.GraphPane;
        pane.Title.Text = "Graph By Alax Technology";
        pane.XAxis.Title.Text = "EMPLOYEE";
        pane.YAxis.Title.Text = "SALARY";
        PieItem Attendence = pane.AddPieSlice(Convert.ToDouble(textBox1.Text), System.Drawing.Color.Orange, 0f, "Attendence");
        PieItem Grown = pane.AddPieSlice(Convert.ToDouble(textBox2.Text), System.Drawing.Color.White, 0f, "Grown Up");
        PieItem Salary = pane.AddPieSlice(Convert.ToDouble(textBox3.Text), System.Drawing.Color.Green, 0f, "Salary Increase");
        Attendence.LabelType = PieLabelType.Value;
        Grown.LabelType = PieLabelType.Value;
        Salary.LabelType = PieLabelType.Value;
        zedGraphControl1.AxisChange();
        zedGraphControl1.Invalidate();
        zedGraphControl1.Refresh();