private void AddSingleVotingDayDataPoint(GeographyBallotCoverageDataPoint dataPoint, Series seriesPositiveSingle)
    {
        if (String.IsNullOrEmpty(Request.QueryString["CircuitId"]) && !CanZoom(dataPoint.GeographyId))
        {
            return;
        }

        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();

        element.YValue = ((absoluteMode?dataPoint.VotingStationsTotal:dataPoint.WVotingStationsTotal)
                          - (absoluteMode?dataPoint.VotingStationsDistroSingle:dataPoint.WVotingStationsDistroSingle));
        element.Name             = geo.Name;
        element.SmartLabel       = new SmartLabel();
        element.SmartLabel.Text  = element.YValue.ToString("#,##0");
        element.SmartLabel.Color = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "AbsoluteBallotDistroStatus.aspx?VotingMode=ElectionDay&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveSingle.Elements.Add(element);
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GeographyBallotCoverageLookup lookup = GetLookupFromCache();

        HtmlTableRow  tr = null;
        HtmlTableCell td = null;

        tr = new HtmlTableRow(); mainTable.Rows.Add(tr);
        td = CreateCell(tr, "Geography");

        td = CreateCell(tr, "GeographyId");
        td = CreateCell(tr, "VoterCount");
        td = CreateCell(tr, "AdvanceVotingStationsDistro");
        td = CreateCell(tr, "AdvanceVotingStationsTotal");
        td = CreateCell(tr, "VotingStationsTotal");
        td = CreateCell(tr, "VotingStationsDistroSingle");
        td = CreateCell(tr, "VotingStationsDistroDouble");
        td = CreateCell(tr, "VotingStationsComplete");
        td = CreateCell(tr, "WAdvanceVotingStationsDistro");
        td = CreateCell(tr, "WAdvanceVotingStationsTotal");
        td = CreateCell(tr, "WWAdvanceVotingStationsDistro");
        td = CreateCell(tr, "WWAdvanceVotingStationsTotal");
        td = CreateCell(tr, "WVotingStationsTotal");
        td = CreateCell(tr, "WVotingStationsDistroSingle");
        td = CreateCell(tr, "WVotingStationsDistroDouble");
        td = CreateCell(tr, "WVotingStationsComplete");

        foreach (int geoId in lookup.Keys)
        {
            tr = new HtmlTableRow(); mainTable.Rows.Add(tr);
            GeographyBallotCoverageDataPoint pt = lookup[geoId];

            td = CreateCell(tr, "" + Geography.FromIdentity((pt.GeographyId)).Name);

            td = CreateCell(tr, "" + pt.GeographyId);
            td = CreateCell(tr, "" + pt.VoterCount);
            td = CreateCell(tr, "" + pt.AdvanceVotingStationsDistro);
            td = CreateCell(tr, "" + pt.AdvanceVotingStationsTotal);
            td = CreateCell(tr, "" + pt.VotingStationsTotal);
            td = CreateCell(tr, "" + pt.VotingStationsDistroSingle);
            td = CreateCell(tr, "" + pt.VotingStationsDistroDouble);
            td = CreateCell(tr, "" + pt.VotingStationsComplete);
            td = CreateCell(tr, "" + pt.WAdvanceVotingStationsDistro);
            td = CreateCell(tr, "" + pt.WAdvanceVotingStationsTotal);
            td = CreateCell(tr, "" + pt.WWAdvanceVotingStationsDistro);
            td = CreateCell(tr, "" + pt.WWAdvanceVotingStationsTotal);
            td = CreateCell(tr, "" + pt.WVotingStationsTotal);
            td = CreateCell(tr, "" + pt.WVotingStationsDistroSingle);
            td = CreateCell(tr, "" + pt.WVotingStationsDistroDouble);
            td = CreateCell(tr, "" + pt.WVotingStationsComplete);
        }
    }
Exemplo n.º 3
0
    private void AddSingleAdvanceDataPoint(GeographyBallotCoverageDataPoint dataPoint, Series seriesPositive, Series seriesNegative)
    {
        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();

        element.YValue           = absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage;
        element.Name             = geo.Name;
        element.SmartLabel       = new SmartLabel();
        element.SmartLabel.Text  = (absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage).ToString("0.0");
        element.SmartLabel.Color = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=Advance&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositive.Elements.Add(element);

        element        = new Element();
        element.YValue = (absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage) - 100;
        element.Name   = geo.Name;
        seriesNegative.Elements.Add(element);

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=Advance&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
    }
    private void AddSingleVotingDayDataPoint (GeographyBallotCoverageDataPoint dataPoint, Series seriesPositiveSingle)
    {
        if (String.IsNullOrEmpty(Request.QueryString["CircuitId"]) && !CanZoom(dataPoint.GeographyId))
            return;

        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();
        element.YValue = ((absoluteMode?dataPoint.VotingStationsTotal:dataPoint.WVotingStationsTotal) 
                         - (absoluteMode?dataPoint.VotingStationsDistroSingle:dataPoint.WVotingStationsDistroSingle));
        element.Name = geo.Name;
        element.SmartLabel = new SmartLabel();
        element.SmartLabel.Text = element.YValue.ToString("#,##0");
        element.SmartLabel.Color = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "AbsoluteBallotDistroStatus.aspx?VotingMode=ElectionDay&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveSingle.Elements.Add(element);



    }
    private void AddSingleVotingDayDataPoint (GeographyBallotCoverageDataPoint dataPoint, Series seriesPositiveSingle, Series seriesPositiveDouble, Series seriesPositiveFull, Series seriesNegative)
    {
        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();
        element.YValue = (((absoluteMode ? dataPoint.VotingStationsDistroSingle : dataPoint.WVotingStationsDistroSingle)
                            - (absoluteMode ? dataPoint.VotingStationsDistroDouble : dataPoint.WVotingStationsDistroDouble)) * 100.0)
                            / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);
        double distroValue = ((absoluteMode ? dataPoint.VotingStationsDistroSingle : dataPoint.WVotingStationsDistroSingle) * 100.0)
                            / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);
        element.Name = geo.Name;
        element.SmartLabel = new SmartLabel();
        element.SmartLabel.DynamicDisplay = false;
        element.SmartLabel.Text = (distroValue).ToString("0.0");
        element.SmartLabel.Color = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
            // hack så att grafen inte blir helt hoptryckt i höjdled när man vill se status för hela sverige /pvz
            if (dataPoint.GeographyId == Geography.SwedenId)
            {
                element.URL += "&Height=5000";
            }
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveSingle.Elements.Add(element);

        // Double coverage

        element = new Element();
        element.YValue = (((absoluteMode ? dataPoint.VotingStationsDistroDouble : dataPoint.WVotingStationsDistroDouble)
                            - (absoluteMode ? dataPoint.VotingStationsComplete : dataPoint.WVotingStationsComplete)) * 100.0)
                            / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);

        element.Name = geo.Name;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveDouble.Elements.Add(element);

        // full coverage - not yet implemented
        element = new Element();
        element.YValue = ((absoluteMode ? dataPoint.VotingStationsComplete : dataPoint.WVotingStationsComplete) * 100.0)
                            / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);

        element.Name = geo.Name;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveFull.Elements.Add(element);

        // neg bar
        element = new Element();
        element.YValue = (absoluteMode ? dataPoint.VotingCoverage : dataPoint.WVotingCoverage) - 100;
        element.Name = geo.Name;
        seriesNegative.Elements.Add(element);

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
    }
    private void AddSingleAdvanceDataPoint (GeographyBallotCoverageDataPoint dataPoint, Series seriesPositive, Series seriesNegative)
    {
        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();
        element.YValue = absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage;
        element.Name = geo.Name;
        element.SmartLabel = new SmartLabel();
        element.SmartLabel.Text = (absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage).ToString("0.0");
        element.SmartLabel.Color = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=Advance&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositive.Elements.Add(element);

        element = new Element();
        element.YValue = (absoluteMode ? dataPoint.AdvanceVotingCoverage : dataPoint.WWAdvanceVotingCoverage) - 100;
        element.Name = geo.Name;
        seriesNegative.Elements.Add(element);

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=Advance&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
    }
Exemplo n.º 7
0
    private void AddSingleVotingDayDataPoint(GeographyBallotCoverageDataPoint dataPoint, Series seriesPositiveSingle, Series seriesPositiveDouble, Series seriesPositiveFull, Series seriesNegative)
    {
        Geography geo = Geography.FromIdentity(dataPoint.GeographyId);

        Element element = new Element();

        element.YValue = (((absoluteMode ? dataPoint.VotingStationsDistroSingle : dataPoint.WVotingStationsDistroSingle)
                           - (absoluteMode ? dataPoint.VotingStationsDistroDouble : dataPoint.WVotingStationsDistroDouble)) * 100.0)
                         / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);
        double distroValue = ((absoluteMode ? dataPoint.VotingStationsDistroSingle : dataPoint.WVotingStationsDistroSingle) * 100.0)
                             / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);

        element.Name       = geo.Name;
        element.SmartLabel = new SmartLabel();
        element.SmartLabel.DynamicDisplay = false;
        element.SmartLabel.Text           = (distroValue).ToString("0.0");
        element.SmartLabel.Color          = System.Drawing.Color.Black;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
            // hack så att grafen inte blir helt hoptryckt i höjdled när man vill se status för hela sverige /pvz
            if (dataPoint.GeographyId == Geography.SwedenId)
            {
                element.URL += "&Height=5000";
            }
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveSingle.Elements.Add(element);

        // Double coverage

        element        = new Element();
        element.YValue = (((absoluteMode ? dataPoint.VotingStationsDistroDouble : dataPoint.WVotingStationsDistroDouble)
                           - (absoluteMode ? dataPoint.VotingStationsComplete : dataPoint.WVotingStationsComplete)) * 100.0)
                         / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);

        element.Name = geo.Name;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveDouble.Elements.Add(element);

        // full coverage - not yet implemented
        element        = new Element();
        element.YValue = ((absoluteMode ? dataPoint.VotingStationsComplete : dataPoint.WVotingStationsComplete) * 100.0)
                         / (absoluteMode ? dataPoint.VotingStationsTotal : dataPoint.WVotingStationsTotal);

        element.Name = geo.Name;

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
        seriesPositiveFull.Elements.Add(element);

        // neg bar
        element        = new Element();
        element.YValue = (absoluteMode ? dataPoint.VotingCoverage : dataPoint.WVotingCoverage) - 100;
        element.Name   = geo.Name;
        seriesNegative.Elements.Add(element);

        if (CanZoom(dataPoint.GeographyId))
        {
            element.URL = "RelativeDistroStatus.aspx?" + (nav != "" ? "nav=y&" : "") + "VotingMode=ElectionDay&abs=" + (absoluteMode ? "Y" : "N") + "&CircuitId=" + dataPoint.GeographyId;
        }
        else if (!String.IsNullOrEmpty(dataPoint.BookingUrl))
        {
            element.URL = dataPoint.BookingUrl;
        }
    }