Пример #1
0
        private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            Rectangle r = new Rectangle( 0,50,400,300 );
            string[][] data = sampleData();

            switch (comboBox1.SelectedIndex)
            {
                // Bar Graph
                case 0:
                    gr = bar_graph.Create_Bar_Graph(this, r, data );
                    break;
                // Column Graph
                case 1:
                    gr = column_graph.Create_Column_Graph(this, r, data);
                    break;
                // Line Graph
                case 2:
                    gr = line_graph.Create_Line_Graph(this, r, data);
                    break;
                // Scatter Graph
                case 3:
                    gr = scatter_graph.Create_Scatter_Graph(this, r, data);
                    break;
                // Pie Graph
                case 4:
                    gr = pie_graph.Create_Pie_Graph(this, r, data);
                    break;
            }
        }
Пример #2
0
 public graphConfig( Graph g, GraphControl gcont )
 {
     InitializeComponent();
     gr = g;
     gr.configTab(tabPage2);
     tabPage3.Controls.Add(gcont);
 }
Пример #3
0
 public graphConfig( Graph g, GraphControl gcont )
 {
     InitializeComponent();
     // will not allow to open another config window in this config window
     gcont.inMenu = true;
     // copies graph so that can modify else where
     gr = g;
     // put in the graph specific settings in tab 2
     gr.configTab(tabPage2);
     // put a preview graph in tab 3
     tabPage3.Controls.Add(gcont);
     // will put on settings that were chosen before on the graph
     InitConfig();
 }
Пример #4
0
 public void SetGraph(Graph newGraph)
 {
     gr = newGraph;
 }
Пример #5
0
        public void ReadXml(XmlReader reader)  //For loading a saved graph
        {
            //kill the savedgraph node
            reader.Read();
            //First, figure out what kind of graph needs to be loaded by getting the type (bar, pie...)
            Type graphType = System.Type.GetType("ExcelClone.Graphs." + reader.Name, false, true);

            //Now, create an XMLserializer for that type and deserialize it into this control
            XmlSerializer xms = new XmlSerializer(graphType);
            gr = (Graph)xms.Deserialize(reader);

            reader.MoveToAttribute("Position");
            string tmp = reader.GetAttribute("Position");  //get pos value, parse
            Regex rx = new Regex("[0-9]+");  //match numbers
            Match mt = rx.Match(tmp);
            Point p = new Point( int.Parse( mt.ToString() ), int.Parse( mt.NextMatch().ToString() ) );
            this.Location = p;

            tmp = reader.GetAttribute("Size");  //get size value, parse
            mt = rx.Match(tmp);
            Size sz = new Size(int.Parse( mt.ToString() ), int.Parse(mt.NextMatch().ToString()));
            this.Size = sz;


            gr.InitFonts();  //init font and label objects, they cannot be saved
            gr.InitLabels();
            gr.InitColors();
        }