Example #1
0
    protected void PopulateSPAGauge(ZedGraphWeb z, Graphics g, MasterPane masterPane)
    {
        GraphPane myPane = masterPane[0];

        // Define the title
        myPane.Title.Text                 = (String)ViewState["territory"];
        myPane.Title.FontSpec.Size        = 34;
        myPane.Title.FontSpec.IsAntiAlias = false;
        myPane.Title.FontSpec.IsBold      = false;
        myPane.Title.FontSpec.FontColor   = Util.ColourTryParse("#989898");

        // Fill the pane and chart
        myPane.Fill                = new Fill(Util.ColourTryParse("#ff191919"), Util.ColourTryParse("#ff191919"), 45.0f);
        myPane.Chart.Fill          = new Fill(Util.ColourTryParse("#333333"), Util.ColourTryParse("#333333"), 45.0f); //Color.LightGray, Color.Black,
        myPane.Chart.Fill.RangeMax = 16;
        myPane.Chart.Fill.RangeMin = 0;

        // Don't show any axes for the gas gauge
        myPane.XAxis.IsVisible  = false;
        myPane.Y2Axis.IsVisible = false;
        myPane.YAxis.IsVisible  = false;

        //Define needles
        // Plot average RAG value by converting to percentage of 18 max then reverse value as chart plots backwards.
        float          plotVal = 100 - (((float)ViewState["avgRAG"] / (float)16) * 100);
        GasGaugeNeedle gg1     = new GasGaugeNeedle("Suspects", plotVal, Color.DimGray);

        gg1.NeedleWidth = 100;
        myPane.CurveList.Add(gg1);

        //Define all regions
        GasGaugeRegion ggr1 = new GasGaugeRegion("Green", 0.0f, 7.0f, Color.Green);
        GasGaugeRegion ggr2 = new GasGaugeRegion("Yellow", 7.0f, 63.0f, Color.Gold);
        GasGaugeRegion ggr3 = new GasGaugeRegion("Red", 63.0f, 100.0f, Color.Red);

        // Add the regions
        myPane.CurveList.Add(ggr1);
        myPane.CurveList.Add(ggr2);
        myPane.CurveList.Add(ggr3);
        myPane.Legend.IsVisible   = false;
        myPane.Chart.Border.Color = Color.DimGray;
        myPane.Margin.Left        = 34;
        myPane.Margin.Right       = 34;
        myPane.Margin.Bottom      = 30;
        myPane.Margin.Top         = 4;
        myPane.AxisChange();

        ViewState["myPane"] = myPane;
    }
    protected void PopulateSPAGauge(ZedGraph.Web.ZedGraphWeb z, Graphics g, ZedGraph.MasterPane masterPane)
    {
        GraphPane myPane = masterPane[0];
        // Get territory report details with user's full name
        String    qry = "SELECT TeamName FROM db_ccateams WHERE TeamID=@team_id";
        DataTable dt  = SQL.SelectDataTable(qry, "@team_id", (String)ViewState["team_id"]);

        // Define the title
        if (dt.Rows.Count > 0 && dt.Rows[0]["TeamName"] != DBNull.Value)
        {
            myPane.Title.Text = dt.Rows[0]["TeamName"].ToString();
        }

        if ((String)ViewState["timeScheme"] == "latest")
        {
            teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : " + (int)ViewState["timeScale"] + " Weeks";
            if ((int)ViewState["timeScale"] == 1)
            {
                teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : " + "Latest Week";
            }
        }
        else
        {
            teamNameLabel.Text = "Team '" + Server.HtmlEncode(dt.Rows[0]["TeamName"].ToString()) + "' : Between Selected";
        }

        myPane.Title.FontSpec.Size        = 34;
        myPane.Title.FontSpec.IsAntiAlias = false;
        myPane.Title.FontSpec.IsBold      = false;
        myPane.Title.FontSpec.FontColor   = Util.ColourTryParse("#989898");

        // Fill the pane and chart
        myPane.Fill                = new Fill(Util.ColourTryParse("#ff191919"), Util.ColourTryParse("#ff191919"), 45.0f);
        myPane.Chart.Fill          = new Fill(Util.ColourTryParse("#333333"), Util.ColourTryParse("#333333"), 45.0f); //Color.LightGray, Color.Black,
        myPane.Chart.Fill.RangeMax = 16;
        myPane.Chart.Fill.RangeMin = 0;

        // Don't show any axes for the gas gauge
        myPane.XAxis.IsVisible  = false;
        myPane.Y2Axis.IsVisible = false;
        myPane.YAxis.IsVisible  = false;

        // Define needles
        // Plot average RAG value by converting to percentage of 18 max then reverse value as chart plots backwards.
        float          plotVal = 100 - (((float)ViewState["avgRAG"] / (float)16) * 100);
        GasGaugeNeedle gg1     = new GasGaugeNeedle("Suspects", plotVal, Color.DimGray);

        gg1.NeedleWidth = 100;
        myPane.CurveList.Add(gg1);

        //Define all regions
        GasGaugeRegion ggr1 = new GasGaugeRegion("Green", 0.0f, 7.0f, Color.Green);
        GasGaugeRegion ggr2 = new GasGaugeRegion("Yellow", 7.0f, 63.0f, Color.Gold);
        GasGaugeRegion ggr3 = new GasGaugeRegion("Red", 63.0f, 100.0f, Color.Red);

        // Add the regions
        myPane.CurveList.Add(ggr1);
        myPane.CurveList.Add(ggr2);
        myPane.CurveList.Add(ggr3);
        myPane.Legend.IsVisible   = false;
        myPane.Chart.Border.Color = Color.DimGray;
        myPane.Margin.Left        = 34;
        myPane.Margin.Right       = 34;
        myPane.Margin.Bottom      = 30;
        myPane.Margin.Top         = 4;
        myPane.AxisChange();

        ViewState["myPane"] = myPane;
    }
Example #3
0
    // Populate Graphs
    protected void PopulateSPAGauge(ZedGraphWeb z, Graphics g, MasterPane masterPane)
    {
        String user_territory = Util.GetUserTerritory();

        GraphPane myPane = masterPane[0];

        // Define the title
        myPane.Title.FontSpec.Size        = 34;
        myPane.Title.FontSpec.IsAntiAlias = false;
        myPane.Title.FontSpec.IsBold      = false;
        myPane.Title.FontSpec.FontColor   = Util.ColourTryParse("#989898");

        // Fill the pane and chart
        myPane.Fill                = new Fill(Util.ColourTryParse("#ff191919"), Util.ColourTryParse("#ff191919"), 45.0f);
        myPane.Chart.Fill          = new Fill(Util.ColourTryParse("#333333"), Util.ColourTryParse("#333333"), 45.0f);
        myPane.Chart.Fill.RangeMax = 16;
        myPane.Chart.Fill.RangeMin = 0;

        // Don't show any axes for the gas gauge
        myPane.XAxis.IsVisible  = false;
        myPane.Y2Axis.IsVisible = false;
        myPane.YAxis.IsVisible  = false;

        float  needleVal = (float)0.0;
        String office    = z.ID.Replace("1", " ").Replace("zg_", "").Replace("_", " ");

        needleVal         = CalculateRAG(office);
        myPane.Title.Text = office;

        // If admin/finance (or your territory) show all
        //if (!Roles.IsUserInRole("db_HomeHubTL") || z.ID.ToString().ToLower().Contains(user_territory.ToLower().Replace(" ", "")))
        //{
        // Define needles
        // Plot average RAG value by converting to percentage of 18 max then reverse value as chart plots backwards.
        float plotVal = 100 - (((float)needleVal / (float)16) * 100);

        if (plotVal.ToString() == "NaN")
        {
            plotVal = (float)100.0;
        }
        GasGaugeNeedle gg1 = new GasGaugeNeedle("Suspects", plotVal, System.Drawing.Color.DimGray);

        gg1.NeedleWidth = 100;
        myPane.CurveList.Add(gg1);
        //}

        //Define all regions
        GasGaugeRegion ggr1 = new GasGaugeRegion("Green", 0.0f, 7.0f, System.Drawing.Color.Green);
        GasGaugeRegion ggr2 = new GasGaugeRegion("Yellow", 7.0f, 63.0f, System.Drawing.Color.Gold);
        GasGaugeRegion ggr3 = new GasGaugeRegion("Red", 63.0f, 100.0f, System.Drawing.Color.Red);

        // Add the regions
        myPane.CurveList.Add(ggr1);
        myPane.CurveList.Add(ggr2);
        myPane.CurveList.Add(ggr3);
        myPane.Legend.IsVisible   = false;
        myPane.Chart.Border.Color = System.Drawing.Color.DimGray;
        myPane.Margin.Left        = 34;
        myPane.Margin.Right       = 34;
        myPane.Margin.Bottom      = 30;
        myPane.Margin.Top         = 4;
        myPane.AxisChange();
    }