Exemplo n.º 1
0
    private void OnRenderGraph(ZedGraph.Web.ZedGraphWeb z, 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.Title.Text = "";
        myPane.YAxis.Title.Text = "User";
        myPane.XAxis.Title.Text = "Productivity %";

        //	Get productivity for team users.

        DateTime DateStart = this.cc2DateSelector.StartDate();
        DateTime DateEnd = this.cc2DateSelector.EndDate();

        myPane.Title.Text = string.Format("{0} - {1}", ClassTimeAndDate.DateToString(DateStart), ClassTimeAndDate.DateToString(DateEnd));

        ClassReport oRep = new ClassReport();
        DataSet oDs = oRep.GetTeamProductivity(Convert.ToInt32(this.DdlTeams.SelectedValue), Convert.ToInt32(this.DdlUsers.SelectedValue), DateStart, DateEnd);
        Int32 RowNo = 0;

        string[] labels = new string[oDs.Tables[0].Rows.Count];
        double[] values = new double[oDs.Tables[0].Rows.Count];

        for (RowNo = 0; RowNo < oDs.Tables[0].Rows.Count; RowNo++)
        {
            labels[RowNo] = oDs.Tables[0].Rows[RowNo]["UserName"].ToString();
            values[RowNo] = Convert.ToDouble(oDs.Tables[0].Rows[RowNo]["Productivity"].ToString());
        }

        myPane.YAxis.Scale.TextLabels = labels;
        myPane.YAxis.Type = AxisType.Text;

        myPane.XAxis.Scale.Min = 0;
        myPane.XAxis.Scale.Max = 120.0;
        myPane.XAxis.MajorTic.Size = 10.0F;
        myPane.XAxis.MajorTic.IsInside = false;
        myPane.XAxis.MajorGrid.IsVisible = true;
        myPane.XAxis.MinorTic.Size = 5.0F;
        myPane.XAxis.MinorTic.IsInside = false;

        //	Legend.

        BarItem myCurve = myPane.AddBar("Productivity", values, null, Color.Red);

        //	Chart background.

        myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 45.0F);

        myPane.BarSettings.Base = BarBase.Y;

        masterPane.AxisChange(g);
        BarItem.CreateBarLabels(myPane, false, "f0");

        Page.Title = TXT_PAGETITLE;
        this.LblPageTitle.Text = TXT_PAGETITLE;
    }