Click here to Skip to main content
15,897,226 members
Articles / Desktop Programming / WPF

A WPF Graph Control Library

Rate me:
Please Sign up or sign in to vote.
4.44/5 (37 votes)
24 Apr 2008CPOL8 min read 295.6K   10.4K   96  
An article presenting a WPF library for producing extensible runtime customisable graphs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//------------------------------------------------------------------------------//
//                                                                              //
// Author:  Derek Bartram                                                       //
// Date:    23/01/2008                                                          //
// Version: 1.000                                                               //
// Website: http://www.derek-bartram.co.uk                                      //
// Email:   webmaster@derek-bartram.co.uk                                       //
//                                                                              //
// This code is provided on a free to use and/or modify basis for personal work //
// provided that this banner remains in each of the source code files that is   //
// found in the original source. For any publicically available work (source    //
// and/or binaries 'Derek Bartram' and 'http://www.derek-bartram.co.uk' must be //
// credited in both the user documentation, source code (where applicable), and //
// in the user interface (typically Help > About would be appropiate). Please   //
// also contact myself via the provided email address to let me know where and  //
// what my code is being used for; this helps me provide better solutions for   //
// all.                                                                         //
//                                                                              //
// THIS SOURCE AND/OR COMPILED LIBRARY MUST NOT BE USED FOR COMMERCIAL WORK,    //
// including not-for-profit work, without prior consent.                        //
//                                                                              //
// This agreement overrides any other agreements made by any other parties. By  //
// using, viewing, linking, or compiling the included source or binaries you    //
// agree to the terms and conditions as set out here and in any included (if    //
// applicable) license.txt. For commercial licensing please see the web address //
// above or contact myself via email. Thank you.                                //
//                                                                              //
// Please contact me at the above email for further help, information,          //
// comments, suggestions, licensing, or feature requests. Thank you.            //
//                                                                              //
//                                                                              //
//------------------------------------------------------------------------------//

namespace DNBSoft.WPF.WPFGraph
{
    public abstract class WPFGraphEventClasses
    {
        public class RendererChangedEventArgs : EventArgs
        {
            private String property = null;
            private object oldValue = null;
            private object newValue = null;

            public RendererChangedEventArgs(String property, object oldValue, object newValue)
            {
                this.property = property;
                this.oldValue = oldValue;
                this.newValue = newValue;
            }

            public String Property
            {
                get
                {
                    return property;
                }
            }

            public object OldValue
            {
                get
                {
                    return oldValue;
                }
            }

            public object NewValue
            {
                get
                {
                    return newValue;
                }
            }
        }

        public class DataPointChangedEventArgs : EventArgs
        {
            private WPFGraphEnumerations.Axis axis;
            private double oldValue;
            private double newValue;

            public DataPointChangedEventArgs(WPFGraphEnumerations.Axis axis, double oldValue, double newValue)
            {
                this.axis = axis;
                this.oldValue = oldValue;
                this.newValue = newValue;
            }

            public WPFGraphEnumerations.Axis Axis
            {
                get
                {
                    return axis;
                }
            }

            public double OldValue
            {
                get
                {
                    return oldValue;
                }
            }

            public double NewValue
            {
                get
                {
                    return newValue;
                }
            }
        }

        public class PointRendererChangedEventArgs : EventArgs
        {
            private IWPFGraphPointRenderer oldValue;
            private IWPFGraphPointRenderer newValue;

            public PointRendererChangedEventArgs(IWPFGraphPointRenderer oldValue, IWPFGraphPointRenderer newValue)
            {
                this.oldValue = oldValue;
                this.newValue = newValue;
            }

            public IWPFGraphPointRenderer OldValue
            {
                get
                {
                    return oldValue;
                }
            }

            public IWPFGraphPointRenderer NewValue
            {
                get
                {
                    return newValue;
                }
            }
        }

        public class LineRendererChangedEventArgs : EventArgs
        {
            private IWPFGraphLineRenderer oldValue;
            private IWPFGraphLineRenderer newValue;

            public LineRendererChangedEventArgs(IWPFGraphLineRenderer oldValue, IWPFGraphLineRenderer newValue)
            {
                this.oldValue = oldValue;
                this.newValue = newValue;
            }

            public IWPFGraphLineRenderer OldValue
            {
                get
                {
                    return oldValue;
                }
            }

            public IWPFGraphLineRenderer NewValue
            {
                get
                {
                    return newValue;
                }
            }
        }

        public class DataSeriesChangedEventArgs : EventArgs
        {
            private WPFGraphEnumerations.ListAction listAction;
            private int index;
            private WPFGraphDataPoint data;

            public DataSeriesChangedEventArgs(WPFGraphEnumerations.ListAction axis, int index, WPFGraphDataPoint data)
            {
                this.listAction = axis;
                this.index = index;
                this.data = data;
            }

            public WPFGraphEnumerations.ListAction ListAction
            {
                get
                {
                    return listAction;
                }
            }

            public int Index
            {
                get
                {
                    return index;
                }
            }

            public WPFGraphDataPoint Data
            {
                get
                {
                    return data;
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Rail Research UK
United Kingdom United Kingdom
I originally studied for a masters in engineering of software engineering at The University of Birmingham during 2000-2004, of which I received a 2:1. I continued at Birmingham University working with Civil Engineering and Rail Research UK where I am currently in my final year of a 3 year PhD project developing a Computational Intelligent Approach to Railway Intervention Planning. Although my work has a significant focus on railway engineering and associated practices much of my work is with data mining (on SQL Server 2008) and computational intelligence (CI) techniques. My key areas of expertise in CI are clustering algorithms (including Rival Penalised Competitive Learning) and evolutionary algorithms.

Outside of my formal work I enjoy testing the latest technologies such as .NET 3.5 and the many frameworks of which it comprises (mainly WPF). I have several projects on the go including a .NET and DirectX port of Quake 3 and many utility libraries. I also maintain an extensive website coded in Cold Fusion which is regularly updated; more information is available about me there.

Comments and Discussions