Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // new data source
            DataSource ds = new DataSource("PlainGraph Sample");

            // new record
            DataRecord dr = new DataRecord("DVD");

            dr.Color      = Color.SkyBlue;
            dr.LineWeight = 2f;                   // line weight

            dr.AddData("2010", 3000);
            dr.AddData("2011", 3500);
            dr.AddData("2012", 5000);

            // add record
            ds.AddData(dr);

            // simple way to create record and add
            ds.AddData("Book", new Dictionary <string, double>()
            {
                { "2010", 2100 },
                { "2011", 2700 },
                { "2012", 2550 },
            }).LineWeight = 3f;

            graph.DataSource = ds;                    // update data source
            graph.GraphType  = PlainGraphType.Column; // change chart type
        }
Example #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            comboBox1.SelectedIndex = 2;

            ds.Caption = "PlainGraph Demo Chart";

            ds.XTitle = "Year";
            ds.YTitle = "Count";

            // record 1
            Dictionary <int, double> data1 = new Dictionary <int, double>();

            data1.Add(2005, 300);
            data1.Add(2006, 450);
            data1.Add(2007, 500);
            data1.Add(2008, 530);
            data1.Add(2009, 680);
            data1.Add(2010, 890);
            data1.Add(2011, 1330);
            DataRecord record = ds.AddData("Book", data1, Color.OliveDrab);

            record.Set[6].Style.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor;

            Dictionary <int, double> data2 = new Dictionary <int, double>();

            data2.Add(2005, 110);
            data2.Add(2006, 150);
            data2.Add(2007, 180);
            data2.Add(2008, 378);
            data2.Add(2009, 750);
            data2.Add(2010, 1290);
            data2.Add(2011, 1630);
            ds.AddData("Software", data2, Color.Orchid);

            Dictionary <int, double> data3 = new Dictionary <int, double>();

            data3.Add(2005, 320);
            data3.Add(2006, 410);
            data3.Add(2007, 560);
            data3.Add(2008, 595);
            data3.Add(2009, 600);
            data3.Add(2010, 670);
            data3.Add(2011, 820);
            ds.AddData("DVD", data3, Color.SaddleBrown);

            graph.DataSource = ds;
        }
Example #3
0
 public bool AddData(MechanicQuery toAdd)
 {
     return(DataSource.AddData(toAdd));
 }