public void TestRealLife_Chart40001()
        {
            const string fileName = @"d:\temp\ScottPlott_Chart40001.png";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            var data = new ChartData
            {
                Title      = "Test portfolio",
                Copyright  = "Testfirma",
                XLabelText = "Anlageklassen",
                YLabelText = "Anteil in %",
                FileName   = fileName,
                ChartType  = ChartType.PieChart,
                //PaperColor = Color.Red
            };

            TestHelper.LoadDefaultChartStyle(data, HighResolution);

            var dt = TestHelper.GetDataTable("chart40001.xml");

            ChartUtility.DataTableToPieChartItemData(dt, "1;2", data);

            var x = new ChartHandler
            {
                ChartData = data
            };

            x.Export();

            TestHelper.StartFile(fileName);
        }
Example #2
0
        /// <summary>
        /// Get data for a sample pie chart
        /// </summary>
        /// <returns></returns>
        public static void PieChartSample(bool useDatabase, ChartData data)
        {
            var erg = data.DataSource;


            if (useDatabase)
            {
                var dt = TestHelper.GetDataTable("PieChart.xml");
                ChartUtility.DataTableToPieChartItemData(dt, "1;2", data);
            }
            else
            {
                // shares
                var item = new PieChartItemData
                {
                    XValue = "Aktien",
                    YValue = 0.5
                };

                erg.Add(item);

                // fixed income
                item = new PieChartItemData
                {
                    XValue = "Anleihen",
                    YValue = 0.4
                };

                erg.Add(item);

                // liquidity
                item = new PieChartItemData
                {
                    XValue = "Liquidität",
                    YValue = 0.1
                };

                erg.Add(item);

                data.PropertiesToUseForChart.Add("XValue");
                data.PropertiesToUseForChart.Add("YValue");
            }
        }