コード例 #1
0
 public PsychogramRenderer(PsychogramData data)
 {
     _data = data;
 }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var frm = new Form();

            var data = new PsychogramData()
            {
                Series = new List <PsychogramSeries>()
                {
                    new PsychogramSeries()
                    {
                        LineColor         = Color.Maroon, SeriesID = 0, LegendLabel = "Istwert Mitarbeiter",
                        AreaColorTowardsP = new Dictionary <int, Color>()
                        {
                            { 2, Color.FromArgb(100, Color.LightGreen) }
                        },
                        AreaColorTowardsN = new Dictionary <int, Color>()
                        {
                            { 2, Color.FromArgb(100, Color.IndianRed) }
                        },
                        CompareWith = new List <int>()
                        {
                            1, 2
                        }
                    },
                    new PsychogramSeries()
                    {
                        LineColor = Color.Orange, SeriesID = 1, LegendLabel = "Wunschwert Mitarbeiter"
                    },
                    new PsychogramSeries()
                    {
                        LineColor = Color.DarkBlue, SeriesID = 2, LegendLabel = "Sollwert Ungernehmen"
                    }
                },
                XBarData = new List <PsychogramBar>()
                {
                    new PsychogramBar()
                    {
                        XTitle = "A) Stressfaktoren", SeriesData = new double[] { 1.2, 3.8, 2.1 }
                    },
                    new PsychogramBar()
                    {
                        XTitle = "B) Arbeitsbedingungen", SeriesData = new double[] { 2.2, 4.8, 2.1 }
                    },
                    new PsychogramBar()
                    {
                        XTitle = "C) Vorbelastungen", SeriesData = new double[] { 4.9, 3.5, 2.7 }
                    },
                    new PsychogramBar()
                    {
                        XTitle = "D) Teamarbeit", SeriesData = new double[] { 2.9, 1.9, 2.1 }
                    },
                    new PsychogramBar()
                    {
                        XTitle = "E) Kreativität und Abwechslungsreichtum", SeriesData = new double[] { 5.0, 4.8, 4.5 }
                    },
                    new PsychogramBar()
                    {
                        XTitle = "F) Führungsqualitäten", SeriesData = new double[] { 4.4, 4.0, 3.5 }
                    },
                },
                YScale = new List <int>()
                {
                    0, 1, 2, 3, 4, 5
                },
                OutcomeColors = new Dictionary <PsychogramColumnOutcome, Color>()
                {
                    { PsychogramColumnOutcome.Shortcoming, Color.Red },
                    { PsychogramColumnOutcome.Surpassing, Color.Green }
                },
                ShowAverageGraphLines = false
            };

            /* we want to see the default in the legend */
            foreach (var seri in data.Series)
            {
                seri.LegendLabel += String.Format(" (~{0:0.#})", seri.Average(data.XBarData));
            }

            /* sample rendition */
            var rend = new PsychogramRenderer(data);

            frm.BackgroundImageLayout = ImageLayout.Center;
            frm.BackgroundImage       = rend.Render(800, 480);

            Application.Run(frm);
        }