Example #1
0
        public void TestCanPlotBarChart()
        {
            var chart = new BarChart
            {
                DataPoints = new[]
                {
                    new BarChartDataPoint {
                        CategoryName = "Brazil", Value = 5
                    },
                    new BarChartDataPoint {
                        CategoryName = "Italy", Value = 4
                    },
                    new BarChartDataPoint {
                        CategoryName = "Germany", Value = 3
                    },
                    new BarChartDataPoint {
                        CategoryName = "Argentina", Value = 2
                    },
                    new BarChartDataPoint {
                        CategoryName = "Uruguay", Value = 2
                    },
                    new BarChartDataPoint {
                        CategoryName = "France", Value = 1
                    },
                    new BarChartDataPoint {
                        CategoryName = "Spain", Value = 1
                    },
                    new BarChartDataPoint {
                        CategoryName = "England", Value = 1
                    }
                }
            };

            chart.AssertOutputEquals(
                "    Brazil    |#####  5\r\n" +
                "    Italy     |####  4\r\n" +
                "    Germany   |###  3\r\n" +
                "    Argentina |##  2\r\n" +
                "    Uruguay   |##  2\r\n" +
                "    France    |#  1\r\n" +
                "    Spain     |#  1\r\n" +
                "    England   |#  1\r\n" +
                "              ------\r\n"
                ,
                "<pre><code>Brazil    |#####  5\n" +
                "Italy     |####  4\n" +
                "Germany   |###  3\n" +
                "Argentina |##  2\n" +
                "Uruguay   |##  2\n" +
                "France    |#  1\n" +
                "Spain     |#  1\n" +
                "England   |#  1\n" +
                "          ------\n" +
                "</code></pre>\n\n");
        }
Example #2
0
        public void TestSpecialCharactersInCategoryNameAreEscaped()
        {
            var chart = new BarChart {
                DataPoints = new[]
                {
                    new BarChartDataPoint {
                        CategoryName = "\tLine1\rLine2", Value = 10
                    }
                }
            };

            chart.AssertOutputEquals(
                "    \\tLine1\\rLine2 |##########  10\r\n" +
                "                   -----------\r\n",
                "<pre><code>\\tLine1\\rLine2 |##########  10\n" +
                "               -----------\n" +
                "</code></pre>\n\n");
        }