private void InitializeChart()
        {
            tChart1.Aspect.View3D                  = false;
            tChart1.Legend.Visible                 = false;
            tChart1.Header.Font.Color              = Color.FromArgb(154, 154, 154);
            tChart1.Header.Text                    = "Euribor";
            tChart1.Panel.Bevel.Inner              = BevelStyles.None;
            tChart1.Panel.Bevel.Outer              = BevelStyles.None;
            tChart1.Panel.Color                    = Color.White;
            tChart1.Panel.Gradient.Visible         = false;
            tChart1.Axes.Left.AxisPen.Color        = Color.FromArgb(120, 60, 20);
            tChart1.Axes.Left.AxisPen.Width        = 4;
            tChart1.Axes.Left.MinorTicks.Visible   = false;
            tChart1.Axes.Left.Grid.Color           = Color.FromArgb(245, 225, 170);
            tChart1.Axes.Left.Grid.Style           = System.Drawing.Drawing2D.DashStyle.Solid;
            tChart1.Axes.Bottom.AxisPen.Color      = Color.FromArgb(120, 60, 20);
            tChart1.Axes.Bottom.Grid.Visible       = false;
            tChart1.Axes.Bottom.MinorTicks.Visible = false;
            tChart1.Axes.Bottom.AxisPen.Width      = 4;
            tChart1.Walls.Back.Pen.Visible         = false;
            tChart1.Walls.Back.Gradient.Visible    = false;
            tChart1.Walls.Back.Color               = Color.White;

            Steema.TeeChart.Styles.Line series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            series1.Color           = Color.FromArgb(128, 128, 128);
            series1.Pointer.Style   = PointerStyles.Circle;
            series1.Pointer.Visible = true;

            series1.Add(5.323, "08-Aug");
            series1.Add(5.384, "08-Sep");
            series1.Add(5.248, "08-Oct");
            series1.Add(4.350, "08-Nov");
            series1.Add(3.452, "08-Dec");
            series1.Add(2.622, "09-Jan");
            series1.Add(2.135, "09-Feb");

            Steema.TeeChart.Tools.SeriesRegionTool region = new Steema.TeeChart.Tools.SeriesRegionTool(tChart1.Chart);
            region.Color        = Color.FromArgb(225, 225, 255);
            region.Transparency = 50;
            region.Series       = series1;

            Steema.TeeChart.Tools.MarksTip markstip = new MarksTip(tChart1.Chart);
            markstip.Series = series1;
#if VS2005
            markstip.BackColor = Color.White;
#endif
            markstip.Style = MarksStyles.Value;


            Steema.TeeChart.Animations.Expand expand;
            tChart1.Animations.Add(expand = new Steema.TeeChart.Animations.Expand());
            expand.Target  = ChartClickedPartStyle.SeriesPointer;
            expand.Trigger = Steema.TeeChart.Animations.AnimationTrigger.MouseOver;
        }
Example #2
0
        private static void CreateGraph(StreamWriter OutputFile, XmlNode N, int NextLevel)
        {
            string InstanceName = XmlHelper.Name(N.OwnerDocument.DocumentElement);
            string GraphName;

            if (N.Name == "XYPairs")
            {
                GraphName = XmlHelper.Name(N.ParentNode.ParentNode) + XmlHelper.Name(N.ParentNode) + "Graph";
            }
            else
            {
                GraphName = XmlHelper.Name(N.ParentNode) + XmlHelper.Name(N) + "Graph";
            }

            Directory.CreateDirectory(InstanceName + "Graphs");
            string GifFileName = InstanceName + "Graphs\\" + GraphName + ".gif";

            // Setup cleanish graph.
            TChart Graph = new TChart();

            Graph.Aspect.View3D                  = false;
            Graph.Legend.Visible                 = false;
            Graph.Axes.Left.AutomaticMinimum     = false;
            Graph.Axes.Left.Minimum              = 0.0000000005;
            Graph.Axes.Left.Grid.Visible         = false;
            Graph.Axes.Left.Labels.ValueFormat   = "###0.###";
            Graph.Axes.Left.MinorTicks.Visible   = false;
            Graph.Axes.Left.MaximumOffset        = 1;
            Graph.Axes.Bottom.AutomaticMinimum   = false;
            Graph.Axes.Bottom.Minimum            = 0;
            Graph.Axes.Bottom.Grid.Visible       = false;
            Graph.Axes.Bottom.Labels.ValueFormat = "###0.###";
            Graph.Axes.Bottom.MinorTicks.Visible = false;
            Graph.Axes.Bottom.MaximumOffset      = 4;
            Graph.Walls.Visible                  = false;
            Graph.Header.Text            = GraphName;
            Graph.Panel.Bevel.Outer      = Steema.TeeChart.Drawing.BevelStyles.None;
            Graph.Panel.Brush.Color      = Color.White;
            Graph.Panel.ImageBevel.Width = 1;
            Graph.Panel.Shadow.Visible   = false;
            Graph.Panel.Gradient.Visible = false;

            // Create a line series.
            Steema.TeeChart.Styles.Line LineSeries = new Steema.TeeChart.Styles.Line();
            Graph.Series.Add(LineSeries);

            // work out x and y variable names.
            string XName = XmlHelper.Value(N.ParentNode, "XProperty");

            if (N.ParentNode.Name == "TemperatureFunction")
            {
                XName = "Temperature (oC)";
            }

            string YName;

            if (N.Name == "XYPairs")
            {
                YName = XmlHelper.Name(N.ParentNode);
            }
            else
            {
                YName = XmlHelper.Name(N);
            }
            if (YName == "Function")
            {
                YName = XmlHelper.Name(N.ParentNode.ParentNode);
            }

            Graph.Axes.Left.Title.Text   = YName;
            Graph.Axes.Bottom.Title.Text = XName;

            // Set up to write a table.
            OutputFile.WriteLine("<table border=\"0\">");
            //   OutputFile.WriteLine("<td></td><td></td>");
            //   OutputFile.WriteLine("<tr>");

            // output xy table as a nested table.
            OutputFile.WriteLine("<td>");
            OutputFile.WriteLine("<table width=\"250\">");
            OutputFile.WriteLine("<td><b>" + XName + "</b></td><td><b>" + YName + "</b></td>");
            List <string> XYs = XmlHelper.Values(N, "xy");

            foreach (string XY in XYs)
            {
                string[] XYValues = XY.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (XYValues.Length == 2)
                {
                    LineSeries.Add(Convert.ToDouble(XYValues[0]), Convert.ToDouble(XYValues[1]));
                }
                if (Convert.ToDouble(XYValues[1]) < 0.05 && Convert.ToDouble(XYValues[1]) > 0)
                {
                    Graph.Axes.Left.Labels.ValueFormat = "#.#######";
                }

                OutputFile.WriteLine("<tr><td>" + XYValues[0] + "</td><td>" + XYValues[1] + "</td></tr>");
            }
            OutputFile.WriteLine("</table>");
            OutputFile.WriteLine("</td>");

            // output chart as a column to the outer table.
            OutputFile.WriteLine("<td>");
            OutputFile.WriteLine("<img src=\"" + GifFileName + "\">");
            OutputFile.WriteLine("</td>");
            OutputFile.WriteLine("</tr>");
            OutputFile.WriteLine("</table>");

            // Export graph to bitmap file.
            Rectangle         Bounds = new Rectangle(0, 0, 300, 200);
            Stream            stream = new FileStream(GifFileName, FileMode.Create);
            ImageExportFormat image  = Graph.Chart.Export.Image.GIF;

            image.Width  = Bounds.Width;
            image.Height = Bounds.Height;
            image.Save(stream);
            stream.Close();
        }