当前位置: 首页>>代码示例>>C#>>正文


C# Layout.ToString方法代码示例

本文整理汇总了C#中Layout.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Layout.ToString方法的具体用法?C# Layout.ToString怎么用?C# Layout.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Layout的用法示例。


在下文中一共展示了Layout.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: mileStones

    private string mileStones()
    {
        int[] milestones = new int[] { 1, 100, 200, 300, 400, 500, 1000 };
        int every = 500;

        //test
        //int[] milestones = new int[] {1, 10, 20, 30, 40, 50, 100 };
        //int every = 50;

        string strMilestones = "Milestones";
        string strNumber = "Number";
        string strDate = "Date";
        string strCache = "Cache";
        string strDaysInBetween = "Days in between";

        RegisterText(new string[]{
		strMilestones,
		strNumber,
		strDate,
		strCache,
		strDaysInBetween
		});

        Layout skin = new Layout(1);
        Layout.Statistics stats = new Layout.Statistics(Translate(strMilestones, false));
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strNumber, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strDate, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strCache, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strDaysInBetween, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        int milestonesIndex = 0;
        int index = milestones[milestonesIndex] - 1;
        MyGeocacheFind prev = null;
        while (index < _myFinds.Count)
        {
            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = (index + 1).ToString();
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = _myFinds[index].logDate.ToString("d");
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = _myFinds[index].gc.Name ?? "";
            row.Items.Add(new Layout.Statistics.Item());
            if (prev == null)
            {
                row.Items[row.Items.Count - 1].Text = " ";
            }
            else
            {
                row.Items[row.Items.Count - 1].Text = (_myFinds[index].logDate - prev.logDate).TotalDays.ToString("0");
            }

            prev = _myFinds[index];
            if (milestonesIndex < milestones.Length - 1)
            {
                milestonesIndex++;
                index = milestones[milestonesIndex] - 1;
            }
            else
            {
                index += every;
            }
        }
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:81,代码来源:Test.cs

示例2: locationsTable

    private string locationsTable()
    {
        string strLocations = "Locations";
        string strStateProv = "States/Provinces";
        string strCountries = "Countries";

        RegisterText(new string[]{
		strLocations,
		strStateProv,
		strCountries
		});

        Layout skin = new Layout(1);
        Layout.Statistics stats = new Layout.Statistics(Translate(strLocations, false));
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        bool first = true;
        var states =
            (from mf in _myFinds
             where !string.IsNullOrEmpty(mf.gc.State)
             group mf by mf.gc.State into g
             select new { State = g.Key, Founds = g }).OrderByDescending(x => x.Founds.Count()).OrderBy(x => x.State);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = string.Format("{1} ({0})", states.Count(), Translate(strStateProv, false));
        row.Items[row.Items.Count - 1].IsMarker = true;


        StringBuilder sb = new StringBuilder();
        foreach (var g in states)
        {
            if (!first)
            {
                sb.Append(", ");
            }
            else
            {
                first = false;
            }
            sb.Append(string.Format("{0} ({1})", ToHtml(g.State), g.Founds.Count()));
        }
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = sb.ToString();
        row.Items[row.Items.Count - 1].IsHtml = true;

        row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        first = true;
        var countries =
            (from mf in _myFinds
             where !string.IsNullOrEmpty(mf.gc.Country)
             group mf by mf.gc.Country into g
             select new { Country = g.Key, Founds = g }).OrderByDescending(x => x.Founds.Count()).OrderBy(x => x.Country);
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = string.Format("{1} ({0})", countries.Count(), Translate(strCountries, false));
        row.Items[row.Items.Count - 1].IsMarker = true;

        sb.Length = 0;
        foreach (var g in countries)
        {
            if (!first)
            {
                sb.Append(", ");
            }
            else
            {
                first = false;
            }
            sb.Append(string.Format("{0} ({1})", ToHtml(g.Country), g.Founds.Count()));
        }
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = sb.ToString();
        row.Items[row.Items.Count - 1].IsHtml = true;

        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:80,代码来源:Test.cs

示例3: diffTerr

    private string diffTerr()
    {
        string strDifficulty = "Difficulty";
        string strTerrain = "Terrain";
        string strFound = "Found";
        string strPercentage = "Percentage";

        RegisterText(new string[]{
		strDifficulty,
		strFound,
		strPercentage,
		strTerrain
		});

        Layout skin = new Layout(2);
        Layout.Statistics stats = new Layout.Statistics(Translate(strDifficulty, false));
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strDifficulty, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strFound, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        double tot = (double)_myFinds.Count;
        for (double d = 1.0; d < 5.1; d += 0.5)
        {
            string sd = d.ToString("0.#");
            int cnt = (from mf in _myFinds where mf.gc.Difficulty.ToString("0.#") == sd select mf).Count();

            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = sd;
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = cnt.ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)cnt / tot);
        }

        stats = new Layout.Statistics(Translate(strTerrain, false));
        skin.StatisticsBlocks[1] = stats;

        row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strTerrain, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strFound, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        for (double d = 1.0; d < 5.1; d += 0.5)
        {
            string sd = d.ToString("0.#");
            int cnt = (from mf in _myFinds where mf.gc.Terrain.ToString("0.#") == sd select mf).Count();

            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = sd;
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = cnt.ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)cnt / tot);
        }
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:83,代码来源:Test.cs

示例4: myGeoToolsBadges

    private string myGeoToolsBadges()
    {
        string strTitle = "myGEOtools Badges";

        /*
        read about the badges here:
            http://www.mygeotools.de/content/tools;statistik;badges

        read about the mdCachingPoints here:
            http://www.macdefender.org/products/GCStatistic/mdCachingPoints.html
        */

        RegisterText(new string[]{
		strTitle
		});

        Layout skin = new Layout(1);
        Layout.Statistics stats = new Layout.Statistics(Translate(strTitle, false));
        stats.Align = "center";
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        StringBuilder sb = new StringBuilder();
        var csizeTypes =
            (from mf in _myFinds
             group mf by mf.gc.GeocacheType into g
             select new { GeocacheType = g.Key, Founds = g }).OrderByDescending(x => x.Founds.Count());
        double sumall = 0;
        foreach (var g in csizeTypes)
        {
            double sumdt = 0;
            double mfBy = 1.0;
            string cpar = "";
            //sb.AppendLine(string.Format("<br>Typ:{0}:",Translate(g.GeocacheType.Name)));
            foreach (var mf in g.Founds)
            {
                sumdt += mf.gc.Difficulty * mf.gc.Terrain;
            }
            switch (g.GeocacheType.ID)
            {
                case 2: mfBy = 1; cpar = "tradi"; break;//Tradi
                case 3: mfBy = 2; cpar = "multi"; break;//Multi
                case 4: mfBy = 0.5; cpar = "virtual"; break;//Virtual
                case 5: mfBy = 1.5; cpar = "letter"; break;//Letterbox
                case 6: mfBy = 1.5; cpar = "event"; break;//Event
                case 8: mfBy = 2; cpar = "myst"; break;//Mystery
                case 9: mfBy = 4; break;//Project_APE
                case 11: mfBy = 1; cpar = "webcam"; break;//Webcam
                case 12: mfBy = 0.5; break;//Locationless
                case 13: mfBy = 1.5; cpar = "cito"; break;//CITO
                //		case 27: mfBy=1;break;//Benchmark
                case 137: mfBy = 1.5; cpar = "earth"; break;//Earth
                case 453: mfBy = 1.75; cpar = "mega"; break;//Mega_Event
                //		case 605: mfBy=1;break;//Geocache Course
                case 1304: mfBy = 2; break; //GPS Adventures Exhibit
                case 1858: mfBy = 2; cpar = "wherigo"; break; //Whereigo
                case 3653: mfBy = 1.5; break; //Lost_and_Found_Event (geraten)
                case 3773: mfBy = 1; break; //Groundspeak_HQ (geraten)
                case 3774: mfBy = 1; break; //Groundspeak_Lost_and_Found (geraten)
                case 4738: mfBy = 1; break; //Groundspeak_Block_Party (geraten)
                //10Years ? -> 2
                default: mfBy = 1; break;
            }
            //sb.AppendLine(string.Format("<br>Typ:{0}: {1} pts",Translate(g.GeocacheType.Name),sumdt*mfBy));
            if (cpar != "" && sumdt * mfBy > 0.4)
            {
                sb.AppendLine(string.Format("<img src='http://www.mygeotools.de/badgegen.php?type={0}&points={1}'>",
                    cpar, Math.Round(sumdt * mfBy, 0)));
            }
            sumall += sumdt * mfBy;
        }
        sb.AppendLine(string.Format("<br>mdCachingPoints: <b>{0}</b>", Math.Round(sumall, 0)));
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = sb.ToString();
        row.Items[row.Items.Count - 1].IsHtml = true;

        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:80,代码来源:Test.cs

示例5: CacheSizeAndType

    public string CacheSizeAndType()
    {
        string strCacheSize = "Cache size";
        string strSize = "Size";
        string strFound = "Found";
        string strPercentage = "Percentage";
        string strCacheType = "Cache type";
        string strType = "Type";

        RegisterText(new string[]{
		strCacheSize,
		strSize,
		strFound,
		strPercentage,
		strCacheType,
		strType
		});

        Layout skin = new Layout(2);
        Layout.Statistics stats = new Layout.Statistics(Translate(strCacheSize, false));
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strSize, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strFound, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        var csizeGroups =
            (from mf in _myFinds
             group mf by mf.gc.Container into g
             select new { Container = g.Key, Founds = g }).OrderByDescending(x => x.Founds.Count());
        foreach (var g in csizeGroups)
        {
            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = Translate(g.Container.Name, false);
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = g.Founds.Count().ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)g.Founds.Count() / (double)_myFinds.Count);
        }

        stats = new Layout.Statistics(Translate(strCacheType, false));
        skin.StatisticsBlocks[1] = stats;

        row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strType, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strFound, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        var csizeTypes =
            (from mf in _myFinds
             group mf by mf.gc.GeocacheType into g
             select new { GeocacheType = g.Key, Founds = g }).OrderByDescending(x => x.Founds.Count());
        foreach (var g in csizeTypes)
        {
            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = Translate(g.GeocacheType.Name, false);
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = g.Founds.Count().ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)g.Founds.Count() / (double)_myFinds.Count);
        }
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:88,代码来源:Test.cs

示例6: CacheTravelDistyanceGraph


//.........这里部分代码省略.........
        {
            double sumDist = 0.0;
            double sumDist2 = 0.0;//"Dumb"-Distance without customLat/Lon

            int cnt = 0;

            StringBuilder chxl = new StringBuilder();
            StringBuilder serie1 = new StringBuilder();

            //sum Interval 1 month
            DateTime startAt = new DateTime(_myFinds2[1].logDate.Year, _myFinds2[1].logDate.Month, 1);
            DateTime endAt = startAt.AddMonths(1);

            //_myFinds2 is sorted by Logdate (hopefully)

            for (int i = 1; i < _myFinds2.Count; i++)
            {
                double lat1 = _myFinds2[i - 1].gc.Lat;
                double lon1 = _myFinds2[i - 1].gc.Lon;
                double lat2 = _myFinds2[i].gc.Lat;
                double lon2 = _myFinds2[i].gc.Lon;

                double dist2 = Calculus.CalculateDistance(lat1, lon1, lat2, lon2).EllipsoidalDistance / 1000; //km

                if (_myFinds2[i - 1].gc.CustomLat != null && _myFinds2[i - 1].gc.CustomLon != null)
                {
                    lat1 = (double)_myFinds2[i - 1].gc.CustomLat;
                    lon1 = (double)_myFinds2[i - 1].gc.CustomLon;
                }

                if (_myFinds2[i].gc.CustomLat != null && _myFinds2[i].gc.CustomLon != null)
                {
                    lat2 = (double)_myFinds2[i].gc.CustomLat;
                    lon2 = (double)_myFinds2[i].gc.CustomLon;
                }

                double dist = Calculus.CalculateDistance(lat1, lon1, lat2, lon2).EllipsoidalDistance / 1000; //km

                sumDist += dist;
                sumDist2 += dist2;

                //debugging:
                //sb.AppendLine(string.Format("{0}: d:{1}/{2}; s:{3}/{4}; d:{5} to: {6} <br />", i-1, Math.Round(dist,2), Math.Round(dist2,2), Math.Round(sumDist,1), Math.Round(sumDist2,1),_myFinds2[i].logDate,_myFinds2[i].gc.Name));

                if (i + 1 == _myFinds2.Count || _myFinds2[i + 1].logDate >= endAt)
                {
                    if (chxl.Length == 0 || startAt.Month == 1)
                    {
                        chxl.AppendFormat("|{0}", startAt.Year);
                    }
                    else
                    {
                        chxl.Append("|");
                    }
                    if (serie1.Length != 0)
                    {
                        serie1.Append(",");
                    }
                    serie1.AppendFormat("{0}", Math.Round(sumDist, 0));
                    cnt++;

                    if (i + 1 < _myFinds2.Count) //not last entry -> set new interval
                    {
                        startAt = new DateTime(_myFinds2[i + 1].logDate.Year, _myFinds2[i + 1].logDate.Month, 1);
                        //check for gap
                        while (endAt < startAt) //fill gap
                        {
                            if (chxl.Length == 0 || endAt.Month == 1)
                            {
                                chxl.AppendFormat("|{0}", endAt.Year);
                            }
                            else
                            {
                                chxl.Append("|");
                            }
                            serie1.AppendFormat(",{0}", Math.Round(sumDist, 0));
                            cnt++;
                            endAt = endAt.AddMonths(1);
                        }
                        endAt = startAt.AddMonths(1);
                    }

                }
            }
            pars["chd"] = string.Format("t:{0}", serie1.ToString());
            pars["chxl"] += string.Format("{0}", chxl.ToString());
            //axis ranges =0,0,1000|2,0,1600|4,2006,2012
            pars["chxr"] = string.Format("0,0,{0}|2,0,{1}", Math.Round(sumDist / 1.609344, 0), Math.Round(sumDist, 0));
            //1 mile = 1.609344 kilometers
            pars["chm"] += string.Format("|A{0}km,224499,0,{1}.0,10", Math.Round(sumDist, 0), cnt - 1);
            pars["chm"] += string.Format("|A{0}mi,224499,0,{1}.0,10", Math.Round(sumDist / 1.609344, 0), cnt - 1);

            //debug:
            //sb.AppendLine(string.Format("{0}<br>{1}<br>{2}<br>{3}</p>", pars["chd"], chxl.ToString(), pars["chxr"], sumDist ));

        }
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = string.Format("<img src=\"{0}\" />", googleChartImgUrl(pars));
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:Test.cs

示例7: CacheTypeRatioGraph


//.........这里部分代码省略.........
            {
                //debug:sb.AppendLine(string.Format("Mo: {0}<br>",startAt.Month));
                if (chxl.Length == 0 || startAt.Month == 1)
                {
                    chxl.AppendFormat("|{0}", startAt.Year);
                    startOfInterval = startAt;
                }
                else
                {
                    chxl.Append("|");
                }

                double qTrad = (from mf in _myFinds where mf.logDate >= startAt && mf.logDate < endAt && mf.gc.GeocacheType.ID == 2 select mf).Count();
                double qMult = (from mf in _myFinds where mf.logDate >= startAt && mf.logDate < endAt && mf.gc.GeocacheType.ID == 3 select mf).Count();
                double qMyst = (from mf in _myFinds where mf.logDate >= startAt && mf.logDate < endAt && mf.gc.GeocacheType.ID == 8 select mf).Count();
                double qOther = (from mf in _myFinds
                                 where mf.logDate >= startAt && mf.logDate < endAt &&
                                     mf.gc.GeocacheType.ID != 2 && mf.gc.GeocacheType.ID != 3 && mf.gc.GeocacheType.ID != 8
                                 select mf).Count();
                double qSum = qTrad + qMult + qMyst + qOther;

                sumTrad += qTrad;
                sumMult += qMult;
                sumMyst += qMyst;
                sumOther += qOther;

                sumAll += qSum;

                if (sbTrad.Length != 0)
                {
                    sbTrad.Append(",");
                    sbMult.Append(",");
                    sbMyst.Append(",");
                    sbOther.Append(",");

                    sbTTrad.Append(",");
                    sbTMult.Append(",");
                    sbTMyst.Append(",");
                    sbTOther.Append(",");
                }
                //data for graph per month
                if (qSum > 0.9) //>0
                {
                    //line chart
                    //			sbTrad.Append(String.Format("{0}", Math.Round((qTrad/qSum)*100,2)).Replace(",","."));
                    //			sbMult.Append(String.Format("{0}", Math.Round(((qTrad+qMult)/qSum)*100,2)).Replace(",","."));
                    //			sbMyst.Append(String.Format("{0}", Math.Round(((qTrad+qMult+qMyst)/qSum)*100,2)).Replace(",","."));
                    //			sbOther.Append("100");
                    //bar chart
                    sbTrad.Append(String.Format("{0}", Math.Round((qTrad / qSum) * 100, 2)).Replace(",", "."));
                    sbMult.Append(String.Format("{0}", Math.Round(((qMult) / qSum) * 100, 2)).Replace(",", "."));
                    sbMyst.Append(String.Format("{0}", Math.Round(((qMyst) / qSum) * 100, 2)).Replace(",", "."));
                    sbOther.Append(String.Format("{0}", Math.Round(((qOther) / qSum) * 100, 2)).Replace(",", "."));
                }
                else
                {
                    sbTrad.Append("0");
                    sbMult.Append("0");
                    sbMyst.Append("0");
                    sbOther.Append("0");
                }
                //data for total graph
                if (sumAll > 0.9) //>0
                {
                    //line chart
                    //			sbTTrad.Append(String.Format("{0}", Math.Round((sumTrad/sumAll)*100,2)).Replace(",","."));
                    //			sbTMult.Append(String.Format("{0}", Math.Round(((sumTrad+sumMult)/sumAll)*100,2)).Replace(",","."));
                    //			sbTMyst.Append(String.Format("{0}", Math.Round(((sumTrad+sumMult+sumMyst)/sumAll)*100,2)).Replace(",","."));
                    //			sbTOther.Append("100");
                    //bar chart
                    sbTTrad.Append(String.Format("{0}", Math.Round((sumTrad / sumAll) * 100, 2)).Replace(",", "."));
                    sbTMult.Append(String.Format("{0}", Math.Round(((sumMult) / sumAll) * 100, 2)).Replace(",", "."));
                    sbTMyst.Append(String.Format("{0}", Math.Round(((sumMyst) / sumAll) * 100, 2)).Replace(",", "."));
                    sbTOther.Append(String.Format("{0}", Math.Round(((sumOther) / sumAll) * 100, 2)).Replace(",", "."));
                }
                else
                {	//probably never happens
                    sbTTrad.Append("0");
                    sbTMult.Append("0");
                    sbTMyst.Append("0");
                    sbTOther.Append("0");
                }

                startAt = endAt;
                endAt = endAt.AddMonths(interval);
            }
            pars["chd"] = string.Format("t:{0}|{1}|{2}|{3}", sbTrad.ToString(), sbMult.ToString(), sbMyst.ToString(), sbOther.ToString());
            pars["chxl"] = string.Format("1:{0}", chxl.ToString());

            pars2["chd"] = string.Format("t:{0}|{1}|{2}|{3}", sbTTrad.ToString(), sbTMult.ToString(), sbTMyst.ToString(), sbTOther.ToString());
            pars2["chxl"] = string.Format("1:{0}", chxl.ToString());

            //sb.AppendLine("<p>Debug:");
            //sb.AppendLine(string.Format("{0}<br>{1}<br>{2}<br>{3}</p>", sbTrad.ToString(), sbMult.ToString(), sbMyst.ToString(), sbOther.ToString()));
        }

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = string.Format("<img src=\"{0}\" /><br /><img src=\"{1}\" />", googleChartImgUrl(pars), googleChartImgUrl(pars2));
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:Test.cs

示例8: logLengthTable

    private string logLengthTable()
    {
        string strLogLengthChar = "Log length (characters)";
        string strLogLengthWords = "Log length (words)";
        string strInterval = "Between";
        string strCount = "Count";
        string strPercentage = "Percentage";

        RegisterText(new string[]{
		strLogLengthChar,
        strInterval,
        strCount,
        strPercentage,
        strLogLengthWords
		});

        Layout skin = new Layout(2);
        Layout.Statistics stats = new Layout.Statistics(Translate(strLogLengthChar, false));
        skin.StatisticsBlocks[0] = stats;

        Layout.Statistics.Row row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strInterval, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strCount, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        int[] lengths = (from mf in _myFinds where mf.lg != null select mf.lg.Text.Replace(" ", "").Replace("\r", "").Replace("\n", "").Length).ToArray();
        int lmax = lengths.Max();
        for (int i = 0; i < 10; i++)
        {
            int minV = (int)((double)lmax * (double)i / 10.0);
            int maxV = (int)((double)lmax * ((double)i + 1.0) / 10.0);
            int cnt = (from l in lengths where l > minV && l <= maxV select l).Count();

            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0} - {1}", minV, maxV);
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = cnt.ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)cnt / (double)_myFinds.Count);
        }

        //words
        stats = new Layout.Statistics(Translate(strLogLengthWords, false));
        skin.StatisticsBlocks[1] = stats;

        row = new Layout.Statistics.Row();
        stats.Rows.Add(row);

        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strInterval, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strCount, false);
        row.Items[row.Items.Count - 1].IsMarker = true;
        row.Items.Add(new Layout.Statistics.Item());
        row.Items[row.Items.Count - 1].Text = Translate(strPercentage, false);
        row.Items[row.Items.Count - 1].IsMarker = true;

        lengths = (from mf in _myFinds where mf.lg != null select mf.lg.Text.Split(new char[] { ' ', '\t', '\r', '\n', '.' }, StringSplitOptions.RemoveEmptyEntries).Length).ToArray();
        lmax = lengths.Max();
        for (int i = 0; i < 10; i++)
        {
            int minV = (int)((double)lmax * (double)i / 10.0);
            int maxV = (int)((double)lmax * ((double)i + 1.0) / 10.0);
            int cnt = (from l in lengths where l > minV && l <= maxV select l).Count();

            row = new Layout.Statistics.Row();
            stats.Rows.Add(row);

            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0} - {1}", minV, maxV);
            row.Items[row.Items.Count - 1].IsMarker = true;
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = cnt.ToString();
            row.Items.Add(new Layout.Statistics.Item());
            row.Items[row.Items.Count - 1].Text = string.Format("{0:0.0} %", 100.0 * (double)cnt / (double)_myFinds.Count);
        }
        return skin.ToString();
    }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:91,代码来源:Test.cs

示例9: diffTerrPie

    private string diffTerrPie()
    {
        string strFoundsPerDifficulty = "Founds per difficulty";
        string strFoundsPerTerrain = "Founds per terrain";

        RegisterText(new string[]{
		strFoundsPerDifficulty,
		strFoundsPerTerrain
		});

        Layout skin = new Layout(2);
        Layout.Statistics stats = new Layout.Statistics(Translate(strFoundsPerDifficulty, false));
        skin.StatisticsBlocks[0] = stats;
        stats.Rows.Add(new Layout.Statistics.Row());
        stats.Rows[0].Items.Add(new Layout.Statistics.Item());

        //graph Difficulty
        //http://chart.apis.google.com/chart?cht=p3&amp;chs=370x120&amp;chf=bg,s,FFF4F4&amp;chd=t:18.4,46.9,24.0,4.93,3.60,0.85,0.77,0.25,0.14&amp;chl=1%20(18.4%)|1.5%20(46.9%)|2%20(24.0%)|2.5%20(4.93%)|3%20(3.60%)|3.5%20(0.85%)|4%20(0.77%)|4.5%20(0.25%)|5%20(0.14%)&amp;chco=0000f0,ff0000,8080f0,2020f0,8080f0,2020f0,8080f0,2020f0,8080f0
        Dictionary<string, string> pars = new Dictionary<string, string>();
        string[] chco = new string[] { "8080f0", "2020f0", "8080f0", "2020f0", "8080f0", "2020f0", "8080f0", "2020f0", "8080f0" };

        pars.Add("cht", "p3");
        pars.Add("chs", "370x120");
        pars.Add("chf", "bg,s,FFF4F4");
        //pars.Add("chco", "0000f0,ff0000,8080f0,2020f0,8080f0,2020f0,8080f0,2020f0,8080f0");
        pars.Add("chd", "");
        pars.Add("chl", "");
        pars.Add("chco", "");

        StringBuilder chd = new StringBuilder();
        StringBuilder chl = new StringBuilder();
        double tot = (double)_myFinds.Count;
        int maxCnt = 0;
        int maxCntIndex = 0;
        int index = 0;
        for (double d = 1.0; d < 5.1; d += 0.5)
        {
            string sd = d.ToString("0.#");
            int cnt = (from mf in _myFinds where mf.gc.Difficulty.ToString("0.#") == sd select mf).Count();
            if (index == 0)
            {
                chd.AppendFormat("t:{0}", (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
                chl.AppendFormat("{0} {1}({2}%)", sd, cnt, (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
            }
            else
            {
                chd.AppendFormat(",{0}", (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
                chl.AppendFormat("|{0} {1}({2}%)", sd, cnt, (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
            }
            if (cnt > maxCnt)
            {
                maxCnt = cnt;
                maxCntIndex = index;
            }

            index++;
        }
        chco[maxCntIndex] = "ff0000";
        pars["chd"] = chd.ToString();
        pars["chl"] = chl.ToString();
        for (int i = 0; i < chco.Length; i++)
        {
            pars["chco"] = string.Concat(pars["chco"], i == 0 ? "" : ",", chco[i]);
        }

        stats.Rows[0].Items[0].Text = string.Format("<img src=\"{0}\" />", googleChartImgUrl(pars));
        stats.Rows[0].Items[0].IsHtml = true;

        stats = new Layout.Statistics(Translate(strFoundsPerDifficulty, false));
        skin.StatisticsBlocks[1] = stats;
        stats.Rows.Add(new Layout.Statistics.Row());
        stats.Rows[0].Items.Add(new Layout.Statistics.Item());

        //graph Terrain
        pars["chco"] = "";
        chd.Length = 0;
        chl.Length = 0;
        maxCnt = 0;
        maxCntIndex = 0;
        index = 0;
        for (double d = 1.0; d < 5.1; d += 0.5)
        {
            string sd = d.ToString("0.#");
            int cnt = (from mf in _myFinds where mf.gc.Terrain.ToString("0.#") == sd select mf).Count();
            if (index == 0)
            {
                chd.AppendFormat("t:{0}", (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
                chl.AppendFormat("{0} {1}({2}%)", sd, cnt, (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
            }
            else
            {
                chd.AppendFormat(",{0}", (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
                chl.AppendFormat("|{0} {1}({2}%)", sd, cnt, (100.0 * (double)cnt / tot).ToString("0.#").Replace(',', '.'));
            }
            if (cnt > maxCnt)
            {
                maxCnt = cnt;
                maxCntIndex = index;
            }

//.........这里部分代码省略.........
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:101,代码来源:Test.cs

示例10: Legend

 public Legend(Layout _layout, HAlign _hAlign, VAlign _vAlign, int _borderwidth)
 {
     borderWidth = _borderwidth;
     layout = _layout.ToString();
     hAlign = _hAlign.ToString();
     vAlign = _vAlign.ToString();
 }
开发者ID:cmoussalli,项目名称:DynThings,代码行数:7,代码来源:EndPointCharts.cs


注:本文中的Layout.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。